ā2024 May 09 9:11 AM - edited ā2024 May 09 9:14 AM
I want to create Log for RAP Table Maintenance Generator like who is Create ,Delete ,Edit records and if record edited previous value and new value i need log in RAP application for custom table
Request clarification before answering.
In ADT, open the technical table settings of the table by expanding the table node in the Project Explorer. Activate the Log Changes option. All changes are then recorded in the table DBTABLOG. You can access the content changes using the SAP Fiori app Business Configuration Change Logs.
No additional fields are required in the table and this is the default method to enable auditing for configuration changes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Venkat,
With Table Maintenance Generator and the other details you mentioned I assume you have a Table at BTP ABAP Layer. Regarding Table Maintenance Generator at BTP ABAP layer that am not sure whether we can have but for all such requirements we were having RAP UI annotation based Apps only. So, here is the solution,
1.) For Create and Change operation, add the log fields to the Table like below:
created_by : abp_creation_user;
created_at : abp_creation_tstmpl;
last_changed_by : abp_lastchange_user;
last_changed_at : abp_lastchange_tstmpl;
local_last_changed_at : abp_locinst_lastchange_tstmpl;
2.) Now in the CDS view layer makes use of below @Semantics annotations which will take care of filling these log information:
@Semantics.user.createdBy: true
created_by as CreatedBy,
@Semantics.systemDateTime.createdAt: true
created_at as CreatedAt,
@Semantics.user.lastChangedBy: true
last_changed_by as LastChangedBy,
@Semantics.systemDateTime.lastChangedAt: true
last_changed_at as LastChangedAt,
@Semantics.systemDateTime.localInstanceLastChangedAt: true
local_last_changed_at as LocalLastChangedAt
Now coming to Delete operation, that won't be possible until and unless you activate 'Change Document' at DDIC level and that I don't know whether could be done or is even recommended doing at Cloud level. Hence, for such requirements I would suggest to have a 'Deletion Indicator' field which would help in setting the record invalid and for this case the Change/Modify Log fields would help you track who set the indicator.
And for Previous and New Value part you mentioned. For storing the Previous values kindly add those corresponding fields in the DB and in the 'Determination' part of Behavior Pool code you can compare the current value using EML syntax READ ENTITIES and for the same key fetch the DB records and do a compare to check whether a change is performed or not. If change is detected then fill the Previous value fields.
Hope this helps.
Thanks,
Sijin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.