Show TOC

Implementing Entity Data Provider ClassLocate this document in the navigation structure

You can implement EDP in simple scenarios. In such cases, EDP acts as a data provider.

To implement an EDP class, proceed as follows:

  1. Create an EDP class by inheriting either /IWBEP/CL_MGW_GSR_EDP_RO_BASE (in case of read only Entity) or /IWBEP/CL_MGW_GSR_EDP_WR_BASE (in case of write) .

  2. Implement the abstract method REGISTER_MAPPING_SPECIALISTS.

    1. Register only those BOP and mapping specialist required for the current operation. For example, to update an entity, register only the BOP and mapping specialist required for the update scenario.

    2. An update scenario might need a read before update. In such cases, register a Read BOP and the corresponding mapping specialist for read followed by update BOP and the corresponding mapping specialist.

    3. Registration of BOP and mapping specialist is done by filling the structure of type /IWBEP/S_MGW_EDP_MAP_SPEC_ATTR.

      Attribute Name

      Description

      execution_mode*

      Execution mode tells which mapping interface needs to be executed for an operation. Each operation supports only a valid set of execution modes. Refer the matrix (table) below for details.

      mapping_spec_attr

      Mapping specialist details is of type /IWBEP/S_MGW_EDP_BOP_MAP_EXT to be appended to table of type /IWBEP/T_MGW_EDP_MAP_SPEC_ATTR.

      mapping_specialist_name

      Name of the mapping specialist.

      Note

      Ignore this field if you are providing a reference to a mapping specialist instance (mapping_specialist_ref).

      mapping_specialist_ref

      Reference to mapping specialist instance. This attribute is filled by the abstract EDP based on the mapping specialist name.

      Note

      Ignore this option if you are providing the name of a mapping specialist (mapping_specialist_name).

      bop_type *

      Choose one of the following:

      • RFC

      • Web Service

      • Custom

      Note

      If BOP is registered as custom then the attribute be_api_ref needs to be filled by you.

      Following constants defines the values for BOP type:

      • /IWBEP/IF_MGW_BOP=>GC_BOP_TYPE_RFC

      • /IWBEP/IF_MGW_BOP=>GC_BOP_TYPE_WS

      • /IWBEP/IF_MGW_BOP=>GC_BOP_TYPE_CUSTOM

      bop_id

      Class name of the BOP.

      bop_type_ref

      Reference to the BOP. This attribute is filled by the Abstract Entity Provider based on the BOP name.

      be_api_ref**

      Reference to custom backend connectivity API. This attribute needs to be filled if BOP type is Custom.

      See Custom Backend Connectivity API for more information.

      ws_service_group**

      Web Service Group Name. This attribute needs to be filled if BOP type is Web Service.

      • * - Mandatory attribute

      • ** - Mandatory attribute based on the BOP Type

      Matrix - Following Matrix explains valid set of execution modes for an operation code.

      Operation Code / Execution Mode

      Create

      Update

      Delete

      Read

      Query

      Action

      Stream

      Create

      X

      X

      X

      X

           

      Update

      X

      X

      X

      X

           

      Delete

       

      X

      X

      X

           

      Read

           

      X

           

      Query

             

      X

         

      Expand Entity

           

      X

           

      Expand Entity Set

             

      X

         

      Deep Insert

      X

         

      X

           

      Action

               

      X

       

      Stream

                 

      X

      Following constants defines the operation codes and execution modes:

      • /IWBEP/CL_MGW_GSR_EDP_RO_BASE=>GC_OPERATION_CODE_RO

      • /IWBEP/CL_MGW_GSR_EDP_RO_BASE=>GC_EXECUTION_MODE_RO

      • /IWBEP/CL_MGW_GSR_EDP_WR_BASE=>GC_OPERATION_CODE_WR

      • /IWBEP/CL_MGW_GSR_EDP_WR_BASE=>GC_EXECUTION_MODE_WR

      Sample code for registering the mapping specialist

      Note

      /IWBEP/CL_MGW_EDP_SFL_MAP_BOOK class has the mapping specialist interface implementation.

      CASE iv_entity_name.
          WHEN 'flight'.
            CASE iv_entity_operation.
      
                    WHEN gc_operation_code_ro-read.
      * Execution Mode
                ls_bop_map_attr-execution_mode = gc_operation_code_ro-read.
      * Mapping Specialist Name
                ls_mapping_specialist_attr-mapping_spec_name = '/IWBEP/CL_MGW_EDP_SFL_MAP_BOOK'.
                APPEND ls_mapping_specialist_attr TO ls_bop_map_attr-mapping_spec_attr.
      * BOP Type
                ls_bop_map_attr-bop_type = /iwbep/if_mgw_bop=>gc_bop_type_rfc.
                ls_bop_map_attr-bop_id = '/IWBEP/CL_MGW_BOP_SFL_BKRD'.
                APPEND ls_bop_map_attr TO et_mapping_specialist_attr.
      
              WHEN gc_operation_code_ro-query.
      * Execution Mode
                ls_bop_map_attr-execution_mode = gc_operation_code_ro-query.
      * Mapping Specialist Name
                ls_mapping_specialist_attr-mapping_spec_name = '/IWBEP/CL_MGW_EDP_SFL_MAP_BOOK'.
                APPEND ls_mapping_specialist_attr TO ls_bop_map_attr-mapping_spec_attr.
      * BOP Type
                ls_bop_map_attr-bop_type = /iwbep/if_mgw_bop=>gc_bop_type_rfc.
                ls_bop_map_attr-bop_id = '/IWBEP/CL_MGW_BOP_SFL_BKQR'.
                APPEND ls_bop_map_attr TO et_mapping_specialist_attr.
      
              WHEN gc_operation_code_wr-delete.
      * Delete
      * Execution Mode Create
                ls_bop_map_attr-execution_mode = gc_operation_code_wr-delete.
      * Mapping Specialist Name
                ls_mapping_specialist_attr-mapping_spec_name = '/IWBEP/CL_MGW_EDP_SFL_MAP_BOOK'.
                APPEND ls_mapping_specialist_attr TO ls_bop_map_attr-mapping_spec_attr.
      * BOP Type
                ls_bop_map_attr-bop_type = /iwbep/if_mgw_bop=>gc_bop_type_rfc.
                ls_bop_map_attr-bop_id = '/IWBEP/CL_MGW_BOP_SFL_BKDE'.
                APPEND ls_bop_map_attr TO et_mapping_specialist_attr.
      
                mv_remote_commit_req = abap_true.
      ENDCASE.
       
  3. Transaction Handling — To commit a remote SAP Logical Unit of Work (LUW), BAPI_TRANSACTION_COMMIT is executed. A default implementation for calling the BAPI to commit data remotely is handled in the abstract EDP. You need to set the member variable MV_REMOTE_COMMIT_REQ = abap_true, if default handling is required. However, the method SAVE of the class /IWBEP/CL_MGW_GSR_EDP_WR_BASE can be redefined by the content if additional processing is required. This method is executed for:

    • CREATE

    • UPDATE

    • DELETE

    • CREATE_DEEP_ENTITY

    • EXECUTE_ACTION

Continue with Implementing Mapping Specialist

Back to Developing Content on SAP Gateway OData Channel Using IWBEP