Skip to Content
Technical Articles
Author's profile photo Denys van Kempen

Integrating the ABAP Environment with SAP S/4HANA Cloud | Hands-on Video Tutorials

Integrate the ABAP environment of the SAP Business Technology Platform with SAP S/4HANA Cloud in a few clicks and some oldskool copy ‘n paste.

In this blog post you will find the tutorial video embedded with references and additional information.

For the related blog posts, visit

Questions? Please post as comment.

Useful? Give us a like and share on social media.

Thanks!

/wp-content/uploads/2016/02/sapnwabline_885687.png

Hands-On Video Tutorials

What You Will Learn

In the video we cover how to prepare the SAP S/4HANA Cloud tenant to accept connections from the SAP Business Technology Platform (BTP) ABAP environment using OAuth, how to configure a destination in your BTP subaccount pointing to SAP S/4HANA Cloud, and what objects you need to create and code to write to make the API calls.

Ingredients

To follow along, you’ll need

  • SAP S/4HANA Cloud tenant with an account privileged to create a communication arrangement (SAP_CORE_BC_COM)
  • SAP BTP ABAP Environment with an account authorized to create destinations
  • ABAP Development Tools (ADT)

Code Sample

For the code sample used in this tutorial and a step-by-step description of the ABAP development activities, visit the SAP Development Center

/wp-content/uploads/2016/02/sapnwabline_885687.png

Integrating the ABAP Environment with SAP S/4HANA Cloud

In this short video tutorial, we cover the concepts, configure the communication arrangement, the destination, and showcase the code sample.

0:00 – Introduction and documentation

3:00 – Download Trust from SAP BTP Subaccount Destinations

4:00 – Create communication arrangement in SAP S/4HANA Cloud

4:40 – Upload signing certificate to the communication system

5:10 – Get URL of ABAP environment

5:45 – Create communication user for inbound communication

7:25 – Get hostname of inbound service URL (OData) and OAuth 2.0 details

8:00 – Create new destination for the SAP BTP subaccount

9:10 – Using ADT, create a service consumption model 

9:25 – Get API EDMX from SAP API Business Hub

10:00 – Create HTTP service

10:25 – Create business partner using API call

10:45 – Verification in SAP S/4HANA Cloud

/wp-content/uploads/2016/02/sapnwabline_885687.png

Scenario

Administration Activities

For this scenario, we need to create a communication arrangement with communication system and user on our SAP S/4HANA tenant. For the OAuth 2.0 trust, we need to update a signing key that we can download from our SAP BTP subaccount.

The illustration below shows the administration activities. Previously, it was required to create a service instance of the destination service, create a service key for this instance, and create a communication arrangement in the ABAP environment. This is no longer required and a destination defined at the subaccount suffices (not shown here).

To call the API, as developer, we need to create a service definition using the metadata from the SAP S/4HANA Cloud tenant (or the SAP API Business Hub, alternatively) and an HTTP Service with API handler.

The figure below shows the configuration of the OAUTH2SAMLBearerAssertion destination. Time of writing, the configuration requires the copy and paste of a number of settings from the communication arrangement of the SAP S/4HANA Cloud tenant, as documented

The figure below shows the generated service consumption model from the EDMX. The model is references in the HTTP service object.

The figure below shows the HTTP Service with the handler class (for the sample code see the tutorial) and URL.

The user calling the URL needs to the master data specialist business partner data role (BR_BUPA_MASTER_SPECIALIST).

/wp-content/uploads/2016/02/sapnwabline_885687.png

Additional Resources 

SAP Help Portal

For the documentation of the procedure, visit

For more information about communication arrangements, see

For more information about extending SAP S/4HANA Cloud, see

For more information about the Business Partner API, visit

SAP API Business Hub

To download the EDMX for the API and learn more about the different APIs and entities, see

/wp-content/uploads/2016/02/sapnwabline_885687.png

Share and Connect

Questions? Please post as comment.

Useful? Give us a like and share on social media.

Thanks!

If you would like to receive updates, connect with me on

For the author page of SAP PRESS, visit

Over the years, for the SAP HANA Academy, SAP’s Partner Innovation Lab, and à titre personnel, I have written a little over 300 posts here for the SAP Community. Some articles only reached a few readers. Others attracted quite a few more.

For your reading pleasure and convenience, here is a curated list of posts which somehow managed to pass the 10k-view mile stone and, as sign of current interest, still tickle the counters each month.

/wp-content/uploads/2016/02/sapnwabline_885687.png

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Piotr Tesny
      Piotr Tesny

      Hello Denys, Indeed, a very nice blog and videos. Thanks!

      Just a heads up. I happened to have published on the same topic very recently as well.

      In a nutshell the blog OAuth2SAMLBearerAssertion Flow with the SAP BTP Destination Service. S/4HANA Cloud. takes much less opinionated approach into the App2App integration with S4HC from anywhere (=Other) with the focus on user identity propagation via a user's identity OIDC mechanism (whether implemented with BTP's XSUAA service as IODC provider or not).

      This can become be very useful in cases the client application is loosely coupled with SAP BTP at all. Like a mobile application for instance.

      I still emphasise on BTP Destination service (the unsung hero so-to-speak) capabilities and qualities especially through the prism of its own REST API capabilities...

      kind regards

      Piotr

      PS. For curious readers: here goes the link to my OAuth2SAMLBearerAssertion series of blogs

      Author's profile photo Steve Curry
      Steve Curry

      Thanks, Denys.  I have been trying to do a deep create of Business Partner along with its child Customer, following Other Example Requests - SAP Help Portal.   Unfortunately, it raises an exception when I try to execute the create_data_descripton_node( )->set_properties and I can't find any error message in the exception:

       

      *&---------------------------------------------------------------------*
      *& Report z_test_post_deep
      *&---------------------------------------------------------------------*
      *&
      *&---------------------------------------------------------------------*
      REPORT z_test_post_deep.
      
      DATA:
        lt_selected_properties  TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path,
      
        lo_client_proxy         TYPE REF TO /iwbep/if_cp_client_proxy,
        lo_create_request       TYPE REF TO /iwbep/if_cp_request_create,
        lv_foo                  TYPE char1,
      
        lo_data_desc_node_root  TYPE REF TO /iwbep/if_cp_data_desc_node,
      
        ls_bp_data_req          TYPE a_businesspartner,
        ls_bp_data_resp         TYPE a_businesspartner,
      
        lt_property_path_root   TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path,
        lt_property_path_cust   TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path,
        lt_property_path_addr   TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path,
        lt_property_path_sarea  TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path,
        lt_property_path_company TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path.
      
      TRY.
      
          lt_property_path_root  = VALUE #(
                                             ( |BUSINESSPARTNER| )
                                             ( |BUSINESSPARTNERCATEGORY| )
                                             ( |BUSINESSPARTNERGROUPING| )
                                             ( |ORGANIZATIONBPNAME1| )
                                             ( |SEARCHTERM1| ) ).
      
      
      *       Create Proxy
          lo_client_proxy = /iwbep/cl_cp_client_proxy_fact=>create_v2_local_proxy( VALUE #( service_id      = 'API_BUSINESS_PARTNER'
                                                                                            service_version = '0001' ) ).
      *       Post
          lo_create_request = lo_client_proxy->create_resource_for_entity_set( 'A_BusinessPartner' )->create_request_for_create(  ).
      
      **********************************************************************
      ****
      **** Raises an exception when it attempts to execute the following statement ****
          lo_data_desc_node_root = lo_create_request->create_data_descripton_node( )->set_properties( lt_property_path_root ).
      
      ****
      **********************************************************************
      
          clear ls_bp_data_req.
      
          ls_bp_data_req = VALUE #(
                                          BusinessPartner         = '0000123402'
                                          BusinessPartnerCategory = '2'
                                          BusinessPartnerGrouping = 'Z001'
                                          OrganizationBPName1     = 'Prairie Ag Supply'
                                          SearchTerm1             =  'Prairie Ag'
                                           ).
      
          "Set deep business data
          lo_create_request->set_deep_business_data(
            EXPORTING
              is_business_data    = ls_bp_data_req
              io_data_description = lo_data_desc_node_root ).
      
      
          "Execute request and fetch response business data
          lo_create_request->execute( )->get_business_data( IMPORTING es_business_data = ls_bp_data_resp ).
      
          COMMIT WORK AND WAIT.
      
          lv_foo = 'X'.
      
        CATCH /iwbep/cx_gateway INTO DATA(lx_gateway).
          lv_foo = 'Y'.
        CATCH cx_root INTO DATA(lx_exception).
          lv_foo = 'W'.
      
        ENDTRY.

       

       

      Author's profile photo Denys van Kempen
      Denys van Kempen
      Blog Post Author

      Hi Steve,

      Don't see what's wrong 1-2-3- but no doubt someone on the community might.

      Would you mind posting your comment as question? <copy><paste>

      https://answers.sap.com

      Tag with ABAP Development

      Thanks!

      Author's profile photo Steve Curry
      Steve Curry

      Thanks, Denys.  I did post it in the community with the tag you suggested a day or so ago but so far no answers.  I did find in the debugger that there is code specifically checking for ‘local’ and deliberately raising an exception in that case.  (I am using the local OData Client Proxy.). So, I wonder if instead of trying to use a deep create, I can insert the Business Partner parent in a first call, and then insert its Customer child entity in a second call.  (I put that in the community as well.). Another alternative would be to use straight https without the OData Client Proxy, but I don’t know if that would work.

      Author's profile photo Steven Foo
      Steven Foo

      How do we connection BTP ABAP environment with SAP Cloud Integration (SAP CPI) ?

       

      Thank you.

      Author's profile photo Denys van Kempen
      Denys van Kempen
      Blog Post Author

      Hi Steven,

      Missed the notification. Apologies for the delays.

      We would need some more information about exactly what you are trying to achieve.

      Suggest to post the question to the SAP Community? The community is monitored 24/7 by the topic area experts both from SAP, its partners, and customers, which also allows for knowledge sharing. We monitor several tags and try to respond when and where we can.

      Thanks for contributing!

      https://answers.sap.com

      Author's profile photo Karanam Guru
      Karanam Guru

      Hello Denys,

      It’s a nice blog and I was able to post and read data from S/4HANA Cloud from the http service through a browser. However in Realtime I would like to call this service through SAP Cloud Integration.

      Can you please advise or guide me on how to connect SAP BTP ABAP environment http service with SAP Cloud Integration so that we can use it in the iFlow.

      With Kind Regards
      Guru

      Author's profile photo Denys van Kempen
      Denys van Kempen
      Blog Post Author

      Hi Guru, 

      Good question. Would you mind asking this question to the SAP Community? The community is monitored 24/7 by the topic area experts both from SAP, its partners, and customers, which also allows for knowledge sharing. We monitor several tags and try to respond when and where we can.

      Thanks for contributing!

      https://answers.sap.com