Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
BC430_EN_Col62_FV_Part_A4_-_ABAP_Dictionary.pdf
Скачиваний:
204
Добавлен:
21.05.2015
Размер:
21.37 Mб
Скачать

BC430

Lesson: Basic Data Types

Exercise 1: Basic Data Types

Exercise Objectives

After completing this exercise, you will be able to:

Create basic data types in the Dictionary and use them in ABAP programs

Business Example

For your development project, you should create several global data types to which the other project members have access.

Task 1:

Create two domains, so that you can use them later in data elements.

1.Call transaction SE11.

2.Create a domain with the name ZDO_10NUM_## in the initial screen of the ABAP Dictionary.

3.The domain should be created for data elements that should take on 10-digit decimal numbers. From these 10 digits, 2 should be reserved for the decimal places. The data elements should also be able to be used for business calculations.

4.Save (as local object) and activate the domain.

5.In the initial screen of the ABAP Dictionary, create a domain with the name ZDO_30CHAR_##. The domain should be able to hold 30 text characters and, in the entry fields, the entry of lower-case letters should be permitted.

6.Save (as local object) and activate the domain.

Task 2:

Create several data elements and use the already defined domains for the technical properties.

1.Call transaction SE11.

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.

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.

Continued on next page

2006/Q2

© 2007 SAP AG. All rights reserved.

25

Unit 2: Data objects in the ABAP Dictionary

BC430

4.Create a data element (ZASSETS##) for assets and use a suitable domain. The data element should be used for business calculations.

5.Create a data element (ZLIABILITIES##) for liabilities and use a suitable domain. The data element should be used for business calculations.

Task 3:

Create a program

1.Create the executable program ZBC430_##_DATA_ELEMENTS without “TOP Include”.

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.

3.Execute the program and enter the different values in the selection screen, which you output in a list.

26

© 2007 SAP AG. All rights reserved.

2006/Q2

BC430

Lesson: Basic Data Types

Solution 1: Basic Data Types

Task 1:

Create two domains, so that you can use them later in data elements.

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 the entry

2.Create a domain with the name ZDO_10NUM_## in the initial screen of the ABAP Dictionary.

a)Select the Domain radio button.

b)Enter the name of the domain in the input field.

c)Press the Create button

3.The domain should be created for data elements that should take on 10-digit decimal numbers. From these 10 digits, 2 should be reserved for the decimal places. The data elements should also be able to be used for business calculations.

a)Enter a meaningful description for the domain in the short description field.

b)In the Data type field, enter the value DEC or select this entry from the input help (F4).

c)In the No. Characters field, enter the value 10

d)In the Decimal Places field, enter the value 2

e)Select the +/- sign check box

4.Save (as local object) and activate the domain.

a)Click on Save at the top of the screen.

5.In the initial screen of the ABAP Dictionary, create a domain with the name ZDO_30CHAR_##. The domain should be able to hold 30 text characters and, in the entry fields, the entry of lower-case letters should be permitted.

a)Proceed as in the previous steps and define the corresponding properties in the Definition tab page

6.Save (as local object) and activate the domain.

a)Click on Save at the top of the screen.

Continued on next page

2006/Q2

© 2007 SAP AG. All rights reserved.

27

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 GroupScreennumber 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

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]