Skip to Content
Author's profile photo Horst Schaude

How to Use the Annotation WithAdministrativeData

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.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Dhruvin Mehta
      Dhruvin Mehta

      Hi Horst,

      Some how this is not working fot me

      [WithAdministrativeData][ChangeHistory] node notes[0,n]{
      [Label("Note ID")] element Noteid : ID;
      [Label("Notes2")] element HistryNote : String;
      [Label("Changed By")] element ChangedBy : UUID;
      [Transient] element visible : Indicator ;
      [Transient] element NoteDisp : Indicator ;
      action CheckAuth;

      When ever i am saving data on this node it is not giving me any administrative data, it always shows blank.



      if you see in UI it got automatically added for some notes for some not, very unreliable behaviour.

      Author's profile photo Horst Schaude
      Horst Schaude
      Blog Post Author

      Hello Dhruvin,

      Did you create those empty instances before adding the annotation? Because the "create" part would only be filled upon creation.

      What about the "change" part: is the data filled here?

      .     Horst

      Author's profile photo Dhruvin Mehta
      Dhruvin Mehta

      Hi Horst,

      Nope i did create the instance post annotation and also last changed by and last changed on is not poppulated



      Author's profile photo Horst Schaude
      Horst Schaude
      Blog Post Author

      Hello Dhruvin,

      In that case I would consider this as an error and raise an incident.

      .    Horst

      Author's profile photo Dhruvin Mehta
      Dhruvin Mehta

      Okay I have raised incident! thanks for the input 🙂

      Just a small question while creating instance do i have to do something? like createWithadmin data or something like that?

      Author's profile photo Horst Schaude
      Horst Schaude
      Blog Post Author

      Hello Dhruvin,

      No, the idea is

      • Just add the annotation and let the framework do the "dirty" work
      • Lay back and consume the results

      .    Horst