Show TOC

Implementing /IWFND/IF_MGW_BOP_MAP_UPDATE Mapping InterfaceLocate this document in the navigation structure

Implementing /IWFND/IF_MGW_BOP_MAP_UPDATE Mapping Interface — Inbound Mapping

Update Inbound mapping method /IWFND/IF_MGW_BOP_MAP_UPDATE~MAP_INBOUND is provided with:

  • A table with key fields of the entity to be updated.

  • Navigation path

  • BOP DO

  • Table of processed BOP DOs

  • Table of processed backend data – Backend data is filled with data from Custom Backend Connectivity API

  • Data Provider (this parameter holds the request data)

  • A reference to the entity data.

To implement inbound mapping interface method /IWFND/IF_MGW_BOP_MAP_UPDATE~MAP_INBOUND for update, proceed as follows:

  1. Read the input request into a local variable whose structure represents the entity to be updated and loop at IT_KEY_TAB to get the key of the entity to be updated.

    DATA: ls_flight TYPE /iwfnd/om_mgw_sample_sflight_s=>flight.
      DATA: lo_bop_do TYPE REF TO /iwfnd/cl_mgw_bop_fl_cre_do.
      DATA: ls_request TYPE /iwfnd/cl_mgw_bop_fl_cre=>_params_request.
      DATA: ls_key_tab TYPE LINE OF /iwcor/if_odata_types=>nvp_t.
     DATA: lv_airline TYPE S_CARR_ID.
     DATA: lv_connectid TYPE S_CONN_ID.
     DATA: lv_fllightdate TYPE d.
    
    •	Read the Input Request
      TRY.
          io_data_provider->read_entry_data( IMPORTING es_data = ls_flight ).
        CATCH /iwfnd/cx_mgw_tech_exception.
      ENDTRY.
    
    •	Get the Key of the Entity to be Updated
      LOOP AT it_key_tab INTO ls_key_tab.
        CASE ls_key_tab-name.
          WHEN 'airlineid'.
            lv_airline = ls_key_tab-value.
          WHEN 'connectid'.
            lv_connectid = ls_key_tab-value.
          WHEN 'flightdate'.
            lv_flightdate = ls_key_tab-value.
        ENDCASE.
      ENDLOOP.
     
  2. Create the BOP DO request using the input request and key fields retrieved in the previous step.

    MOVE-CORRESPONDING: ls_flight TO ls_request-flight_data.
    ls_request-flight_data-airlineid = lv_airline.
    ls_request-flight_data-connectid = lv_connectid.
    ls_request-flight_data-flightdate = lv_flightdate.
     
  3. Set the BOP DO request.

    lo_bop_do->set_request( ls_request ). 
Implementing /IWFND/IF_MGW_BOP_MAP_UPDATE Mapping Interface — Outbound Mapping

Update outbound mapping method /IWFND/IF_MGW_BOP_MAP_UPDATE~MAP_OUTBOUND is provided with:

  • A table with key fields of the entity to be updated.

  • Navigation path

  • BOP DO

  • Table of processed BOP DOs

  • Table of Processed Backend Data – Backend Data is filled with data from Custom Backend Connectivity API

  • Data Provider (this parameter holds the request data)

  • A reference to the entity data.

To implement outbound mapping interface method /IWFND/IF_MGW_BOP_MAP_UPDATE~MAP_OUTBOUND for update, proceed as follows:

  1. Check if there are any backend call errors. In case of backend errors, copy the backend error message and add it to the message container. Set the process code to STOP_PROCESSING.

    DATA: ls_response TYPE /iwfnd/cl_mgw_bop_fl_cre=>_params_response.
      DATA: lo_bop_do TYPE REF TO /iwfnd/cl_mgw_bop_fl_cre_do.
      DATA: ls_return TYPE LINE OF /iwfnd/cl_mgw_bop_fl_cre=>_params_response-return.
      DATA: ls_flight TYPE /iwfnd/om_mgw_sample_sflight_s=>flight.
      DATA: lo_exp TYPE REF TO /iwfnd/cx_mgw_busi_exception.
      FIELD-SYMBOLS: <fs> TYPE any.
      
      lo_bop_do ?= io_bop_do.
      lo_bop_do->get_response( IMPORTING es_response = ls_response ).
    
    * Check for Error
      READ TABLE ls_response-return INTO ls_return WITH KEY type = 'E'.
      IF sy-subrc EQ 0.
        CREATE OBJECT lo_exp
          EXPORTING
            textid  = /iwfnd/cx_mgw_busi_exception=>business_error
            message = ls_return-message.
    
        /iwfnd/if_mgw_bop_map~mo_request_context->get_message_container( )->add_message_from_exception(
            io_exception = lo_exp
            iv_is_leading_message = abap_true
            iv_system_alias  = /iwfnd/if_mgw_bop_map~mv_system_alias
            iv_message_creator = 'TEST'
            iv_entity_type = 'flight'
           ).
        ev_process_code = /iwfnd/if_mgw_bop_map=>cs_process_code-stop_processing.
      ELSE.
     
  2. In case there are no backend errors and no READ BOP has been registered after update operation, read the input request into a local variable (whose structure represents the entity that has been updated) and create entity data, which will be used as a response for the update operation.

    TRY.
            io_data_provider->read_entry_data( IMPORTING es_data = ls_flight ).
          CATCH /IWFND/CX_MGW_TECH_EXCEPTION.
        ENDTRY.
    
        CREATE DATA er_entity LIKE ls_flight.
        ASSIGN er_entity->*  TO <fs>.
        <fs> = ls_flight. 

Continue with Error Handling in Mapping Specialists

Back to Developing Content on SAP Gateway OData Channel