Skip to Content
Author's profile photo Former Member

How to include administrative data to a BOPF node

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.
/wp-content/uploads/2014/01/bo_structure_362167.png
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.

rootnode.PNG

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.

ddic.PNG

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.

w_name.PNG

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.

w_class.PNG

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.

w_det_type.PNG

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.

w_trigger.PNG

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.

test.PNG

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.

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Tilmann David Kopp
      Tilmann David Kopp

      Thanks for this very good tutorial on how to use admin data for business objects. There is one more good thing about this solution that is worth to be mentioned: All affected node instances of the transaction will have exactly the same timestamp value. 

      Author's profile photo Christian Guenter
      Christian Guenter

      Hi Thea,

      nice Tutorial.

      Unfortunately i have an issue with the structure /BOPF/S_LIB_ADMIN_DATA. It's neither available im our 7.31 SP05 (ERP) nor in our 7.40 SP08 (SCM) system. Are there special requirements for this structure? Any note or something else? Of course i can easily create a similar structure for my own...

      Thanks.

      Regards Christian

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Christian,

      our namespaces are confusing: it is /BOBF/S_LIB_ADMIN_DATA. I felt in the trap myself... I corrected it now also in the document.

      Kind regards

      Thea

      Author's profile photo Christian Guenter
      Christian Guenter

      Great, thank you.

      The namespaces are indeed really confusing 😉

      Regards Christian

      Author's profile photo Siegfried Kuri
      Siegfried Kuri

      Hi Thea,

      i started working with BOPF in eclipse and i tried to add this determination. But unfortunately in eclipse only "react during save" can be set, the timepoint "before save" is missing. So i have to go to BOBX and set the timepoint "Before save" and then it works fine. Is this really the right way to do it?  or am i doing something wrong?

      Regards, Siggi

       

      Author's profile photo Neil Ward
      Neil Ward

      Hi,

       

      I just tried to implement this and when testing I get a short dump with message_type_x

       

      Is this method still valid for BOPF on an S4 system 1709?

      Author's profile photo Custodio de Oliveira
      Custodio de Oliveira

      Hi Neil,

       

      I'm using it on 1809, so I would say yes.

      Author's profile photo Neil Ward
      Neil Ward

      twas my mistake, forgot to add the ADMIN_DATA group name in the structure 🙁