Unit 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.

Instead of the user ID MILLERP, which is returned as the value of the attribute LastChangedBy , the name Peter Miller from is be used from the user defaults in the texts.

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).

  1. Open your object type to edit it in the Business Object Builder.
  2. The Change Object Type Zini_2005 screen is then displayed.

  3. Position the cursor on the Attributes entry and choose .
  4. The query Create with ABAP Dictionary field proposals? appears.

  5. Choose No.
  6. Enter the following data:

Attribute: ChangedBy

Name: Changed by (object)

Description: Last changed by (object reference)

Reference table: AUFK

Reference field: AENAM

Object type: USR01

  1. Select Database field in the Source frame.
  2. Select Object type in the Data type reference frame.
  3. Choose .
  4. Choose .

As this is a database field attribute (source database field) no implementation is carried out for this attribute.

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:

  1. Position the cursor on the Interfaces entry and choose .
  2. The Enter Interface Type dialog box appears.

  3. Enter the IFSTATUS interface in the input field and choose .
  4. This interface provides the StatusObjNumber and StatusObjTyp attributes.

  5. Position the cursor on the StatusObjType attribute ( object type of status management) in the list.
  6. Choose .
  7. The entry changes color. You can now edit the attribute.

  8. Position the cursor on the attribute StatusObjType and choose Program.
  9. The dialog box "Do you want to have a template generated automatically for the missing section?" is displayed.

  10. Select Yes.
  11. The source code, which is generated automatically, is displayed.

  12. Make the following changes to the source code:
  13. GET_PROPERTY STATUSOBJTYPE CHANGING CONTAINER.
    OBJECT-STATUSOBJTYPE = 'ORH'.
    SWC_SET_ELEMENT CONTAINER
    'StatusObjType' OBJECT-STATUSOBJTYPE.
    END_PROPERTY.

  14. Choose , and then .
  15. Position the cursor on the StatusObjNumber attribute ( object number of the status management).
  16. Choose .
  17. The entry changes color. You can now edit the attribute.

  18. Position the cursor on the attribute StatusObjNumber and choose Program.
  19. The dialog box "Do you want to have a template generated automatically for the missing section?" is displayed.

  20. Select Yes.
  21. The source code, which is generated automatically, is displayed.

  22. Make the following changes to the source code:
  23. 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.

  24. Choose , and then .
  25. Position the cursor on the Attributes entry and choose .
  26. The query Create with ABAP Dictionary field proposals? appears.

  27. Choose No.
  28. Enter the following data:
  29. Attribute: ReleaseStatus

    Name: Object status

    Description: Status of an object status

    Object status: I0002

  30. Select Object status in the Source frame.
  31. Choose .
  32. The system enters SWCEDITOR as the reference table and OBJSTATUS as the reference field.

  33. Choose .

As this is an object status attribute, no implementation is required for this attribute.

Generate and Test Object Type

  1. Choose Edit ® Change release status ® Object type ® To implemented.
  2. Choose to generate the object type.
  3. Position the cursor on the Object type entry and choose .
  4. Chose FIND in the line. Enter the number of a production order.

You can enter the number of the production order that you used in Unit 1.

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.