Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
Developing a data model for your application, you normally want to track changes. So you add attributes like created_by, changed_by and so on at least for the header data. Sometimes the business requires also to track changes on item level. BOPF supports this standard requirement by a library function. This tutorial shows you how to use it in your BOPF BO.
The tutorial starts with the business object SALES_QUOTE created in the ‘Getting Started with Business Object Processing Framework’. This Business Object follows the semantics of the sales quote based on the NetWeaver Enterprise Procurement Model (EPM). You can use the BOB or BOBX editor. The tuturial uses BOB.

In the first step we include the structure /BOBF/S_LIB_ADMIN_DATA in the persistent structure of the root node.

In the second step we create the determination on the root node.

Last but not least we test the changes in the BO test tool BOBT.

Enhance the structure of the root node


In this step we will enhance data structure of the root node and add the attributes for administrative data. Launch the Business Object Builder (BOB). Open the business object ZD_SALES_QUOTE and navigate to the root node.



Double click the persistent structure and navigate to the data dictionary. Insert an include with the data type /BOBF/S_LIB_ADMIN_DATA and the group name ADMIN_DATA. This data structure contains the attributes CREA_DATE_TIME and LCHG_DATE_TIME - both typed with the data element TIMESTAMPL for UTC timestamp - and the attributes CREA_UNAME and LCHG_UNAME - both typed with the data element UNAME.


Save and activate the DDIC change. Then go back to the BO editor.

Create a determination

In the BO editor, start the determination creation wizard on the root node. Enter the determination name DET_ADM_DATA and a description.

Continue to the next step where you enter the name of the implementing class. Use the BOPF library class /BOBF/CL_LIB_D_ADMIN_DATA_TSM which cares for maintaining the adminstrative attributes.

Continue to the next step to determine the Determination Pattern. Determinations can be executed at different phases of the transaction. Administrative data must only be updated before the user saves the BO instance. So we select the pattern Derive dependent data before saving.

Continue to the next step to define the trigger nodes. As we only defined the administrative data on the root node, we want it to be updated at any time something changes in the BO instance, be it on root or item level. So we have to select all nodes as trigger nodes. The administrative data must be updated even when an item is deleted, not only when a root or item node is created or updated. We want to track all changes.

Continue and complete the wizard. The administrative data is now updated at any change on the BO instance. You can verify this with the BO test tool (BOBT).

Test the changes

To test the changes launch the transaction BOBT. Open the BO ZD_SALES_QUOTE and add a new instance. You can see the new attributes to track the BO changes. If you save the data the attributes are determined by the framework. Play around with item instances. You will see that they also influence the update of these attributes.

Summary


With a few model changes and the use of a BOPF library class, you can add attributes for tracking business object changes on each node level without having to code it by your own. You can test the new feature without any test code in the BO test tool.

8 Comments