Implement the method GET_EXPAND_CLAUSE_DEFAULT in case the entity needs to support Expand (Expand Entity and Expand Entity Set) and Deep Insert. The method should return a table of Expand clauses. An example with sample code is given below:
If you do not implement the method GET_EXPAND_CLAUSE_DEFAULT, abstract EDP does not call the mapping specialists for Deep Insert and Expand operations.
Let us consider a SAP Gateway Model as shown below:
In case 'SalesOrder' entity needs to support Expand on entities 'SalesOrderLineItem' and 'Buyer' then the exporting parameter expand clause need to be filled as follows:
SalesOrderLineItem
Buyer
In case 'SalesOrder' entity needs to support Expand on entities 'SalesOrderItemScheduleLine' as well then the expand clause need to be filled as follows:
SalesOrderLineItem
Buyer
SalesOrderLineItem/SalesOrderItemScheduleLine
Sample code for implementing GET_EXPAND_CLAUSE_DEFAULT:
DATA: lv_expand_string TYPE string. CASE iv_operation. WHEN gc_operation_code_ro-expand_entityset. lv_expand_string = ‘SalesOrderLineItem’. APPEND lv_expand_string TO et_expand_clause. lv_expand_string = ‘Buyer’. APPEND lv_expand_string TO et_expand_clause. lv_expand_string = ‘SalesOrderLineItem/SalesOrderItemScheduleLine APPEND lv_expand_string TO et_expand_clause. WHEN gc_operation_code_wr-deep_insert. lv_expand_string = ‘SalesOrderLineItem’. APPEND lv_expand_string TO et_expand_clause. lv_expand_string = ‘Buyer’. APPEND lv_expand_string TO et_expand_clause. ENDCASE. |
Register mapping specialists for the expand entity operation by redefining the method REGISTER_MAPPING_SPECIALISTS of the abstract EDP. Below is the sample code.
CASE iv_entity_name. WHEN 'SalesOrder'. CASE iv_entity_operation. WHEN gc_operation_code_ro-expand_entity. ls_mapping_specialist_attr-execution_mode = gc_execution_mode_ro-expand_entity. ls_mapping_specialist_attr-mapping_specialist_name = '/IWFND/CL_MGW_MAP_SO_RQ'. ls_mapping_specialist_attr-bop_type = /iwfnd/if_mgw_bec_bop=>gc_bop_type_rfc. ls_mapping_specialist_attr-bop_name = '/IWFND/CL_MGW_BOP_SO_READ'. APPEND ls_mapping_specialist_attr TO et_mapping_specialist_attr. ls_mapping_specialist_attr-execution_mode = gc_execution_mode_ro-expand_entity. ls_mapping_specialist_attr-mapping_specialist_name = '/IWFND/CL_MGW_MAP_SI_RQ'. ls_mapping_specialist_attr-bop_type = /iwfnd/if_mgw_bec_bop=>gc_bop_type_rfc. ls_mapping_specialist_attr-bop_name = '/IWFND/CL_MGW_BOP_SI_RQ'. APPEND ls_mapping_specialist_attr TO et_mapping_specialist_attr. ENDCASE. ENDCASE. |