Skip to Content
Technical Articles
Author's profile photo Rohit Khan

SAP S/4HANA Cloud Key User Extensibility – Create Custom Business Object – Part 3

BLOG UPDATES IN PROGRESS!!

Updated: January 17 2019

SAP S/4HANA Cloud Key User Extensibility – Create Custom Business Object – Part 3

Target Audience – Key Users of SAP S/4HANA Cloud and Developers

Blog applicability – SAP S/4HANA Cloud 1702, SAP S/4HANA Cloud 1705 and SAP S/4HANA Cloud 1708, S/4HANA Cloud 1805 and onwards

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 Cloud 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.

 

Click on the tile and you would arrive inside the application. Inside, you would notice two tabs – Custom Business Objects and Custom Code Lists.

Custom Business Object – We will use this to create a new custom business object

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, now 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, choose the tab – Custom Business Objects and choose New next to the search box

Once you click on new, provide the name of the custom business object. Note that, other fields – 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.

Once inside, you have now the choice to choose different options provided by the system and you can choose the relevant checkbox accordingly. Remember we have already discussed about these in part 1 of this blog series. For this blog, we will select all the options.

Next, Click on the tab – Nodes and scroll down to the section – Structure and this is time when we would create the fields for parent node – Supplier. Click on the tab – Fields.

By default you would notice few administrative fields added by the system like – SAP_Description, SAP_CreatedDateTime, SAP_CreatedByUser and SAP_LastChangedByUser. These are created by system on its own and cannot be deleted. These fields will come only if you have chosen the two check boxes – Can be Associated and System Administrative Data.These were added since we selected the checkbox – System Administrative Data in the previous step

Now click on the option – New to add new fields to the CBO.

Next we will add the Supplier Account Group. But for this the type we will choose is ‘Code List’ that we created previously

From

Now from the properties pane on the right, pick up the code list that you created on the previously in the blog 2 of this series

Supplier Country –

Next click on the tab – Nodes again and we will add a new Sub-Node – Role to the CBO. Click on New to create a new Sub-Node.

Enter the name as Role. The other fields will be populated automatically

Now click the tab – Fields again and in this step we will add the fields for the Sub-Node – Role. Create the new fields one by one.

Supplier Role – Remember this field type is code list that we created in part 2 of this blog series. We will use the same as we want to provide fixed values as F4 to the user for this field.

Enter the field name and choose type as – Code List and then provide the code list from the properties pane from the right side

Similarly add the other fields keeping in mid their types as per table above

 

Once you are back in the Edit Custom Business Object screen, click on Publish button to publish and activate the new custom business object. At this moment, it will go through certain changes and the system will create certain artifacts in the background which you can see by switching on to the Log tab.

List of artifacts created in the background 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 Cloud system. In the next blog, we will see how 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

 

 

To access the previous blogs, choose the following links

  1. Part 1 – SAP S/4HANA Cloud Key User Extensibility – Introduction to Custom Business Objects – Part 1
  2. Part 2 – SAP S/4HANA Cloud Key User Extensibility – Custom business object – Creating Code List Values – Part 2

To access the next blog – part 4 of this series, choose below link –

Part 4 – SAP S/4HANA Cloud Key User Extensibility – Maintain data in Custom Business Object – Part 4

 

 

 

 

 

 

 

 

 

Assigned Tags

      32 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Louis-Arnaud BOUQUIN
      Louis-Arnaud BOUQUIN

      Hello Rohit,

       

      Thanks for this interesting blog. Is it possible to define another custom/standard business object as F4 instead of fixed values ?

       

      Thank you

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hello Louis,

      Thanks for visiting the blog.

      This feature would come in the next release of SAP S/4HANA Cloud.

      Regards

      Rohit

      Author's profile photo Vijaya Simha Chintarlapalli Reddy
      Vijaya Simha Chintarlapalli Reddy

      Hi Rohit Khan ,

      Nice blog.

      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?

      Thanks,

      Vijay

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      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.

      ABAP Extensibility

      SAP S/4HANA

      SAP S/4HANA Cloud

      Cheers

      Rohit

      Author's profile photo Jeroen Marijnissen
      Jeroen Marijnissen

      On my system, the checkbox "generate UI"  is not visibile. Do you have an idea what could be the cause ?

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

       

      Hello Jeroen,

      This option is only available for SAP S/4HANA Cloud and not for SAP S/4HANA (OP) at present.

      Regards

      Rohit

      Author's profile photo Praveen Varriam
      Praveen Varriam

      Hi Rohit,

      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!

      Praveen

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi Praveen,

       

      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 🙂

      Regards

      Rohit

      Author's profile photo Praveen Varriam
      Praveen Varriam

      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.

      Regards,

      Praveen.

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi Praveen,

      Yes you can do that. You will have to -

      1. Create a CBO and fill in your values
      2. Find out the Business Context for Standard Sales Order Fulfillment App, and then use the Custom Fields and Logic app to write your logic to say, verify the Sold-To-Party with the values in CBO. You will have to write a simple select.

      For the statements refer to the following link -

      https://help.sap.com/viewer/f544846954f24b9183eddadcc41bdc3b/1711%20500/en-US/dd39f11e977b41b49a5421399f4850f5.html

      Hope that clarifies your query.

      Regards

      Rohit

      Author's profile photo Praveen Varriam
      Praveen Varriam

      Hi Rohit,

      Thank you very much.

      Will try and get back to you.

       

      Regards,

      Praveen

      Author's profile photo parimi suryasairam
      parimi suryasairam

      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.

       

      Thanks!

      Sairam

       

       

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

       

      Hello Parimi,

      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 -

      https://help.sap.com/viewer/f544846954f24b9183eddadcc41bdc3b/1711%20500/en-US/dd39f11e977b41b49a5421399f4850f5.html

      Regards

      Rohit

      Author's profile photo parimi suryasairam
      parimi suryasairam

      Hi Rohit,

      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.

      TRY.
          lv_key = member-employee.
          DATA(lo_employee) = write->get_root(
            business_object_id = 'YY1_ZKEY'
            key                = lv_key
          ).
        CATCH cx_cbo_write_not_existing.
      endtry.
      
      Can you please help us how to resolve the issue in the S/4cloud version.
      
      Thanks in Advance.
      
      Thanks!
      Sairam
      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi Parimi,

      Can you please share the error you are getting and also explain what you are trying to achieve?

      Thanks

      Rohit

       

      Author's profile photo parimi suryasairam
      parimi suryasairam

      Hi Rohit,

      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.

       

      Thanks!

      Sairam

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

       

      Hi Sairam,

      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

      Rohit

      Author's profile photo parimi suryasairam
      parimi suryasairam

      Hi Rohit,

      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.

      TRY.
      lv_key = salesdocument-soldtoparty.
      DATA(lo_orders) = write->get_root(
      business_object_id = 'YY1_SKEY_ORDERS'
      key = lv_key
      ).
      CATCH cx_cbo_write_not_existing.
      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
      ).
      ENDTRY.

       

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi Sairam,

       

      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 .

      Regards

      Rohit

      Author's profile photo parimi suryasairam
      parimi suryasairam

      Hi Rohit,

      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.

      Thanks!

      Sairam

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hello Sairam,

      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.

      Regards

      Rohit

      Author's profile photo parimi suryasairam
      parimi suryasairam

      Hello Rohit,

      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.

      https://help.sap.com/viewer/f544846954f24b9183eddadcc41bdc3b/1805.500/en-US/ecabf405875b4f108739130db870fed6.html

       

      Thanks in Advance.

       

      Thanks!

      Sairam

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi Sairam,

      In case there is a supported statement in the link I shared above, you can do that, else, for now, it is not supported.

       

      Thanks

      Rohit

      Author's profile photo Vijaya Simha Chintarlapalli Reddy
      Vijaya Simha Chintarlapalli Reddy

      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

      vijay

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      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

       

      Regards

      Rohit

      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. 🙂

      Author's profile photo Vijaya Simha Chintarlapalli Reddy
      Vijaya Simha Chintarlapalli Reddy

      Hello @Rohit Khan,

      Thanks for your answer its useful I have already raised the post:

      https://answers.sap.com/questions/12653352/moving-the-objects-created-by-custom-business-obje.html

      I am trying to implement it in On-Premise unfortunately its only available in Cloud How to go ahead on On-Prem ?

      Thanks,

      Vijay.

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi Vijaya Simha Chintarlapalli Reddy ,

       

      I have replied to you in the community page. (link here)

       

      Cheers

      Rohit

      Author's profile photo Vishu Khandelwal
      Vishu Khandelwal

      Hi Rohit Khan

       

      Thanks for writing up such a useful blog!! thanks for sharing across.

      One doubt!

      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?

       

       

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi Vishu,

      At present, it is controlled by the framework.

      Best Regards

      Rohit

      Author's profile photo Sarish Numbialil
      Sarish Numbialil

      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).

      Thank you

      Sarish

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi Sarish,

       

      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.

      Regards

      Rohit

      Author's profile photo Sarish Numbialil
      Sarish Numbialil

      Hi Rohit,

      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

      Thank you,

      Sarish