SAP S/4HANA Cloud Key User Extensibility – Create Custom Business Object – Part 3
|25-Jan-2022||Updated content as per latest updates|
|10-Aug-2021||Updated latest screenshots and content|
|03-Jun-2020||Updated latest screenshots and content|
|17-Jan-2019||Updated latest content|
Target Audience – Key Users of SAP S/4HANA Cloud, On-Premise and Developers
In this part of the blog series, we will now see how to create a simple custom business object step-by-step. We will start from where we left on Part 2 of this blog series. If you have directly landed on this blog, please look at the Part 1 and Part 2 of this series. Please note that you should have the pre-requisites already in place as discussed in the part 1 of this blog series.
Let’s go through the steps and see how to create a custom business object –
Log on to you SAP S/4HANA system. Once logged in you will arrive at your home page (Fiori Launchpad). Look for the tile ‘Custom Business Objects’. Normally, it should be under the group ‘Extensibility’. If no, then you can search for the app as explained in the previous part of this blog series.
Click on the tile. If you recollect in part 2 of this blog series, we have started with an example of the following custom business object. Since we have already created custom code list in the Part 2 of this blog series, let us start with creation of custom business object based on the following table –
|Root Node (Supplier)||Fields||Length / Data Type||Custom Code List|
|Supplier ID||20 / Char||No|
|Supplier First Name||30 / Char||No|
|Supplier Last Name||30 / Char||No|
|Supplier Account Group||4 / Char||Yes|
|Supplier Country||20 /Char||No|
|Sub-Node (Role)||Supplier Role||10 / Char||Yes|
|Role Valid From||Date||No|
|Role Valid To||Date||No|
Once you are inside the custom business object editor, click on – New
Next provide the name of the custom business object.
Note – Other fields like Identifier and Name in Plural will be filled automatically.
If you want to change them, you can still do that. Provide the name and click on ‘Create’.
Under General Information, you fill find different checkboxes. By default, all of them will be ‘Unchecked’. You can decide which ones to select based on your business scenario and requirement. Remember we have already discussed about these in Part 1 of this blog series. For this blog, we will select all the options.
Note – In SAP S/4HANA On-Premise system, you will find less options under Features. As of SAP S/4HANA 2021, it is something like below. Of course, this is subject to change with new releases. Therefore, always refer to the latest documentation.
Next, click on the tab – Nodes. By default, system would have created the parent node based on the name of the CBO
You can also see, by default system has selected three options – Create, Update, Delete. This is mainly to control the access right to the node.
Let’s create the fields for parent node – Supplier as mentioned in the table above. Click on – New. Let’s add first field – Supplier ID, with field type – Text and length equal to 20. Remember to make this a key field
In the similar fashion add other fields.
Let’s focus on the field – Supplier Account Group. If you remember, for this field, we created a Custom Code List. Now, we will bind it to this field.
After you have entered the details for this field, choose the type as – Code List from the list.
Under the properties pane, now you can choose the previously created code list.
Search for the code list you created previously and select.
It should be added now.
In the similar fashion continue to add other fields. Click on Save Draft before you can add further nodes to the CBO.
Next, we can add the sub-node – Role.
Next, Click on Nodes tab again and click on New to add a new sub-node – Role
Add the name as – Role and click back on the Fields tab to add new fields.
Choose the tab – Fields. Here we will create the fields for the sub-node. In the Fields tab, select the node – Role and create the fields in the similar fashion as we created above. Remember to attach the code list for the field – Supplier Role. Also, for two other field, Valid From and Valid To, you need to pick the field type as – Date
At this point, click on Save and then Publish.
You can now click on the tab – Log and see all the backend artifacts like CDS View, OData etc., is generated automatically by the system.
Once published, the text Published in green will appear. As you notice from log, the system created the CDS views, OData, and other artifacts automatically in the backend.
This completes the steps on how to create a new custom business object in SAP S/4HANA. In the next blog, we will see how to maintain the entries for this custom business object by using the generated UI. We will also create a new tile for this application and host it in the users Fiori Launchpad.
Congratulations you have successfully created a new custom business object in SAP S/4HAHA Cloud!
Rohit Khan, S/4HANA Regional Implementation Group
Let’s stay connected – Rohit on LinkedIn
To keep yourself updated with latest on extensibility, follow this SAP Community Page – ABAP Extensibility
Click below for the Part 4 this blog series.
Part 1: Introduction to Custom Business Objects
Part 2: Create a Custom Code List for a Custom Business Object
Part 3: Create a new Custom Business Object
Part 4: Create a custom UI and maintain data in Custom Business Object
Thanks for this interesting blog. Is it possible to define another custom/standard business object as F4 instead of fixed values ?
Thanks for visiting the blog.
This feature would come in the next release of SAP S/4HANA Cloud.
Hi Rohit Khan ,
I understand associations can be used for Custom fields.But is there any way we can achieve the same for standard fields in on-Premise?
Hello Vijaya Simha Chintarlapalli Reddy
Can you please clarify a bit more your requirement?
Also, would request you to post the question under the following tags and it will also help the community.
SAP S/4HANA Cloud
On my system, the checkbox "generate UI" is not visibile. Do you have an idea what could be the cause ?
This option is only available for SAP S/4HANA Cloud and not for SAP S/4HANA (OP) at present.
Nice blogs with details and simple steps to follow. Good work!
I am new to this and your blogs helped me a lot.
Now that I have a custom business object created, added some records and published.
How we can call this custom business object with values into standard cloud apps as part of in app extensiblity?
Thanks for visiting the blog and glad that it helped you.
Could you give me an example of what you are actually trying to achieve? This would help me reply better 🙂
Much appreciated Rohit for your reply.
I was looking at using the custom business object say "Sold-To-Party-Address" into one of the standard app Sales Order Fulfillment. So that, I will get address information displayed in the standard app.
Yes you can do that. You will have to -
For the statements refer to the following link -
Hope that clarifies your query.
Thank you very much.
Will try and get back to you.
Hi Rohit Khan,
Thanks for your Blog.
Can you please let me know the steps how to Update the custom business objects data in the "Custom logic" app extensibility in the business context Sales Document Item Modifications.
As of now, you cannot use update/modify/insert statement for DB tables in SAP S/4HANA Cloud. Also these statements are not allowed in the 'Custom Fields and Logic App". For more details you can check the below link -
Thanks for the Reply.
We are trying to update the CBO in S/4cloud 1805 version with the below code but system is not allowing in the Custom logic app available in the Extensibility catalog.
Can you please share the error you are getting and also explain what you are trying to achieve?
Thanks for the reply.
We are trying to update the Custom Business object data from the BADI - Sales document item modifications in the custom fields and logic app.
Requirement:While creating the Sales order we are fetching the software key from the Custom business object based on few conditions once we got the key from the BO then we have to updated to update the sales order against the key tin the BO.
Hope you understood the requirement.
I understood your requirement. Please share with me the code you are trying to write. Also share the error. Better if you can give the screenshot.
Thanks for the reply.
Please find the below code we are trying in BADI level to update custom Business object.
Attached is the error while writing the logic in BADI.
DATA lv_key TYPE yy1_skey_orders.
DATA lv_timestamp TYPE timestamp.
lv_key = salesdocument-soldtoparty.
DATA(lo_orders) = write->get_root(
business_object_id = 'YY1_SKEY_ORDERS'
key = lv_key
GET TIME STAMP FIELD lv_timestamp.
CONVERT TIME STAMP lv_timestamp TIME ZONE cl_abap_context_info=>get_user_time_zone( ) INTO DATE DATA(lv_date).
DATA(ls_order) = VALUE YY1_SKEY_ORDERS(
id = lv_key
order = '1234'
lo_orders = write->create_root(
business_object_id = 'YY1_SKEY_ORDERS'
data = LV_order
Thanks for sharing the code and I was thinking on the same lines that you may have chosen a keyword that is not supported. Please note that ABAP web editor only supports key-words that are defined here .
Thanks for the reply.
If possible can you please share one example code how to update the CBO data from the sales document BADI.
Thanks in Advance.
Unfortunately, at present, update is not possible from within Custom Logic App. Please refer the link I shared above that shows supported operations in the web editor of the custom logic app.
Thanks for the reply.
Is there any alternate solution to call the Custom Business object actions from the BADI instance to update the fields available in the CBO.
Below is one of the blog we are referring to meet the requirement.
Thanks in Advance.
In case there is a supported statement in the link I shared above, you can do that, else, for now, it is not supported.
Tell me what am I doing wrong.
I can create a new BO entry, but I can't update it. What should I specify for the "key" parameter?
Key should be the variable of type cbo name.
Pls check this link that showcases sample code when managing CBOs.
Hope this helps!
Thanks a lot for the great blog ! But how can we transport the entries from development to production environment does SAP provide some app to capture entries into a transport
Thanks Vijaya Simha Chintarlapalli Reddy . Glad you liked the blog.
For transport, SAP provides apps - Export / Import software Collection.
Please refer the links here for more details-
Export Software Collection
Import Software Collection
PS. If you have more questions would request you to kindly post them on the SAP Community SAP S/4HANA Cloud Tag. This would help the community as well. 🙂
Hello @Rohit Khan,
Thanks for your answer its useful I have already raised the post:
I am trying to implement it in On-Premise unfortunately its only available in Cloud How to go ahead on On-Prem ?
Hi Vijaya Simha Chintarlapalli Reddy ,
I have replied to you in the community page. (link here)
Hi Rohit Khan
Thanks for writing up such a useful blog!! thanks for sharing across.
The database table that is getting created behind business object, it is giving out some random name. can we give the custom name according to the user's need?
At present, it is controlled by the framework.
Thank you for the blog. I need a combination of fields to be the key in the Custom Business Object. Is there a way to achieve it?
I am trying this in the OP 1809 version. If the answer is no, I would like to understand if there is way to do it in the subsequent version (2020).
Can you please ask this question under this tag (ABAP Extensibility | SAP | SAP Blogs) with the screenshot? Let me know once done.
It would be helpful for others as well.
Multiple keys are supported, however, would like to see the screenshot.
I have asked the question with the suggested tags. I have provided the screenshots.
Please find the link: https://answers.sap.com/questions/13204938/multiple-key-fields-in-custom-business-objects.html