Lesson 3: Adding Further Attributes
Use
In this unit, you will add further attributes that can be used in a workflow definition to the object type.
Procedure
"Last Changed by" as an Object Reference
The inherited attribute LastChangedBy (name of person who made last change) of the object type Zini_2005 returns the contents of the database field AUFK-AENAM. This is the user name of the person who made the last change.
You can also use the name of the user from the user defaults in task descriptions or work item texts. To do so, you create a new attribute for your object type.
The name of the user is an attribute of the object type USR01 (SAP User). You must create an attribute for the object type Z ini _2005 ( production order) with a data type reference to the object type USR01 ( SAP user).
-
Open your object type to edit it in the Business Object Builder.
The Change Object Type Zini_2005 screen is then displayed.
-
Position the cursor on the Attributes entry and choose
.The query Create with ABAP Dictionary field proposals? appears.
-
choose No.
-
Enter the following data:
-
Attribute: ChangedBy
-
Name: Changed by (object)
-
Short text: Last changed by (object reference)
-
Reference table: AUFK
-
Reference field: AENAM
-
Object Type: USR01
-
-
Select Database field in the Source frame.
-
Select Object type in the Data type reference frame.
-
Choose
. -
Choose
.
Status of an Object Status as an Attribute
If the status (set or not set) of an object is to be available as an attribute of an application object, you must add the interface IFSTATUS (status management) and implement the attributes StatusObjNumber and StatusObjTyp that it contains. Then add the ReleaseStatus attribute to your object type:
-
Position the cursor on the Interfaces entry and choose
.The Enter Interface Type dialog box appears.
-
Enter the IFSTATUS interface in the input field and choose
.This interface provides the StatusObjNumber and StatusObjTyp attributes.
-
Position the cursor on the StatusObjType attribute (object type of status management) in the list.
-
Choose
.The entry changes color. You can now edit the attribute.
-
Position the cursor on the attribute StatusObjType and choose Program.
The dialog box "Do you want to have a template generated automatically for the missing section?" is displayed.
-
Choose Yes.
The source code, which is generated automatically, is displayed.
-
Make the following changes to the source code:
GET_PROPERTY STATUSOBJTYPE CHANGING CONTAINER. OBJECT-STATUSOBJTYPE = 'ORH': SWC_SET_ELEMENT CONTAINER 'StatusObjType' OBJECT-STATUSOBJTYPE. END_PROPERTY. -
Choose
,
, and then
. -
Position the cursor on the StatusObjNumber attribute (object number of the status management).
-
Choose
.The entry changes color. You can now edit the attribute.
-
Position the cursor on the attribute StatusObjNumber and choose Program.
The dialog box "Do you want to have a template generated automatically for the missing section?" is displayed.
-
Choose Yes.
The source code, which is generated automatically, is displayed.
-
Make the following changes to the source code:
GET_PROPERTY STATUSOBJNUMBER CHANGING CONTAINER. OBJECT-STATUSOBJNUMBER = 'OR'. SWC_GET_PROPERTY SELF 'Number' OBJECT-STATUSOBJNUMBER+2. SWC_SET_ELEMENT CONTAINER 'StatusObjNumber' OBJECT-STATUSOBJNUMBER. END_PROPERTY. -
Choose
,
, and then
. -
Position the cursor on the Attributes entry and choose
.The query Create with ABAP Dictionary field proposals? appears.
-
choose No.
-
Enter the following data:
-
Attribute: ReleaseStatus
-
Name: Object Status
-
Short text: Status of an object status
-
Object Status: I0002
-
-
Select Object status in the Source frame.
-
Choose
.The system enters SWCEDITOR as the reference table and OBJSTATUS as the reference field.
-
Choose
.
As this is an object status attribute, no implementation is required for this attribute.
Generate and Test Object Type
-
Choose .
-
Choose
to generate the object type. -
Position the cursor on the Object type entry and choose
. -
Chose FIND
in the line. Enter the number of a production order.
The list displays the values of all attributes for this object type. For the attributes that are created with a data type reference to an object type, you can navigate further to the attributes of the referenced object type.

