Code template for redefinition of /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET

📟 get_expanded_entityset
Placeholder function – replace with the relevant business logic

📟 check_msg_and_raise_exceptions

Take a look at Generic Exception handling (BAPIRET2) in OData
  METHOD /iwbep/if_mgw_appl_srv_runtime~get_expanded_entityset.
    DATA: lo_message_container  TYPE REF TO /iwbep/if_message_container,
          lv_entity_set_name    TYPE /iwbep/mgw_tech_name,
          lt_return             TYPE bapiret2_t,
          lt_expanded_entityset TYPE z....


*--- Basic requirements
    lo_message_container = mo_context->get_message_container( ).
    lv_entity_set_name = io_tech_request_context->get_entity_set_name( ).

    CASE lv_entity_set_name.
      WHEN 'ExpandedEntitySet'.

*--- expanded entityset - execute business logic
        get_expanded_entityset(
          IMPORTING
            et_return       = lt_return
            et_entityset    = lt_expanded_entityset
        ).

*--- check for errors
        check_msg_and_raise_exceptions(
          EXPORTING
            it_messages          = lt_return
            io_message_container =  lo_message_container
        ).

*--- copy data to ref
        copy_data_to_ref(
          EXPORTING
            is_data = lt_sbtypevh_deep
          CHANGING
            cr_data = er_entityset
        ).

      WHEN OTHERS.
        CALL METHOD super->/iwbep/if_mgw_appl_srv_runtime~get_expanded_entityset
          EXPORTING
            iv_entity_name           = iv_entity_name
            iv_entity_set_name       = iv_entity_set_name
            iv_source_name           = iv_source_name
            it_filter_select_options = it_filter_select_options
            it_order                 = it_order
            is_paging                = is_paging
            it_navigation_path       = it_navigation_path
            it_key_tab               = it_key_tab
            iv_filter_string         = iv_filter_string
            iv_search_string         = iv_search_string
            io_expand                = io_expand
            io_tech_request_context  = io_tech_request_context
          IMPORTING
            er_entityset             = er_entityset
            et_expanded_clauses      = et_expanded_clauses
            et_expanded_tech_clauses = et_expanded_tech_clauses
            es_response_context      = es_response_context.
    ENDCASE.

*--- Arrange Expand closure
    DATA(lt_children) = io_expand->get_children( ).
    LOOP AT lt_children ASSIGNING FIELD-SYMBOL(<ls_child>).
      APPEND <ls_child>-tech_nav_prop_name TO et_expanded_tech_clauses.
    ENDLOOP.

  ENDMETHOD.

Leave a Reply

Your email address will not be published. Required fields are marked *