Redefining the Expand Methods of the Extension DPC

If all entity sets of a Gateway service are mapped to Business Entities and the restriction of the optimized SADL $expand can be accepted by the application, as discussed in the previous chapter, the optimized SADL $expand can be used.

Prerequisites

This feature is available since SAP NetWeaver 7.4 SP10.

Context

If some of the entity sets in your OData service are not mapped to a business entity, see how you can support navigation in a hybrid scenario in combination with the optimized expand in the next section.

To optimize $expand, follow these steps:

Procedure

  1. Redefine the get_expanded_entity and get_expanded_entityset methods in the generated *_dpc_ext class of your service:
      PUBLIC SECTION.
         METHODS /iwbep/if_mgw_appl_srv_runtime~get_expanded_entity REDEFINITION.
         METHODS /iwbep/if_mgw_appl_srv_runtime~get_expanded_entityset REDEFINITION.
  2. Implement the get_expanded_entity method.
      METHOD /iwbep/if_mgw_appl_srv_runtime~get_expanded_entity.
        " -------------------------------------------------
        " ...
        " Implement application specific logic of get_entity methods here (if any)
        " ...
        " -------------------------------------------------
        " Read entity data (and expand):
        if_sadl_gw_dpc_util~get_dpc( )->get_expanded_entity( 
            EXPORTING io_expand_node           = io_expand
                      io_tech_request_context  = io_tech_request_context
            IMPORTING er_entity                = er_entity
                      et_expanded_tech_clauses = et_expanded_tech_clauses
                      es_response_context      = es_response_context ).
      ENDMETHOD.
  3. Implement the get_expanded_entityset method.
      METHOD /iwbep/if_mgw_appl_srv_runtime~get_expanded_entityset.
        " -------------------------------------------------
        " ...
        " Implement application specific logic of get_entityset methods here (if any)
        " ...
        " -------------------------------------------------
        " Read entity data (and expand):
        if_sadl_gw_dpc_util~get_dpc( )->get_expanded_entityset( 
               EXPORTING io_expand_node           = io_expand
                         io_tech_request_context  = io_tech_request_context
               IMPORTING er_entityset             = er_entityset
                         et_expanded_tech_clauses = et_expanded_tech_clauses
                         es_response_context      = es_response_context ).
      ENDMETHOD.