Define entities which support expand entity operation by redefining the method GET_EXPAND_CLAUSE_DEFAULT of the abstract EDP. See Implementing GET_EXPAND_CLAUSE_DEFAULT for more information.
If you do not implement the method GET_EXPAND_CLAUSE_DEFAULT, abstract EDP will not be able to call the mapping specialists for Expand entity operation.
The (GET_EXPANDED_ENTITY) 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 expanded entity, proceed as follows:
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. |
Set the BOP DO with BOP DO request structure.
lo_bop_do->set_request( ls_request ). |
Expand entity 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
Expand entity clause
To implement outbound mapping interface method /IWFND/IF_MGW_BOP_MAP_READ~MAP_OUTBOUND for expand entity, proceed as follows:
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. |
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. |
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. |
In the MAP_OUTBOUND method of the mapping specialist, make sure that the entity data reference points to a structure which represents the model in a flat format.
* Move the list of Bookings available in the BOP response to the table BOOKINGS_TARGET in the flight structure. APPEND LINES OF ls_response-bookinglist TO ls_flight-bookings_target. |
Continue with Error Handling in Mapping Specialists