Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
HorstSchaude
Product and Topic Expert
Product and Topic Expert
Nearly every standard Business Object has some structure named “AdministrativeData”.

  • It contains information about

  • Who has created this node instance

  • When was this node instance created

  • Who was the last changer of this node instance

  • When took this last change place


Up to now those information has to be manually inserted in case it is needed in a Custom Business Object.

With the new annotation WithAdministrativeData this task is done automatically by the SDK:

Just annotate any node in which you need the above described features and the system will take care for

  • Insert the structure to the node

  • Insert 2 associations to the Business Object Identity pointing to the instances of the creator and last changer.

  • Add a determination which fills the fields of the administrative structure on saving of the instance.


Nothing of these will be visible in the code defining the Custom Business Object, but you can use the associations in the scripting or in the UI.
Furthermore SADL queries can be built on the elements of the structure.

Let me explain this with an example.

First – as teaser – here’s the UI we want to have


Step 1: Add the Annotation in the definition of the Custom Business Object


Add the annotation WithAdministrativeData at each node you required the above described features.

Please be aware that this will enlarge the database table created for these nodes



In this example I have added the administrative data structure to the Root node and the Item node.

Step 2: Enhance the UI with the Administrative Data


Let’s have a look at the OWL because here we can show the data in the preview area as well as we can define the SADL query here.

Here you can see the structure and associations the system has automatically inserted per node

  • Structure SAP_SystemAdministrativeData

  • Associations SAP_CreationIdentity and SAP_LastChangeIdentity


All are prefixed with “SAP_” to prevent any clashes with elements or associations created by the developer.



Let’s have a look at the Root node.

I’ve defined a structure each for the creation data as well as the change data:

  • Create

    • CreationDateTime is bound to the element Root -> SAP_AdministrativeData -> CreationDateTime

    • FormattedName is bound to the element Root -> SAP_CreationIdentity -> FormattedName



  • Change

    • ChangeDateTime is bound to the element Root -> SAP_AdministrativeData -> ChangeDateTime

    • FormattedName is bound to the element Root -> SAP_LastChangeIdentity -> FormattedName




The same goes for the Item node with the respective elements and associations in the BO model at the Item node.

Step 3: Define a SADL query which uses the Administrative Data


Of course you can use the queries at the BO nodes to query for an instance w.r.t a special creation or last change date.

But as the structure SAP_SystemAdministrativeData contains only the UUID for the identity of the creator / last changer you need a SADL query.

Simply go to the Controller -> Query section and create via the context menu a SADL query.

Map the result list and the BO model and you can choose all fields from the BO model including the elements inside the SAP_SystemAdministrativeData.


For the real name you start from the associations SAP_CreationIdentity and SAP_LastChangeIdentity, but you need to select the Person -> CurrentCommon -> BusinessPartnerFormattedName as the resp. field at the Identity BO is transient.

That’s all, folks.
Horst
6 Comments