ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 03.04.2021
Просмотров: 2354
Скачиваний: 41
Unit 2: Data objects in the ABAP Dictionary
BC430
Task 2:
Create several data elements and use the already defined domains for the technical
properties.
1.
Call transaction SE11.
a)
In the SAP EASY ACCESS menu, enter
se11
in the command field
and confirm your entry.
If you are in another transaction, you have to enter
/n se11
in the
command field and confirm your entry.
2.
Enter a data element (
ZLASTNAME##
) for the surname of a person and
use a suitable domain. The data element should be able to hold 30 letters in
upper and lower case.
a)
Select the
Data Type
radio button.
b)
Enter the name of the data type in the input field.
c)
Choose
Create
.
d)
In the popup that appears, select the
Data Element
radio button and
confirm the entry.
e)
Enter a meaningful description for the data element in the
short
description
field.
f)
On the
Data Type
tab page under elementary type, enter the relevant
domain that you created in the previous part of the exercise.
g)
On the
Field Label
tab page you still have to enter suitable names
for your data element. These names appear on screens and selection
screens (long version), for example, to explain the fields.
3.
Enter a data element (
ZFIRSTNAME##
) for the first name of a person and
use a suitable domain. The data element should be able to hold 30 letters in
upper and lower case.
a)
Proceed in the same way as for the previous exercise.
4.
Create a data element (
ZASSETS##
) for assets and use a suitable domain.
The data element should be used for business calculations.
a)
Proceed in the same way as for the previous exercise.
5.
Create a data element (
ZLIABILITIES##
) for liabilities and use a suitable
domain. The data element should be used for business calculations.
a)
Proceed in the same way as for the previous exercise.
Continued on next page
28
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Basic Data Types
Task 3:
Create a program
1.
Create the executable program
ZBC430_##_DATA_ELEMENTS
without
“TOP Include”.
a)
To create it, use transaction SE80 or SE38.
2.
Create the following entry fields in the program with the ABAP command
PARAMETERS
.
Parameter
Data Type
pa_fname
ZFIRSTNAME##
pa_lname
ZLASTNAME##
pa_activ
ZASSETS##
pa_liabs
ZLIABILITIES##
Calculate assets minus liabilities and output all parameters as well as the
calculation results in a list.
a)
See the source code excerpt from the model solution.
Continued on next page
2006/Q2
© 2007 SAP AG. All rights reserved.
29
Unit 2: Data objects in the ABAP Dictionary
BC430
3.
Execute the program and enter the different values in the selection screen,
which you output in a list.
a)
Make sure that it is possible to enter upper and lower case letters for
names, in accordance with the definitions in the domains. In the two
numeric fields, it must be possible to enter the decimal places and
a minus sign.
Result
Source text excerpt:
SAPBC430S_DATA_ELEMENTS
REPORT
sapbc430s_data_elements
.
*Replace ## by Your Group- Screennumber and uncomment the ABAP-coding
DATA:
result
TYPE zassets##.
PARAMETERS: pa_fname TYPE zfirstname##,
pa_lname TYPE zlastname##,
pa_activ TYPE zassets##,
pa_liabs TYPE zliabilities##.
START-OF-SELECTION.
NEW-LINE.
WRITE: 'Client:', pa_fname, pa_lname.
result = pa_activ - pa_liabs.
NEW-LINE.
WRITE: 'Finance:', pa_activ, pa_liabs, result.
30
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Basic Data Types
Exercise 2: Simple and Nested Structures
Exercise Objectives
After completing this exercise, you will be able to:
•
Create simple and nested structures in the Dictionary and use them in ABAP
programs
Business Example
In order to map complex data structures, you should build up a complex structure
for your project in the Dictionary.
Task 1:
Create simple structures that you can use later in ABAP programs.
1.
In the Dictionary, create a structure
ZNAME##
and include the following
two components in the structure. Use the data elements that you created in
previous exercises for typing.
Component
Component Type
Description
FIRSTNAME
own
first name
LASTNAME
own
last name
2.
Create a structure
ZADRESS##
and enter the four following components:
Component
Component Type
Description
STREET
S_STREET
Street
NR
S_NO
House number
ZIP
POSTCODE
Post code
CITY
S_CITY
Place of residence
Task 2:
Create a nested structure, so that you can use it later in ABAP programs.
1.
Create a structure
ZPERSON##
in the Dictionary.
Continued on next page
2006/Q2
© 2007 SAP AG. All rights reserved.
31
Unit 2: Data objects in the ABAP Dictionary
BC430
2.
Add the structure
ZADRESS##
as an Include structure to the ZPERSON##
structure. In addition, take on the structure
ZNAME##
in the ZPERSON##
structure as a nested structure under the component name NAME
3.
Enter an ABAP program
ZBC430_##_STRUCT_NESTED
. Create a
structured data object (
wa_person
) in this program of the type
ZPERSON##
.
Fill the components of this data object with any personal data and output
this data in a list.
32
© 2007 SAP AG. All rights reserved.
2006/Q2