Technical Articles
SAP S/4HANA Cloud :Unboxing Custom Business Object
In continuation to my earlier Blog post “S/4HANA Cloud: In-App Extensibility Starting Point”; where I talked about the three key apps that can be used to find all the In-app Extensibility information for the SAP S/4HANA Cloud . In this; I will be talking about some of key learnings /observations while working on Custom Business Objects in S/4HANA Cloud 2002 edition. Coming from ECC mindset where we have custom tables; the first question that comes to your mind is can we create something like custom tables in S/4HANA Cloud? We might have some requirements where you want to store data or while performing certain actions you need to refer to values in data base; then you can use Custom Business Object (CBO) in SAP S/4HANA Cloud.
Thanks to wonderful series on Custom Business Object by Rohit Khan ; I referred to that as the starting point while working on Custom Business Objects .
In layman language CBO can met your requirement of creating custom table in SAP S/4HANA Cloud version. CBO is available in both On Premise and cloud versions of SAP S/4HANA; with more features available in S/4HANA Cloud.
SAP S/4HANA On premise version doesn’t have UI Generation and Data Management features .So you need to create side by side extensibility application in On Premise system for Data entry in CBO .Whereas with UI Generation feature in Cloud you can create a tile over CBO using app “Custom Catalog Extension” fiori app .
Let’s have a look at some of key points while using Custom Business Object
- F4 help for field in Custom Business Object : Well we cannot have any standard F4 help like we have in On Premise version for custom fields in custom table. There are only 2 options available currently for F4 help in CBO field
Association to Business Object :You can associate the F4 help with the field of any other CBO; but then you cannot have that field as key field if for the CBO Can be Associated checkbox is checked.
Code list: Using this option; you can define fixed list of values like Value Range of custom table. Use Fiori app “Custom Reusable Elements”. You can also maintain the translations for those values in the same app.
- Custom Tile to Create and Display CBO Data:When you create a custom tile over CBO using Fiori app “Custom Catalog Extension”; you can only assign it to standard Business Catalogs available. Currently there is no provision available to assign Custom Catalog. This is under consideration at https://influence.sap.com/sap/ino/#idea/233370
- Read Access to CBO Data: In case Data Access Management checkbox is checked in CBO features – You can give read access to Business users and auditors for the CBO. If you checkmark this option, UI Generation, Service Generation and Change Documents will be check-marked automatically as they are required for the process. When you publish the CBO; system generates an additional app “Custom Business Object Audit App” which has the UI of custom business object in read-only mode.In Custom catalog extension you will find the app with _SCBA name
- Data load in Custom Business Object :You can create single record using Fiori tile of CBO; but in case you need to mass upload the data in CBO then you need to use Side by Side Extensibility and call the CBO Odata for mass upload.But for this you will also need Communication Arrangement set up having Inbound Communication.
- For single record; you can use Sap_upsert function as well. And for example to do mass data load from POSTMAN tool I can use batch operation. But you need to get the x-csrf-token first using GET request
- Use the Batch operation; and in header you need to mention the x-csrf-token and Content-type as multipart/mixed;boundary=batch_mybatchIn the body -> raw; add the below code and execute the POST operation with Batch
https://xxxxxx-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_BONUSPLAN_CDS/YY1_BONUSPLAN/$batch
—batch_mybatch
Content-Type: multipart/mixed; boundary=changeset_mychangeset1
–changeset_mychangeset1
Content-Type: application/http
Content-Transfer-Encoding: binary
POST YY1_BONUSPLAN HTTP/1.1
Content-Type: application/json
{
“Id” : “1”,
“SAP_Description” : “Testing record1”,
“TargetAmount_V” : “100” ,
“EmployeeID” : “1100”,
“EmployeeName” : “Dinesh”
}
changeset_mychangeset1
Content-Type: application/http
Content-Transfer-Encoding: binary
POST YY1_BONUSPLAN HTTP/1.1
Content-Type: application/json
{
“Id” : “2”,
“SAP_Description” : “Testing Record 2”,
“TargetAmount_V” : “100” ,
“EmployeeID” : “1101”,
“EmployeeName” : “Preeti”
}
–changeset_mychangeset1–
–batch_mybatch—
5. Data download of CBO :Currently there is no data download feature available in CBO tile; you need to build SBS extensibility in case you need download of data.
7. Translations :You can also maintain the translations for field labels of CBO using Custom Business Object app only. There is translation option and on clicking on it you can choose the language and maintain the translations for that language.
8. Testing of Custom Business Object logic :Well you can test the logic inside CBO using TEST Option given inside the Custom logic. Once you have written the code; fill in the parameters and call the TEST option to validate if output is correct or not.
Also we observed that neither we can have option to display the values of CBO as drop down nor we can have option to select multiple values for same field .Same would hold true for in case you add any custom field using “Custom field and Logic” fiori app .
Summary: In this we talked about some of key features and options that are available with CBO for developers to use. In next blog post we will see how to call REST API inside CBO , refer SAP S/4HANA Cloud: Unboxing Custom Business Object Continued: Calling REST API inside logic
Regards
Taranam
Thanks for the Great Blog Taranam.
Can we do a batch operation from CBO to Update other CBO ? As per your Blog I was able to post data via Postman, but when trying to build the Payload from CBO and do POST call, I am getting error due to payload.
Can you help me to build payload for CBO Action ( After Modification ).
Thanks,
-Pravin Kumar
hi Pravin
Thanks for going through the same .No we cannot use Batch operation inside S/4HANA Cloud logic – you can use the same via middle ware / when using Side by Side application . Can you please elaborate on what you intend to do so that I can tell you if its achievable . Do you need to update B CBO from CBO A based on event ?
Regards
Taranam
Well explained .
hi Taranam ,
Key fields of CBO are also editable ; how can I control it ?
hi Rajveer
Unfortunately we cannot control it .Otherwise you can create Custom UI on your CBO and dont have the key field in that
Regards
Taranam
Hi Tara,
In a nutshell, If I use S/4 Hana Cloud Essentials and want to integrate S/4 data into a cloud data lake, do I use the CDS Views with API services in SCP (Api mangment or CPI)?
hi Kenny
You can create CDS Views as External API type and use the same .
Regards
Taranam