Define entities, which support expand entity set 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 set operation.
Expand entity set 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
Expand entity clause
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 expand entity set, proceed as follows:
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. |
Set the BOP DO with BOP DO request structure.
lo_bop_do->set_request( ls_request ). |
Expand entity set 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
Expand entity clause
To implement outbound mapping interface method /IWFND/IF_MGW_BOP_MAP_QUERY~MAP_OUTBOUND for expand entity set, proceed as follows:
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. |
Loop over the BOP DO response data and build a temporary table of data. Make sure that the entity data reference points to a table whose line type represents the model in a flat format.
LOOP AT ls_response-flight_list INTO ls_bo_flight. MOVE-CORRESPONDING ls_bo_flight TO ls_flight. * Map the list of bookings from the BOP response to the corresponding flight. APPEND LINES OF ls_bo_flight-bookinglist TO ls_flight-bookings_target. APPEND ls_flight TO lt_flight. ENDLOOP. |
create entity set data.
CREATE DATA er_entityset LIKE lt_flight. ASSIGN er_entityset->* TO <fs>. |
Copy the temporary table of data to entity set data.
<fs> = lt_flight. |
Continue with Error Handling in Mapping Specialists