Show TOC

Implementing /IWFND/IF_MGW_BOP_MAP_READ for ReadLocate this document in the navigation structure

Implementing /IWFND/IF_MGW_BOP_MAP_READ for Read — Inbound Mapping

The read Inbound mapping method is provided with:

  • Request parameters for an entity

  • BOP DO

  • Table of processed BOP DOs

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

  • Reference to entity data – Entity data can be partially filled by previous mapping specialists

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

  1. Map the input keys to the BOP DO request.

    DATA: ls_key_tab TYPE LINE OF /iwcor/if_odata_types=>nvp_t.
      DATA: lo_bop_do  TYPE REF TO /iwfnd/cl_mgw_bop_fl_read_do.
    
    * BOP DO Request
      DATA: ls_request TYPE /iwfnd/cl_mgw_bop_fl_read=>_params_request.
    
      lo_bop_do ?= io_bop_do.
    
    * Loop over the key tab to get the list of entity keys
    * Map them to the BOP DO request structure
    
      LOOP AT it_key_tab INTO ls_key_tab.
        CASE ls_key_tab-name.
          WHEN 'airlineid'.
            ls_request-airlineid = ls_key_tab-value.
          WHEN 'connectid'.
            ls_request-connectionid = ls_key_tab-value.
          WHEN 'flightdate'.
            ls_request-flightdate = ls_key_tab-value.
        ENDCASE.
      ENDLOOP.
     
  2. Set the BOP DO with BOP DO request structure.

    lo_bop_do->set_request( ls_request ). 
Implementing /IWFND/IF_MGW_BOP_MAP_READ for Read — Outbound

Read outbound mapping method is provided with:

  • Request parameters for an entity

  • BOP DO

  • Table of processed BOP DOs

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

  • Reference to entity data – Entity data can be partially filled by previous mapping specialists

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

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

    DATA: lo_bop_do 	TYPE REF TO /iwfnd/cl_mgw_bop_fl_read_do.
    DATA: ls_response TYPE /iwfnd/cl_mgw_bop_fl_read=>_params_response.
    DATA: ls_flight 	TYPE /iwfnd/om_mgw_sample_sflight_s=>flight.
    DATA: ls_return 	TYPE LINE OF /iwfnd/cl_mgw_bop_fl_read=>_params_response-return.
    DATA: lo_exp 	TYPE REF TO /iwfnd/cx_mgw_busi_exception.
    
    FIELD-SYMBOLS: <fs> TYPE any.
    * Get BOP DO response
    lo_bop_do ?= io_bop_do.
    lo_bop_do->get_response( IMPORTING es_response = ls_response ).
    
    * Check if there are any backend call errors
    READ TABLE ls_response-return INTO ls_return WITH KEY type = 'E'.
    IF sy-subrc EQ 0.
    
    * Create a business exception object
      CREATE OBJECT lo_exp
        EXPORTING
          textid  = /iwfnd/cx_mgw_busi_exception=>business_error
          message = ls_return-message.
    
    * Add the exception object to the message container
      /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'
           ).
    
    * Set the process code to STOP_PROCESSING to stop any further processing of Read Request
      ev_process_code = /iwfnd/if_mgw_bop_map=>cs_process_code-stop_processing.
      
      RETURN.
          ENDIF.
     
  2. Create an entity, if an entity is not already created by the previous mapping specialists.

    CREATE DATA er_entity LIKE ls_flight.
        ASSIGN er_entity->* TO <fs>.
    <fs> = ls_flight. 
  3. Map the response data from BOP DO response to entity.

    
               MOVE-CORRESPONDING: ls_response-flight_data TO ls_flight.
               MOVE-CORRESPONDING: ls_response-availibility TO ls_flight-availability.
     

Continue with Error Handling in Mapping Specialists

Back to Developing Content on SAP Gateway OData Channel