Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Participant
In this blog we will develop an BTP integration suite iflow which will retrieve booking information from a custom RFC FM and then send email about the booking info.  The aim of this blog is to showcase a common scenario we face about triggering integration when a new record is posted using RFC adapater.

To recap my earlier blogs I describe in detail on configuration steps to for CPI and onPrem SAP system which is a trial ABAP system



In part 3 I trigger IDOC creation on SAVE of Flight Booking

Part 3 

in Part 4 we use odata adapter to invoke the iflow on Save of flight Booking


In many use cases we already have RFC FM that can do the required job and we don't want to create odata service.  To cater of this use case we will show how we can use RFC adapter in BTP is used to  achieve the same result. ( send Booking confirmation email on SAVE in Tcode BC_GLOBAL_SBOOK_CREA.)

The following steps are required to achieve this.


  1. Custom RFC FM to fetch the SFLIGHT booking record.

  2. XML transform using Tcode XSLT_TOOL which will convert a custom type we created to match the input parameters of RFC FM..  This generates XML string that maps to the input parameters which are required in sending HTTP request to BTP iflow.

  3. Cloud Connector Settings for RFC

  4. BTP Destination for the RFC

  5. BTP Integration Suite iflow that has inbound XML to invoke the RFC using the RFC adapter and send email.

  6. Custom FM to call the BTP iflow using HTTP client

  7. Implicit enhancement in the include BC_GLOBAL_SBOOK_CREATEF01 in FORM SAVE routine.

  8. Check the end to end integration using TCODE BC_GLOBAL_SBOOK_CREA and email that you have received the booking confirmation record.                                                                     we will now describe the steps in complete detail.


  1. Custom RFC to get the booking                                                                                                        FUNCTION zget_flight_booking_data.
    *"*"Local Interface:
    *"----------------------------------------------------------------------DATAlv_date TYPE dats.
    input        i_fldate
    output       lv_date
    invalid_date 1
    OTHERS       2.

    IF sy-subrc 0.

    SELECT SINGLE FROM sbook INTO e_bookdata WHERE
    carrid =  i_carrid AND
    connid i_connid AND
    fldate lv_date AND
    bookid =  i_bookid.

  2. A) Create XML transform.  For this we create a custom structure as shown belowB) Tcode XSLT_TOOL   use the wizrd button and create a root node as shown below  C) change the source code so that we have the name space as shown below 3 Cloud connector settings should as shown below ( from cloud to onPremise) for the location id that points your BTP sub client instance.Now add the source to the FM created in Step 1 as shown below                                                Check the connection is working                                                                                                   4.  BTP create a destination in BTP->Connectivity=>destinations and create new destination as shown below                                                                                                                              check that the connection is working fine.                                                                                     5  BTP integration suite flow with http inbound invokes the RFC using RFC adapter via the destination created in the previous step and the booking confirmation email as shown below      HTTP sending settings as shown below, RFC and email settings are shown in the order below  NPLRFC is the destination that was created in the earlier step.   Email Adapter settings are as shown          Save and deploy the integration  and note the url                                                                         6  Custom FM to invoke the integration created in the previous step - The code is as show below FUNCTION zcall_cpi_rfcbookingconfirm.
    *"*"Local Interface:
    *"----------------------------------------------------------------------DATAlo_json        TYPE REF TO cl_clb_parse_json,
    lv_url         TYPE string,
    lo_rest_client TYPE REF TO cl_rest_http_client,
    lo_response    TYPE REF TO if_rest_entity,
    lo_request     TYPE REF TO if_rest_entity,
    lo_sql         TYPE REF TO cx_sy_open_sql_db,
    status         TYPE  string,
    reason         TYPE  string,
    response       TYPE  string,
    content_length TYPE  string,
    location       TYPE  string,
    content_type   TYPE  string,
    lv_status      TYPE  i,
    http_status    TYPE        string,
    lv_xml_string  TYPE xstring,
    lv_body        TYPE string,
    lv_newdate     TYPE char10.

    input  i_fldate
    output lv_newdate.

    DATAls_bookrec  TYPE zrfcboook.

    ls_bookrec-i_carrid  i_carrid.
    ls_bookrec-i_connid  i_connid.
    ls_bookrec-i_fldate lv_newdate.
    ls_bookrec-i_bookid i_bookid.


    url                i_mainurl
    client             DATA(lo_http_client)
    argument_not_found 1
    plugin_not_active  2
    internal_error     3
    OTHERS             ).

    CALL TRANSFORMATION  ztr_sbook_key
    SOURCE zget_flight_booking_data =  ls_bookrec
    RESULT XML lv_xml_string.

    CALL METHOD cl_abap_conv_in_ce=>create
    input lv_xml_string
    conv  DATA(lr_conv).

    data    lv_body ).

    lo_http_client->propertytype_logon_popup lo_http_client->co_disabled.

    CALL METHOD lo_http_client->authenticate
    username i_username
    password i_password.

    lo_http_client->request->set_methodif_http_request=>co_request_method_post ).

    CREATE OBJECT lo_rest_client
    io_http_client lo_http_client.
    lo_http_client->request->set_versionif_http_request=>co_protocol_version_1_0 ).

    IF lo_http_client IS BOUND AND lo_rest_client IS BOUND.
    lv_url i_exrurl.
    "lv_url = '/http/BookingConfirm'.
    request lo_http_client->request    " HTTP Framework (iHTTP) HTTP Request
    uri     lv_url

    lo_request lo_rest_client->if_rest_client~create_request_entity).
    lo_request->set_content_typeiv_media_type if_rest_media_type=>gc_appl_json ).
    lo_request->set_string_datalv_body ).

    lo_rest_client->if_rest_resource~postlo_request ).

    lo_response lo_rest_client->if_rest_client~get_response_entity).
    http_status lv_status lo_response->get_header_field'~status_code' ).
    reason lo_response->get_header_field'~status_reason' ).
    content_length lo_response->get_header_field'content-length' ).
    location lo_response->get_header_field'location' ).
    content_type lo_response->get_header_field'content-type' ).
    response lo_response->get_string_data).


    CATCH cx_root INTO DATA(lr_exc).
    WRITE:/ lv_message.
    ENDFUNCTION.                                                                                                                            7 Create the implicit enhancement that is invoked on Flight Booking Tcode as shown below. The code is very similar to the code  in Part 4 odata adapter except for 2 parameters name FLDATE and I_extrul which now points to the new iflow to invoke the RFC  8 Create a new Booking using the TCODE BC_GLOBAL_SBOOK_CREA and check the email showing the booking confirmation details from the RFC as shown below    Email showing the booking confirmation    As seen we can use the existing RFC FM that are already in the SAP System or convert FM to RFC FM and use the RFC adapter to provide efficiency in processing

1 Comment
Labels in this area