Do you desire to track who changed your document?
You can use an embedded component to ensure that a change history is written for all changes made to your custom business object. After adding the embedded component to your business object, you can display the change history in the SAP cloud solution on the Changes tab of your work center. All changes such as add, create, and delete is displayed in a list.
1. You have created users with the Developer and Business User roles.
2. You have created and opened a solution in the studio.
Create a customer BO & Screens
- Create a custom Business Object (Change Log).
- Define elements/node as shown in the below screenshot. At least one element/node/association in your business object is annotated with ChangeHistory.
- Save and Activate.
For more information about the Custom Business Object creation, see http://blog.sankaranss.com/2016/03/29/sap-byd-business-object/.
- Right click on BO name -> Create Screens.
- Generate all screens.
For more information about the screen generation,
Add an Embedded Component to the Object Instance Floorplan (OIF)
- In the Studio, in the Solution Explorer, double-click the object instance floorplan (OIF).
The UI designer opens.
- On the Designer tab, click the Changes tab.
- In the Configuration Explorer, navigate to the ChangeDocuments_EC reuse component in the SAP_BYD_APPLICATION_UI/Reuse/ChangeHistory folder.
- Drag the reuse component to the top left pane of the OIF as shown in the graphic and then save your changes.
Create an Outport
- On the Controller tab, right-click Outports and select Add Outport.
The Outport Configuration: OutPort pane opens.
- Click the Add Parameter button.
- In the ParameterName field, enter ECORootNodeID as shown in the screenshot and save your changes.
- Next, to ParameterBinding, click … .
The Parameter Binding dialog box opens.
- Select NodeID and click OK.
Bind with EC Component
- On the Changes tab, click Bind. The Embedded Component Binding dialog box opens.
- Right-click Navigations and select Add Navigation.
- Bind the outport parameters as shown in the below screenshot.
- Click OK and save your changes.
Create an Event Handler
- On the Controller tab, right-click Event Handlers and select Add EventHandler.
The new event handler is displayed under Event Handlers.
- Right-click the new event handler and select Rename; then enter a new name for the event handler.
- Under EventHandler Operations, click the Add Operation button.
- Under Type, click in the field and then select FireOutport.
- Under Configure the operation, select your outport (ChangeHistoryOutport) and save your changes.
To ensure that the user can open the embedded component by clicking the Changes tab, associate the new event handler with the OnClick event.
a. Click the Properties tab.
b. On the Designer tab, click the Changes tab and then click the Properties tab again.
c. On the Properties tab, under Events OnClick, select the event handler you created and then save your changes.
Specify the configuration parameters
- Select the embedded component and click the Properties tab.
- Under Parameters, specify the following parameters by clicking the arrow to the right of each field:
- Save and activate the floorplan.
Activate your business configuration, right-click the solution and select Deploy Business Configuration.
The system deploys the business configuration content you created and makes the field values available in the development environment.
- Log on to the cloud solution as a business user and assign the work center that has the same name as
your business object to your service agent.
- Navigate to the work center you created and click Edit.
- Enter data in one or more of the fields and save your changes.
- On the right of the screen, click View All.
- Select Close and Refresh.
Your changes are displayed on the Changes tab.
In the next article, we will learn how to access this change history via absl script with the suitable example.
If you like to add some points to this article, kindly leave your points as comments. Don’t forget to subscribe it.
Reference: © 2017 SAP SE. All rights reserved.