Reputation: 2210
URL Call from Gateway: /sap/opu/odata/sap/ZMU_SHOP_MENU_SRV/ShopMenuSet?$expand=Menu/Menu_Section/Menu_Content/Menu_Item_Deal/Deal_Articles/Article_Modifier/Modifier_Class/Modifier_Group/Modifier_Options,Menu/Menu_Section/Menu_Content/Menu_Item_Deal/Prices,Menu/Menu_Section/Menu_Content/Article_Modifier/Modifier_Class/Modifier_Group/Modifier_Options.
DDIC Structures for the above were imported individually in SAP Gateway Service Builder (SEGW
) and linked via associations.
This calls the /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET
method in SAP.
DATA: ls_shop_menu TYPE zmu_s_shop_menu.
APPEND 'MENU/MENU_SECTION/MENU_CONTENT/MENU_ITEM_DEAL/DEAL_ARTICLES/ARTICLE_MODIFIER/MODIFIER_CLASS/MODIFIER_GROUP/MODIFIER_OPTIONS' TO et_expanded_tech_clauses.
APPEND 'MENU/MENU_SECTION/MENU_CONTENT/MENU_ITEM_DEAL/PRICES' TO et_expanded_tech_clauses.
APPEND 'MENU/MENU_SECTION/MENU_CONTENT/ARTICLE_MODIFIER/MODIFIER_CLASS/MODIFIER_GROUP/MODIFIER_OPTIONS' TO et_expanded_tech_clauses.
CALL METHOD zmu_menu_ctrl=>get_menu_for_shop
EXPORTING
iv_shop = '0005'
iv_date = sy-datum
iv_price_condition = ''
iv_price_list_type = ''
IMPORTING
rs_shop = ls_shop_menu.
copy_data_to_ref(
EXPORTING
is_data = ls_shop_menu
CHANGING
cr_data = er_entityset
).
ER_ENTITYSET is populated fine.
This 500 error:
Unexpected text for XML-ABAP transformation
occurs in the method MOVE_CORRESPONDING
in class /IWBEP/CL_MGW_DATA_HELPER
:
lo_xml_reader = cl_sxml_string_reader=>create( lv_xdoc ).
lo_xml_reader->next_node( ).
CALL TRANSFORMATION /iwbep/st_any_data
SOURCE XML lo_xml_reader
RESULT data = <ls_target_data>.
Does anyone have any advice on how to correctly set up a nested structure on SEGW
side which can handle the structure passed back?
I've no idea where I'm going wrong.
Upvotes: 0
Views: 2656
Reputation: 144
since you are in an entityset method, you must pass a table type to copy_data_to_ref. Instead of ls_shop_menu, pass lt_shop_menu, with lt_shop_menu being a table type of ls_shop_menu. i.e.
append ls_shop_menu to lt_shop_menu.
copy_data_to_ref( EXPORTING is_data = lt_shop_menu CHANGING cr_data = er_entityset ).
Upvotes: 0