Skip to Content

Extend Form Template using SAP S/4 HANA Cloud In-App Extensibility

In this blog, we will see how a standard form template can be extended for Custom Fields. We will also see how an HTTP Call can be made from Custom Logic. The HTTP call will be made to read data from a whitelisted API which reads the Characteristic Value of a Product.

In this business scenario, the Standard Form Template of Purchase Order needs to be extended with the value of the Characteristic Value assigned to a material. In this example, we assume that this requirement is needed only for Class Type ‘001’ and this can have only one characteristic value.

To achieve this, we do the following steps as depicted below.


Step 1: Create a Custom Field

  1. Login to SAP S/4 HANA Cloud with user having role SAP_BR_ADMINISTRATOR.
  2. Create a Custom Field using the app Custom Fields and Logic under the catalog Extensibility.
  3. Enable the following usages and Save and Publish.
    • UIs and Reports: Manage Purchase Order
    • Form Templates: Form Template Purchase Order


Step 2: Add this Custom Field in a Form Template


Form Templates are modified using Adobe LiveCycle Designer. The software can be downloaded from the app Install Additional Software under the catalog Additional Software.

Once the software is installed, do the following steps.

  1. Continue with the user having role SAP_BR_ADMINISTRATOR. Choose the app Maintain Form Templates under the catalog Output Management.
  2. Download the SAP pre-delivered form template MM_PUR_PURCHASE_ORDER. The file gets downloaded as a zip file. Extract the files to a folder.
  3. Open the file xdp using Adobe LiveCycle Designer. Add a Column “Characteristic” between the columns Description and Quantity. The field should be binded to custom field YY1_CHARCVALUE_PDI.
  4. This Custom Form Template needs to be uploaded. Use the app Maintain Form Templates under the catalog Output Management to do this.


Step 3: Enable the usage of Custom Form Template using Output Determination

  1. Login to SAP S/4 HANA Cloud with user having role SAP_BR_BPC_EXPERT.
  2. Choose the app Manage Your Solution under the catalog Implementation Cockpit.
  3. Choose Configure Your Solution and Search with keywords Form Template.
  1. Navigate to the details of Output Control. Under the Configuration Steps, choose Configure under Assign Form Templates.
  1. Create a new assignment for Purchase Order.

  1. Login with user having role SAP_BR_ADMINISTRATOR.
  2. Choose the app Output Parameter Determination under the catalog Output Control.
  3. Choose the following parameters and Click Edit.
  • Show Rule For: Purchase Order
  • Determination Step: Form Template
  1. Change the value of Form Template to YY1_MOD_PURCHASE_ORDER_01.


Step 4: Create Communication Arrangements to enable HTTP Call

  1. Login with the user having role SAP_BR_ADMINISTRATOR.
  2. Create a Communication User using the app Maintain Communication Users under the catalog Communication Management. In this example we create a user named HTTP_USER.
  1. Create a Communication System using the app Communication Systems under the catalog Communication Management with following details.


System Name: INT_HTTP

  • Enter the following details for the Communication System and click Save.

Host Name: (Replace XXXXXX with your tenant URL)

HTTPS Port: 443

User for Inbound Communication: HTTP_USER

User for Outbound Communication: HTTP_USER

  1. Create a Custom Communication Scenario using the app Custom Communication Scenarios under the catalog Extensibility.
  • Create a new Communication Scenario with the following details.

Communication Scenario ID: YY1_INT_HTTP

Description: Internal HTTP

  • Create an Outbound Service with the following details.

Description: INT_HTTP

Outbound Service ID: YY1_INT_HTTP_REST

URL Path: /sap/opu/odata/sap

  1. Create Communication Arrangement using the app Communication Arrangements under the catalog Communication Management.
  • Click New, enter the following details and click Create.

Scenario: YY1_INT_HTTP

Arrangement Name: YY1_INT_HTTP

  • In the details page, enter the details shown below and click Save.


  • Repeat Step 5 for Communication Scenario SAP_COM_0309. The Inbound User will be HTTP_USER.


Step 5: Custom Logic to make HTTP Call and Pre-Populate the Custom Field

In this section, we make an HTTP call to a whitelisted API in order to read characteristic value of the Product and populate the custom field created in Step 1.

  1. Login with user having role SAP_BR_ADMINISTRATOR.
  2. Choose the app Custom Fields and Logic under the catalog Extensibility.
  3. Choose the tab Custom Logic. Click +, enter the following details and click Create.
  1. Click on Create Draft and paste the following lines of code.
CHECK cl_ble_http_client=>is_service_available(
    communication_scenario = 'YY1_INT_HTTP'
    outbound_service       = 'YY1_INT_HTTP_REST'
) = abap_true.

DATA(lo_client) = cl_ble_http_client=>create(
    communication_scenario = 'YY1_INT_HTTP'
    outbound_service       = 'YY1_INT_HTTP_REST'

DATA(request) = cl_ble_http_request=>create( ).
DATA lv_q1 TYPE string VALUE '/API_CLFN_PRODUCT_SRV/A_ProductCharcValue?$filter=Product eq '.
DATA lv_q2 TYPE string VALUE ' and ClassType eq ''001'''.
DATA lv_material TYPE string.

CONCATENATE lv_q1 '''' purchaseorderitem-material '''' lv_q2 INTO lv_material.

request->set_method( 'GET' )->set_resource_extension( lv_material ).

    DATA(response) = lo_client->send( request ).
    DATA(lv_string) = response->get_body( ).
    SPLIT lv_string at 'CharcValue>' INTO lv_q1 lv_q2.
    SPLIT lv_q2 at '<' INTO purchaseorderitemchange-yy1_charcvalue_pdi lv_q1.
CATCH cx_ble_http_exception INTO DATA(lx).
  1. Click Save Draft and Publish.

This code can be replaced by SELECT statements to whitelisted CDS views which can read the characteristic value of a Material once it is available. The whitelisted CDS view is planned for 1805 release. 

Test the Scenario

  1. Login with user having role SAP_BR_PURCHASER.
  2. Choose the app Manage Purchase Orders under the catalog Purchase Order Processing.
  3. Create a new Purchase Order. In the PO line items include materials which have classification maintained as well as which do not have maintained.
  4. View the preview file in Output Management tab. The Custom Field Characteristic can be seen in the output.
You must be Logged on to comment or reply to a post.

    Hi Arun,

    Very informative on extensibility. Quick question on the logic extension, because this is cloud and customers wouldn't have access to ABAP stack, how do u think customers should approach to identify what class APIs to use. In your example, how did you arrive at using cl_ble_http_client.

    I thought there should have been a cloud plus simplification approach to invoking APIs and mapping the API call results to the extended elements wherever required.



    • Hello Sitakant,

      Well the number of utility classes pre delivered by SAP are quite limited for ABAP for Key users in Cloud. The only way currently to get the classes and methods is by using Keyboard Shortcut (Ctrl + Space). 

      Also currently there is no specific Utility Method which can invoke an API and map the results to a desired resultset.

      In the future release we have a functionality planned call "Reuse Functions" which will help you to write utility classes and reuse it in multiple places. So you would ideally write such a logic in your utility class and call it from Custom Logics or Custom Business Objects.



  • Hi Arun,

    Thanks for your Blog, I could get this work without any issue.

    Arun, I have a question, To access the ODATA service how do we provide the user credentials of the communication user in the BADI? Can you elaborate on the authentication part and how should we code this in the BADI.




    • Hello Guru,

      The authentication used in this case is Basic Authentication. That's why we use Communication User here with ID and password. You do not have to write any specific code in the BAdI for authentication. This is taken care in your Communication Arrangement. See Step 4, points 3,4 and 5. Here you can see that the Outbound Communication user is HTTP_USER which has the same credentials as Inbound Communication User for scenario SAP_COM_0309.



      • Hi Arun,

        Thanks for your Time and explanation 🙂

        I have implemented above solution in the Starter System and it worked perfectly fine for some data from Business Partner ODATA service. I implemented exactly the same thing in Test System, when I test in the Web BADI editor it fails with exception "HTTP Client - Communication error", not sure what's the issue, Can you please advise what could be the issue? However when I test it on the Rest client in Chrome I am able to access the service without any issue.

        With Kind Regards




  • Hi Arun,



    We are facing issue while adding Custom Logic.

    We have same kind of requirement but for Billing Document Item.

    We have followed all your steps and copied the custom logic code and made some changes in the code as per our requirement but while testing it throws error saying "HTTP client - communication error" at line - DATA(response) = lo_client->send( request ).


    Can you please help.


    Kind Regards,


  • Hello Arun, I’m stucked in the search of the precise Business Context.

    My scenario is totally the opposite from yours. I have the form (FIN_FO_CORR_OPI_LIST), and I need to add the field ‘AccountingDocumentHeaderText’ from the api: API_OPLACCTGDOCITEMCUBE_SRV.

    I tried to add custom fields in different Business Contexts, but I’m not able to see which is the one related to my form with the aim of activate it with ‘Enable the usage’.

    Any hints on how to look for it?

    Kind Regards,

    • Hello Daniel,

      Please check if your service is extensible in the first place. I am not very sure that the Open Item List form service is extensible.



  • Hello Arun,

    Thanks for the nice Blog.

    Can you please check the below link and help me


  • Hello Arun,

    is it possible to create new Form Templates (using Adobe Livecycle Designer for example) for custom business object in S/4HANA Cloud?

    Could you please redirect me on the right information source?





  • Hi Arun

    thanks for sharing the information via blog, its helpful a lot.

    Here I have to customize the standard  form template for the business scenario create correspondence app  in hana cloud, for that we are unable to find the business context for developing the custom logic through Badi implementation. Could you please suggest which business scenario we have to use?


    Sathya eathakota





    • Hello Sathya,


      Did you get the business context for "Create correspondence " form?


      we have the similar requirement , do the needful if you have got some solution on this



      Raju Mammula