Function documentationDefinition of Attributes for an Object Type (BOR) Locate this document in the navigation structure

 

You must define attributes for an object type when you want to query particular properties, statuses, or values at runtime.

Features

Attributes have various sources of information. You can split attributes according to the following sources:

  • Virtual

    The information is not determined until runtime, for example by calculation.

  • Database field

    The information is the content of a database field.

  • Object Status

    The information is an object status.

The attribute information is returned in two different data type references:

  • As field or structure reference to a value in the ABAP Dictionary

  • As object reference to an object of an object type

You can declare one object type attribute as default attribute. For more information, see Editing the Basic Data of an Object Type.

After definition of an attribute, you can add source text to the implementation program automatically. To do this, select the attribute in the list and choose Program.

Activities

To create an attribute, position the cursor on the component name Attributes (blue background), and select . Keep in mind the rules for naming object type components.

Database field attribute

Always create an attribute of this kind with a reference to a field of the ABAP Dictionary. Answer YES to the question Create with ABAP Dictionary field proposals?, and have the system make proposals for the fields.

With a database field attribute that provides the information as a field or structure reference, choose the table and field. Define whether it as a mandatory attribute.

With a database field attribute that provides the information as an object reference, choose the table, the field as source and the object type for the data type reference. Define whether it as a mandatory attribute.

Note Note

The object type for the object reference can only have one key field and must be identifiable using the field. If these conditions are not met, you must define a virtual attribute.

End of the note.

If the attribute is derived from a field in a table whose key fields do not correspond to or only correspond partly to the key fields of the object type, the extensions in the implementation program are not sufficient. The source text contains question marks (??????????) at the relevant points. Revise the source text at these points. Otherwise, the source text created is complete. For more information, see Programming Database Field Attributes.

Virtual attribute

With virtual attributes, it is not worth having the system make ABAP Dictionary field proposals. Answer the question with NO. A dialog box with the attribute data is displayed.

Select the indicator Virtual and give the attribute an ID and texts. Define the other attribute properties and enter a data type reference. If you use the ABAP Dictionary as data type reference, only the data type of the field specified is evaluated.

Note Note

Multiline attributes and attributes with a data type reference to an object type with several key fields must be implemented as virtual attributes.

End of the note.

The extensions in the implementation program are not sufficient. For more information, see Implementation Program for a Virtual Attribute.

Object status attribute

You can only define an object status attribute if the object type supports the Interface Status Management. It is not worth having the system make ABAP Dictionary field proposals. Answer the question with NO. A dialog box with the attribute data is displayed.

Select the indicator Object status and give the attribute an ID and texts. Define the other attribute properties and the object status. The system enters the field OBJSTATUS from the table SWCEDITOR as data type reference. The source text created in the implementation program is complete.

Further Procedure

Relationships between two object types are described using attributes, which return their information as object references to the other object type. In the field Inverse Attribute, enter the attribute of the other object type, which contains the object reference to this object type.

Before the attribute is used, you must change its release status. To check the attribute you must generate the object type, after which you can test it. For more information, see Processing Object Types.

You can use macros to access the attribute. For more information, see Macro Instructions for Accessing Objects, Attributes, and Methods.