Файл: BC430_EN_Col62_FV_Part_A4_-_ABAP_Dictionary.pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 03.04.2021

Просмотров: 2302

Скачиваний: 40

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.
background image

Unit 2: Data objects in the ABAP Dictionary

BC430

Table ZEMPLOY##

Field

Data element

Domain

Type,
Length

Meaning

CLIENT

S_CLIENT

CLIENT

Client

CARRIER

S_CARR_ID

S_CARR_ID

Carrier

EMP_NUM

own

own

NUMC,
10

Personnel
number

FIRST_NAME

S_FNAME

S_FNAME

First name

LAST_NAME

S_LNAME

S_LNAME

Last name

DEPARTMENT

own

own

CHAR,
4

Department
code

AREA

own

own

CHAR,
1

Area

SALARY

own

own

CURR,
10
Dec. 2

Salary

CURRENCY

S_CURRCODE

S_CURR

Currency

2.

Create table ZDEPMENT##.

Via the path

Tools

ABAP Workbench

Development

ABAP

Dictionary

, you come to the overview screen of the ABAP Dictionary.

Table ZDEPMENT##

Field

Data
element

Domain

Type,
Length

Description

CLIENT

S_CLIENT

CLIENT

Client

CARRIER

S_CARR_ID S_CARR_ID

Airline

DEPARTMENT

own

own

CHAR,
4

Department
code

TELNR

own

S_PHONE

CHAR,
30

Telephone

FAXNR

own

S_PHONE

CHAR,
30

Fax

3.

Document fields

Personnel number

and

Department code

.

4.

To activate the table, you now have to make the technical settings and assign
a currency field if an amount field exists in the table.

Continued on next page

58

© 2007 SAP AG. All rights reserved.

2006/Q2


background image

BC430

Lesson: Tables in the ABAP Dictionary

Task 2:

Make sure that the same fields are available in both tables for recording the
changes by adding these fields to both tables with a substructure ZCHANGE##.

Note:

Changes to tables ZEMPLOY## and ZDEPMENT## are critical

and therefore must be recorded. The maintenance transaction must note
who last changed a table entry. This can be done by appending fields for
the personnel number of the last person to change the entry and the date of
the last entry to tables ZEMPLOY## and ZDEPMENT##.

In a real application, the above enhancement would always cause the
standard table maintenance for the two tables to be deactivated. Your own
maintenance transactions would instead be created for the table in which
the fields for change logging would be filled internally by the program
and not directly by the user.

Creation of such transactions goes beyond the scope of this course. In this
course, we therefore assume that all users themselves (correctly) fill these
fields in the standard table maintenance routine.

1.

Create the structure ZCHANGE##. Create a new data element for the

last

changed by

field using the domain you used for the personnel number. Use

S_CHDATE as data element for the date of the last change.

2.

Insert ZCHANGE## as Include on the tables ZEMPLOY## and
ZDEPMENT##.

3.

Find out what actions have been carried out on the database.

4.

Start Program BC430_CHECK in Transaction SE38.

Note:

Program BC430_CHECK checks whether your solutions are

correct and fills the new tables ZEMPLOY## and ZDEPMENT##
with sample data needed for later exercises.

2006/Q2

© 2007 SAP AG. All rights reserved.

59


background image

Unit 2: Data objects in the ABAP Dictionary

BC430

Solution 5: Tables in the ABAP Dictionary

Task 1:

Create the two transparent tables ZEMPLOY## and ZDEPMENT##. Define
their key fields.

Note:

Before you can activate the tables, you still have to define their

technical settings. The procedure is described in the last tasks for the
exercises. The first tasks can also be solved without activating the table.

Data is maintained for three airlines. An airline has 20,000 employees and
between 10 and 30 departments. Do not buffer or log the data. Buffering
will be discussed in the exercises for the next unit.

1.

Create table ZEMPLOY##.

Via the path

Tools

ABAP Workbench

Development

ABAP

Dictionary

, you come to the overview screen of the ABAP Dictionary.

Table ZEMPLOY##

Field

Data element

Domain

Type,
Length

Meaning

CLIENT

S_CLIENT

CLIENT

Client

CARRIER

S_CARR_ID

S_CARR_ID

Carrier

EMP_NUM

own

own

NUMC,
10

Personnel
number

FIRST_NAME

S_FNAME

S_FNAME

First name

LAST_NAME

S_LNAME

S_LNAME

Last name

DEPARTMENT

own

own

CHAR,
4

Department
code

AREA

own

own

CHAR,
1

Area

SALARY

own

own

CURR,
10
Dec. 2

Salary

CURRENCY

S_CURRCODE

S_CURR

Currency

a)

Mark

Database table

and enter table name

ZEMPLOY##

in the

corresponding input field. Choose

Create

. Enter a short text in the

maintenance screen for the table.

Continued on next page

60

© 2007 SAP AG. All rights reserved.

2006/Q2


background image

BC430

Lesson: Tables in the ABAP Dictionary

b)

Choose delivery class A and mark

Table maintenance

allowed.

c)

Now choose tab page

Fields

to go to the maintenance screen for

the field definitions. Enter the field names (they need not lie in the
customer namespace).

d)

For the fields

Client

,

Carrier

,

First name

,

Surname

and

Currency

, you

use the given data element by entering the name of the data element
in the

Field type

column. Save your entries.

e)

Create your own data elements for fields

Personnel number

,

Department code

,

Area

, and

Salary

. In the

Field type

column, enter a

name (

Z<object>##

) for the data element. Select the name of the

data element. The data element definition appears.

f)

Enter a short text (component of the F1 help). Now choose tab page

Field label

and store the texts for the field labels there.

g)

You also have to assign the data element a technical description
(domain). Select tab page

Definition

and enter a name

(

Z<object>##

) for your domain there. If the domain is predefined,

activate the data element and return (using F3) to the maintenance
screen for the table fields. Otherwise select the domain name. The
domain definition appears.

h)

There, you define the short description, the data type (NUMC, CHAR
or CURR) and the field length. Activate the domain.

i)

Go back one screen (using F) to the data element definition and activate
your data element.

j)

Navigate back one more screen to the field definition. Start again with
e) until all the table fields are defined. Save your table.

k)

Define the reference table and reference field for the

salary

field. Select

the field name and enter the following in the next dialog box:

Field

Value

Reference table

ZEMPLOY##

Reference field

Currency

l)

Define the key fields for the ZEMPLOY## table by ticking the

Key

column behind the field name. The fields

Client

,

Carrier

, and

Personnel number

uniquely identify an entry. They must, therefore,

be marked as key fields.

Note:

The key fields

Client

,

Carrier

and

Personnel

number

must stand in this order at the beginning of the field list.

Continued on next page

2006/Q2

© 2007 SAP AG. All rights reserved.

61


background image

Unit 2: Data objects in the ABAP Dictionary

BC430

m) Activate the ZEMPLOY## table. The maintenance screen for the

technical settings appears automatically.

Note:

Since the contents of table ZEMPLOY## do not change

frequently, you must choose data class

APPLO

(master data).

The expected number of records in the ZEMPLOY## table is
60,000, therefore you must choose the size category 2. The
table should be neither buffered nor logged.

Table ZEMPLOY##

Data class

APPL0

(master data)

Size Category

2

Buffering

Not allowed

Logging

No logging

Save the technical settings. Go back to the maintenance screen of the
table (F3). The table is activated.

2.

Create table ZDEPMENT##.

Via the path

Tools

ABAP Workbench

Development

ABAP

Dictionary

, you come to the overview screen of the ABAP Dictionary.

Table ZDEPMENT##

Field

Data
element

Domain

Type,
Length

Description

CLIENT

S_CLIENT

CLIENT

Client

CARRIER

S_CARR_ID S_CARR_ID

Airline

DEPARTMENT

own

own

CHAR,
4

Department
code

TELNR

own

S_PHONE

CHAR,
30

Telephone

FAXNR

own

S_PHONE

CHAR,
30

Fax

a)

Mark

Database table

and enter table name

ZDEPMENT##

in the

corresponding input field. Choose

Create

. Enter a short text in the

maintenance screen for the table.

b)

Choose delivery class A and select

Table maintenance allowed

.

Continued on next page

62

© 2007 SAP AG. All rights reserved.

2006/Q2