Show TOC

Implementing /IWFND/IF_MGW_BOP_MAP_QUERY for QueryLocate this document in the navigation structure

Implementing /IWFND/IF_MGW_BOP_MAP_QUERY for Query — Inbound Mapping

Query Inbound mapping method /IWFND/IF_MGW_BOP_MAP_QUERY~MAP_INBOUND is provided with:

  • Selection 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 set data – Entity set data can be partially filled by previous mapping specialists

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

  1. Map the filter parameters of an entity to the BOP request.

    DATA: ls_filter_so TYPE LINE OF /iwcor/if_odata_types=>edm_select_option_t.
      DATA: ls_so_value  TYPE LINE OF /iwcor/if_odata_types=>abap_select_option_t.
      DATA: lo_bop_do    TYPE REF TO /iwfnd/cl_mgw_bop_fl_qu_do.
      DATA: ls_request   TYPE /iwfnd/cl_mgw_bop_fl_qu=>_params_request.
    
      lo_bop_do ?= io_bop_do.
    
    * Read the filter parameters of an entity
    * Map the filter parameters to the BOP request
      READ TABLE it_filter_select_options INTO ls_filter_so WITH KEY property = 'airlineid'.
      IF sy-subrc EQ 0.
        READ TABLE ls_filter_so-select_options INDEX 1 INTO ls_so_value.
        ls_request-airline = ls_so_value-low.
      ENDIF.
     
  2. Set the BOP DO with BOP DO request structure.

    lo_bop_do->set_request( ls_request ). 
Implementing /IWFND/IF_MGW_BOP_MAP_QUERY for Query — Outbound Mapping

Query Outbound mapping method /IWFND/IF_MGW_BOP_MAP_QUERY~MAP_OUTBOUND is provided with:

  • Selection 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 set data – Entity set data can be partially filled by previous mapping specialists

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

  1. Check if there are any backend call errors. In case there are 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_qu_do.
      DATA: ls_response  TYPE /iwfnd/cl_mgw_bop_fl_qu=>_params_response.
      DATA: ls_bo_flight TYPE bapisfldat.
      DATA: lt_bo_flight TYPE /iwfnd/cl_mgw_bop_fl_qu=>__bapisfldat.
      DATA: ls_flight    TYPE /iwfnd/om_mgw_sample_sflight_s=>flight.
      DATA: lt_flight    TYPE STANDARD TABLE OF /iwfnd/om_mgw_sample_sflight_s=>flight.
      
      FIELD-SYMBOLS: <fs> TYPE any.
    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 Query Request
      ev_process_code = /iwfnd/if_mgw_bop_map=>cs_process_code-stop_processing.
      
      RETURN.
      ENDIF.
     
  2. Loop over the BOP DO response data and build a temporary table of data.

    LOOP AT ls_response-flight_list INTO ls_bo_flight.
        MOVE-CORRESPONDING ls_bo_flight TO ls_flight.
        APPEND ls_flight TO lt_flight.
      ENDLOOP.
     
  3. create entity set data.

    CREATE DATA er_entityset LIKE lt_flight.
    ASSIGN er_entityset->* TO <fs>. 
  4. Copy the temporary table of data to entity set data.

    <fs> = lt_flight. 

Continue with Error Handling in Mapping Specialists

Back to Developing Content on SAP Gateway OData Channel