Show TOC

Implementing /IWFND/IF_MGW_BOP_MAP_CREATE for CreateLocate this document in the navigation structure

Implementing /IWFND/IF_MGW_BOP_MAP_CREATE for Create — Inbound Mapping

Create inbound mapping method /IWFND/IF_MGW_BOP_MAP_CREATE MAP_INBOUND is provided with:

  • BOP DO

  • Data provider

  • Keys, Navigation path

  • Table of processed BOP DOs

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

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

  • Process code - to be set if there is an error during the inbound mapping

  • ET_ADDITIONAL_BOP_DO - Used only in case of deep insert operation

    Note

    IT_EXPAND_CLAUSE and ET_ADDITIONAL_BOP_DO are not used in create operations but in deep insert operations.

To implement inbound mapping interface method /IWFND/IF_MGW_BOP_MAP_CREATE MAP_INBOUND for create, proceed as follows:

  1. Use this interface /IWFND/IF_MGW_BOP_MAP_CREATE to implement the logic for inbound mapping for create operation (when you want to create an entity using HTTP Post method).

  2. Declare object types referencing to the data object class (class with suffix _DO) of the related BOP. It holds the request and response parameters.

    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. 
       lo_bop_do ?= io_bop_do. 
     
  3. Use the io_data_provider to retrieve the content passed for the create operation.

    io_data_provider->read_entry_data( IMPORTING es_data = ls_flight ).  
  4. Set the BOP DO request structure.

      MOVE-CORRESPONDING: ls_flight TO ls_request-flight_data.
      lo_bop_do->set_request( ls_request ). 
     
Implementing /IWFND/IF_MGW_BOP_MAP_CREATE for Create — Outbound Mapping

Create outbound mapping method /IWFND/IF_MGW_BOP_MAP_CREATE MAP_OUTBOUND is provided with:

  • BOP DO

  • Data provider

  • Keys, Navigation path

  • Table of processed BOP DOs

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

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

  • IT_EXPAND_CLAUSE - A table of string used in case of expansion of nodes (used in a deep insert operation for identifying the parent-child)

  • Process code - to be set if there is an error during the outbound mapping

  • ET_ADDITIONAL_BOP_DO - Used only in case of deep insert operation

    Note

    IT_EXPAND_CLAUSE and ET_ADDITIONAL_BOP_DO are not used in create operations but in deep insert operations.

  • ET_KEY_TAB – List of keys generated (used in subsequent operations like read of an entity after create)

To implement outbound mapping interface method /IWFND/IF_MGW_BOP_MAP_CREATE MAP_OUTBOUND for create, proceed as follows:

  1. Use this interface /IWFND/IF_MGW_BOP_MAP_CREATE to implement the logic for outbound mapping for create operation (when you want to create an entity using HTTP Post method).

  2. Declare object types referencing to the data object class (class with suffix _DO) of the related BOP. It holds the request and response parameters.

    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. 
    lo_bop_do ?= io_bop_do.
    lo_bop_do->get_response( IMPORTING es_response = ls_response ). 
     
  3. Check if the response data contains any errors from the backend.

    * 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.
    ELSE.
     
     io_data_provider->read_entry_data( IMPORTING es_data = ls_flight ). 
     
    ENDIF.
     
  4. Create the entity data from the content.

    CREATE DATA er_entity LIKE ls_flight.
        ASSIGN er_entity->*  TO <fs>.
        <fs> = ls_flight.  
  5. Set the keys accordingly for using in subsequent operations (for example, a read operation).

    * Set the Keys
      ls_key_tab-name = 'airlineid'.
      ls_key_tab-value = ls_flight-airlineid.
      APPEND ls_key_tab TO et_key_tab.
     
      ls_key_tab-name = 'flightdate'.
      ls_key_tab-value = ls_flight-flightdate.
      APPEND ls_key_tab TO et_key_tab.
     
      ls_key_tab-name = 'connectid'.
      ls_key_tab-value = ls_flight-connectid.
      APPEND ls_key_tab TO et_key_tab. 
     

Continue with Error Handling in Mapping Specialists

Back to Developing Content on SAP Gateway OData Channel