Change History (Reuse Library)
In the previous article, we learned, how to embed a change log in the custom business object. Here we are going to learn, how to capture the same in the ABSL scripting.
Change History is a SAP reuse library, which contains a function that you can use to retrieve data from a supplied Business Object and its nodes that were changed during the given period based on the Platform Change Document service.
Should have a knowledge on Change History (Business Object).
For more information about the change history Business Object creation, see http://blog.sankaranss.com/2017/06/22/change-history/.
Syntax: <BusinessObject>.Read(“NameSpace”, UUID, NodeID, FromDate, ToDate, User );
- BusinessObjectName defines the name of the Business Object.
- Define the namespace, e.g,. AP.CRM.Global:Lead.
- UUID: Retrieve current instant UUID. To get current UUID, Context.GetCurrentIdentityUUID()
- NodeID provides the NodeID of the Root node for the requested instance.
- The other four parameters are optional:
- NodeName: Restricts the result to given node
- ToChangeDateTime: If no value is given the current date and time is taken
- FromChangeDateTime: If no value is given 30 days earlier than the ToChangeDateTime is used
- ChangerUUID: Only the changes made to the respective user are returned.
Example for SAP Business Object
// get all changes of SAP Business Object Lead based upon Lead Root node ID var myLeadRootNodeId : UUID; myLeadRootNodeId = … var currentUser = Context.GetCurrentIdentityUUID(); var myChanges = ChangeHistory.Read( “AP.CRM.Global:Lead”, myLeadRootNodeId, “Root”, this.FromDateTime, this.ToDateTime, currentUser );
Example for Custom Business Object
// get all changes of Custom Business Object MyOwnBusinessObject based upon own BO Root node ID var currentUser = Context.GetCurrentIdentityUUID(); var myChanges = ChangeHistory.Read(“MyOwnBusinessObject”, this.GetObjectNodeReference().UUID, “Root”);
Debug the code and check the output as shown in the below screenshot.
If you like to add some points to this article, kindly leave your points as comments. Don’t forget to subscribe http://blog.sankaranss.com