This blog, the third in the S/4HANA cloud in-app extensibility series, intends to demonstrate the use of custom business objects in S/4 HANA Cloud. Custom business objects form an important part of the extensibility concept in S/4HANA cloud system. Being a “standard” system that S/4HANA cloud is, the customers don’t have access to the backend tables of the system where the data is stored. Quite often, due to specific and peculiar requirements of the customers, there is a need to store some additional data in the system than what the standard system and tables offer.
Some of this can be achieved by addition of custom fields on specific screens or forms (and others like email templates, APIs etc). However, there is often a requirement wherein it is needed for the customer to have a certain set of data which can be maintained in the system and retrieved from the system when needed.
Custom business objects help to serve this purpose. A custom business object can be imagined analogous to a custom table in a traditional ERP or an on-premise S/4HANA cloud system. As we will see in the subsequent sections in this blog, creating a custom business object opens up the possibility of storing additional custom data in the system and also the possibility to fetch this data from the S/4HANA Cloud system as need be.
In simple words, a custom business object is nothing but a database table
The customer needs to store a set of fields (Employee attributes) for their specific requirement in the system. They also need a screen from where they can maintain this data. Also, a possibility of fetching this data for an external application is required.
A custom business object needs to be created in the S/4HANA cloud system which will store the data that the customer needs. Once created, the custom business object will offer a screen to create new data and maintain the data stored in it. It will also have an API which will allow an external application to fetch data from it.
To be able to carry out in-app extensions, you must have one of the following roles assigned to your user in the S/4 HANA Cloud system:
1) Navigate to the “Custom Business objects” app in the S/4HANA cloud system. You can either search it from the search box or find this app under the “Extensibility” catalog.
2) Once in the app, click on the “New” button to create a new custom business object.
3) Provide the requisite information on the subsequent popup and click on “Create”.
4) The system will open up the new custom business object in edit mode.
5) On the General Information tab, there is a “Features” section which has some fields. These fields determine the different properties which the custom business object will have. These are explained below:
a. Determination and Validation – This is used to implement a logic which can be invoked when a custom business object entity is created/updated. This option is enabled only after the custom business object is published.
b. UI Generation – This generates a user interface for the custom business object.
c. Service Generation – Expose the generated user interface as an application to create, update or delete custom business object entities. This option, if checked, creates an OData API which can subsequently be used to perform operations on the custom business object from an external application.
d. Can be associated – This option enables the custom business object to be associated with other custom business objects for reuse. Reuse may include reference or value help purposes.
e. System Administrative data – This option adds the standard administrative fields like “Created on”, “Created by”, “Last changed on” and “Last changed by”
f. Change Documents – This option, if checked, tracks the changes which are made to the custom business object data through the UI. It records the fields which are changed/created.
g. Data Access Management – This option, if checked, provides the access to manage the data to business users and auditors. Once a custom business object is transported, this option cannot be reverted. This adds a field for “Lifecycle status” to the custom business object. This field can have possible values of “A” for Active or “C” for Completed. Completed records cannot be seen by business users but only by users (like auditors) with special additional authorizations. If this option is checked, the other options namely – UI generation, Service generation and Change documents are checked automatically.
6) For the purpose of this blog, check the options as shown in the screenshot below. Some of these will be explored in a subsequent blog and will be based on the same custom business object being demonstrated through this blog.
7) Navigate to the “Fields” tab to add fields to the custom business object. Because the “System administrative data” option was checked, the system automatically adds the relevant fields to the Custom Business Object.
Click on “New” to add a new field to the custom business object.
8) Add some fields as required to the custom business object. Make sure to add a key field. Make sure to rearrange the fields and ensure that the key field is the first field.
9) Navigate to the “Logic” tab. This tab allows to add some custom code logic while creating/updating data for the Custom business object. However, this can be done only after the custom business object is published. As a result, you will find that the logic implementation is not accessible yet as the object is not published.
10) At this stage, click on the “Publish” button to publish the custom business object. This will save the object and also create the database persistence (the relevant database tables will be created in the backend).
11) The system will take a few minutes to publish the custom business object. After it is done, the status on the top right will change to “Published”.
12) After the custom business object is published, navigate back to the “General information” tab. You will see that against the “UI Generation” feature, an additional option of “Maintain Catalogs” is available. Another one “Go to generated UI” is also available but not enabled as yet.
13) The “Maintain Catalogs” option allows you to choose the catalog to which your custom business object should be assigned. Click on this option and choose the “Extensibility” catalog. As a result, the newly created custom business object will be available under the “Extensibility” catalog. The generated UI for the custom business object will be available as a tile under this catalog.
Click on “Maintain Catalogs” and then click on “Add” on the subsequent screen.
14) On the subsequent popup, search for the “Extensibility” catalog and select it. Click on OK to proceed.
15) The system will add the custom business object to the Extensibility catalog.
16) Select the business catalog and click on “Publish”
17) Click “OK” on the subsequent popup to proceed.
18) Publishing might take a few minutes. Once done, the status of the catalog will become “Published”.
19) Now, once the catalog addition is also published, the custom business object should be available in the extensibility catalog. Open the Extensibility catalog from the S/4HANA cloud home page.
20) Click on the tile “Employee Attributes”. The generated UI for the custom business object will be displayed on the subsequent screen. Click on “Create” to create data in this custom business object. Doing so will open up the screen with the relevant fields that were added in the object.
Enter the data in the respective fields and click on Save.
21) Once saved, the saved data will be displayed on the CBO UI screen. More data values can be created in a similar way as mentioned above. Note that the administrative fields are automatically populated
This is how a custom business object is created and data is populated in it through the generated UI.We will see the use of this Custom business object for an application through the service generation in a subsequent blog.