Skip to Content
Technical Articles
Author's profile photo SAKRIYANAIK NK

End To End RFC Synchronous Interface with SAP CPI and Cloud Connector – Customer Purchase Order Update

Lets consider the below common business requirement which you see in all most all companies.

Customer place a purchase order and we do the integration to pick the customer PO and creates SO -Sales order in ECC through IDOC, PROXY, or RFC. Once Sales Order created in ECC corresponding Delivery or Advanced shipping notification will get created. Post Goods Issue will be done for creating the billing document and invoice creation.

Flow is as below.

Customer PO –> SAP Cloud API/ CPI –> SO creates in ECC/ S4/ HANA  –> ASN –> PGI –> Billing Document and Invoice Document.

Now Customer wants to know the Delivery Date, status of PO which created earlier. we build the RFC – End To End RFC Synchronous Interface with SAP CPI and Cloud Connector – Customer Purchase Order Update.


SAP ECC FM Code – for PO Update… create a FM as a remote enabled and the code in sourcecode tab.

FUNCTION zrfc_postatus.
*"*"Local Interface:
  TABLES: vbak,
  TYPES: BEGIN OF ty_vbak,
        vbeln TYPE vbak-vbeln,
        vdatu TYPE vbak-vdatu,
        kunnr TYPE vbak-kunnr,
        END OF ty_vbak.

  TYPES : BEGIN OF ty_final,
          mandt TYPE sy-mandt,
          kunnr TYPE vbak-kunnr,
          name TYPE kna1-name1,
          reqdevdate TYPE vbak-vdatu,
          END OF ty_final.

  DATA: wa_vbak TYPE ty_vbak,
        it_vbak TYPE STANDARD TABLE OF ty_vbak.
  DATA: l_gbstk TYPE vbuk-gbstk.

  SELECT vbeln vdatu kunnr FROM vbak INTO CORRESPONDING FIELDS OF TABLE it_vbak WHERE auart = 'ZOR'
                                                                                AND bstnk = v_bstnk .
  if sy-subrc NE 0.
    translate v_bstnk to LOWER CASE .
   SELECT vbeln vdatu kunnr FROM vbak INTO CORRESPONDING FIELDS OF TABLE it_vbak WHERE auart = 'ZOR'
                                                                                AND bstnk = v_bstnk .

  LOOP AT it_vbak INTO wa_vbak.

    kunnr = wa_vbak-kunnr.

    SELECT SINGLE name1 FROM kna1 INTO name WHERE kunnr = wa_vbak-kunnr .

    SELECT SINGLE gbstk FROM vbuk INTO l_gbstk WHERE vbeln = wa_vbak-vbeln.

    CASE l_gbstk.
      WHEN 'C' .
        status = 'Closed'.
      WHEN 'A' .
        status = 'Open'.
      WHEN 'B' .
        status = 'Partially Delivered'.
      WHEN ' ' .
        status = 'Cancelled'.
    reqdevdate = wa_vbak-vdatu.

    CLEAR wa_vbak.


Test the FM by giving PO number and FM returns, Customer number, Name and Status of PO, Delivery Date as mentioned below.

Now lets bring this FM to SAP Cloud connector – and complete the require configuration setup in cloud connector. Advantage of this is no need to work with Network team to open the firewall between Customer  ON PREMISE systems and External network customer application.


login into SAP Cloud connector on premise system where it is installed -and maintain the ECC server host name host entries and host file at OS level.


In the above screenshot protocol RFC -should be reachable – you need enter right details while creating the RFC connection with ABAP System and then add Function module with Exact Name.


Login into SAP CPI cockpit – and verify the RFC connection – or create new RFC connection in cockpit and check status is working or not. you can ref CPI document for setting up RFC connection.



The connection status should be successful – if not seek help from SAP BASIS Team!!


Now all communication is ready – and lets build the IFLOW in SAP Cloud CPI.



As i have selected my sender as SOAP because i want to trigger the input data from POSTMAN Tool. as this is very simple mapping which is one step for request and another is for response and in between we are calling RFC FM from back end systems via SAP Cloud connector.



Deploy the IFLOW and switch on Trace – to check the complete end to end log.



Select as POST method – maintain the require input data in body as below.

You can generate the code in all scripting languages – you can provide the external code as per the external application requirement -to build their Mobile/ tablet/browser apps.



all pipeline steps are executed – and we got the PO update in the response as below. i have also used groovy script for downloading payload  – you can ref document for groovy scripts.



you can also refer my another blog which is little complex for new technology – Integration approach.


Hope, This blog helps in your technical/project work!!


Best Regards,

Krushi Nenavath.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Eric Li
      Eric Li

      Hi Krushi,

      Thanks for you sharing. Very nice blog.

      I just follow the steps to test iflow --> rfc .  But i got exception " (106) JCO_ERROR_RESOURCE: Destination XXX does not exist" after i deploy the iflow.

      I set same destination in rfc adapter and SCP subaccount/destination.

      And both connection test in cloud connector and SCP are successfully executed.

      Do you have any suggestion about how to fix the error ?

      Thanks and Regards


      Author's profile photo SAKRIYANAIK NK
      Blog Post Author

      Hi Eric,

      Can you share the error screenshot and check the RFC Connection status in Cloud COCKPIT its working or not.




      Author's profile photo Avinash Varma Nadimpalli
      Avinash Varma Nadimpalli



      I have a requirement to connect to S4 HANA on cloud and update the data via RFC adapter.

      Below are few details which I am aware.

      1)Certificate exchange

      2)RFC destination creation in SAP BTP and configure them in RFC receiver adapter .


      What configurations required in this case apart from above points as we will not have Cloud connector here as this is S4 HANA on cloud.

      Are there anything that needs to be done. Please suggest.


      - Avinash