Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
pmcfarling
Participant
I couldn't find good documentation on how to use the administrative data that I've see in almost all FIORI Elements blogs etc..  so after digging through SAP code, I got it work,

First, add created on/changed on date, time and user to your table.

The domains should be dats, tims and char(12) for the user name.

I recommend putting them in a structure that you can just include in all your tables.

 
@EndUserText.label : 'Admin Data for BOPF'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
define structure zadmin_data {
create_date : datum;
create_time : tims;
create_by : username;
change_date : datum;
change_time : tims;
change_by : username;
}

Then, add it as an include in all your table definitions,

Next, annotate your transactional CDS View per below.
...
@ObjectModel.readOnly: true
@Semantics.systemDate.createdAt: true
contract.create_date,
@ObjectModel.readOnly: true
@Semantics.systemTime.createdAt: true
contract.create_time,
@ObjectModel.readOnly: true
@Semantics.user.createdBy: true
contract.create_by,
@ObjectModel.readOnly: true
@Semantics.systemDate.lastChangedAt: true
contract.change_date,
@ObjectModel.readOnly: true
@Semantics.systemTime.lastChangedAt: true
contract.change_time,
@ObjectModel.readOnly: true
@Semantics.user.lastChangedBy: true
contract.change_by,
...

 

That's it.

 

Now for a little more about what's going on.  The generated BOPF comes with a determination called ADMINISTRATIVE _DATA. It is implemented by class /BOBF/CL_LIB_D_ADMIN_DATA_AI.



that class reads the annotations and fills out the admin data.

 

Some other notes:

I could not get it work with the include I often see  "/bobf/s_lib_admin_data"

Annotating those fields with @Semantics.systemDate and @Semantics.systemTime or @Semantics.systemDateTime (Since the date/time is handled by 1 TIMESTAMPL field in the include) resulted in short dumps due to data type mismatches.

I also found class /bobf/cl_lib_d_admin_data_cds but I cannot figure out how to use it, or if I should. Since the ADMINISTRATIVE_DATA determination is hard wired to /BOBF/CL_LIB_D_ADMIN_DATA_AI I didn't see a point as the annotations would just short dump in /BOBF/CL_LIB_D_ADMIN_DATA_AI anyway.

 

This was done on an S/4 1909 FPS01 system.
2 Comments
Labels in this area