ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 03.04.2021
Просмотров: 2365
Скачиваний: 41
BC430
Lesson: Tables in the ABAP Dictionary
c)
Now choose the
Fields
tab page to go to the maintenance screen
for field definitions. Enter the field names (they need not lie in the
customer namespace).
d)
For the fields
Client
and
Carrier
, you use the given data by entering the
name of the data element in the
Field type
column. Save your entries.
e)
For the fields
Department code
,
Telphone number
and
Fax number
, you
should create your own data elements. 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 the
Field
label
tab page 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. Otherwise select the domain
name. The domain definition appears.
Note:
If the domain is predefined, activate the data element and
return (using F3) to the maintenance screen for the table fields.
h)
Define the short description, the data type (CHAR), and the field length
(30) there. Activate the domain.
i)
Go back one screen (using F3) to the data element definition and
activate your data element.
j)
Save your table.
k)
Define the key fields for the ZDEPMENT## table by ticking the
Key
column behind the field name. The fields
Client
,
Carrier
, and
Department code
uniquely identify an entry. They must, therefore,
be marked as key fields.
l)
Activate your table and define the technical settings:
Since the contents of table ZDEPMENT## do not change frequently,
you must choose data class
APPL0
(master data). The expected number
of records in the ZDEPMENT## table is 90, therefore you must choose
the size category 0. The table should be neither buffered nor logged.
Continued on next page
2006/Q2
© 2007 SAP AG. All rights reserved.
63
Unit 2: Data objects in the ABAP Dictionary
BC430
Table ZDEPMENT##
Field
Value
Data class
APPL0
(master data)
Size category
0
Buffering
Not allowed
Logging
No logging
3.
Document fields
Personnel number
and
Department code
.
a)
Double-click on the data element to go to the data element definition.
Switch to Change mode with
Display <=> Change
. Choose
Goto
→
Documentation
.
b)
Enter a text for the fields and save your entries.
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.
a)
Click on
Technical Settings
b)
Now choose the appropriate
Data class
and the
Size category
.
c)
Save your changes and return to the field view for the table.
d)
You still have to assign currency fields for amount fields (such as
SALARY). To do this, switch to the Currency/Quantity Fields tab page.
e)
Enter the name of the current table in the Reference Table field.
f)
In the Reference field, enter the name of the field you have used for
the currency.
Continued on next page
64
© 2007 SAP AG. All rights reserved.
2006/Q2
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.
a)
In the initial screen of the ABAP Dictionary, mark
Data type
and enter
ZCHANGE##
in the corresponding field. Choose
Create
.
b)
Mark
Structure
in the next dialog box.
c)
Enter the field names in column
Component
and the corresponding data
elements in column
Component type
. Create your own data element for
the first field. Use the domain you created for the personnel number in
the ZEMPLOY## table.
d)
Create one field for the personnel number and another one for the date
of change. Use the data element
S_CHDATE
for the second field.
e)
Activate structure ZCHANGE##.
Continued on next page
2006/Q2
© 2007 SAP AG. All rights reserved.
65
Unit 2: Data objects in the ABAP Dictionary
BC430
2.
Insert ZCHANGE## as Include on the tables ZEMPLOY## and
ZDEPMENT##.
a)
Go to the maintenance screen for table ZEMPLOY##.
b)
Choose
New rows
and position the cursor on the first new field.
c)
Choose
Edit
→
Include
→
Insert
.
d)
In the next dialog box, enter the name
ZCHANGE##
and choose
Continue
.
e)
Activate the ZEMPLOY## table. Make the same entries in order to
insert the substructure ZCHANGE## in ZDEPMENT## table.
3.
Find out what actions have been carried out on the database.
a)
You can display the actions that were performed in the database with
Utilities
→
Activation log
.
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.
a)
Start the transaction
SE38
via the entry field. Start program
BC430_CHECK
.
66
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Tables in the ABAP Dictionary
Lesson Summary
You should now be able to:
•
Create Tables
•
Use the two-level domain concept
•
Define the technical settings of a table
•
Create and use include structures
2006/Q2
© 2007 SAP AG. All rights reserved.
67