Unit 2: Creating Database Field Attributes
Use
In this unit you create and implement the
database field attribute document date. This attribute contains the document date as a field value as it is stored on the database.The system helps you implement this attribute by generating source text automatically.
Procedure
All database field attributes of an object type refer either to the table used to define its key fields or to a table with an identical key structure.
The Create dialog box is then displayed.
The attribute is transferred into the object type definition with the automatically-proposed name DocumentDate .
Implementing attributes in the implementation program
Check the definition made so far. To do so, choose .
The system detects that the database field attribute has not been implemented in the program of the object type and allows you to generate a template automatically for the missing source text.
Make sure you choose this option.
The automatic generation of the implementation program has satisfactory results for database field attributes so that no revision is necessary.
The system then automatically goes to the implementation program of the object type you created.
Here, you can see additional program components that control access to the table with the attributes.
Do not change this part of the implementation!
Database field attribute
Database field attributes are implemented between the macro commands
GET_TABLE_PROPERTY <table name> and END_PROPERTY .To program one access for all attributes that refer to a table, the tables are buffered initially in an internal table. This internal table is created from the database table in the subroutine
FORM SELECT_TABLE_<table name> USING SUBRC LIKE SY-SUBRC .Analyze the implementation program as it stands. You can use the
implementation program in the appendix as a comparison.Result
The object type must first be generated and released before it can be instantiated and tested.
The system informs you if the object type still contains errors. Try to correct these errors in the error overview (Goto
The attributes created up to now can then be tested.
Testing the DocumentDate attribute
The Test Object Type <Object Name>: No Instance screen appears.
Identify an object of the type sales order by entering the number of a sales order of your choice. Use the F4 input help if necessary.
The Test Object Type <Object Name> screen then appears, in which you can test your object type (execute methods, check attribute values).