Developer

Redefining the GET_ENTITYSET Method

Redefine the GET_ENTITYSET method to calculate and store hash values and supply a delta token.

Prerequisites

The GET_ENTITYSET method should already retrieve the application data containing business partner entries.

Procedure

  1. In transaction SE80, edit class ZCL_Z_EPM_RKT_DPC_EXT.
  2. Open the implementation of the BUSINESSPARTNERS_GET_ENTITYSET method.
  3. To get the data provider facade, add this code:
    * get the data provider facade
    TRY.
      lo_dp_facade = /iwbep/if_mgw_conv_srv_runtime~get_dp_facade( ).
    CATCH /iwbep/cx_mgw_tech_exception.
      RAISE EXCEPTION TYPE /iwbep/cx_mgw_tech_exception.
    ENDTRY.
  4. Call the /IWBEP/CL_QUERY_RESULT_LOG-> CREATE_UPDATE_LOG_ENTRY_HASH method for the delta query functionality by passing local table ET_ENTITYSET, which contains the business partner entries:
    * call the delta token functionality
    TRY.
      CALL METHOD /iwbep/cl_query_result_log=>create_update_log_entry_hash
        EXPORTING
          io_tech_request_context = io_tech_request_context
          io_dp_facade = lo_dp_facade
          ir_service_document_name = mr_service_document_name
          ir_service_version = mr_service_version
          it_entityset = et_entityset
        CHANGING
          ev_delta_token = lv_delta_token.
      CATCH /iwbep/cx_qrl_locked.
        RAISE EXCEPTION TYPE /iwbep/cx_qrl_locked.
    CATCH /iwbep/cx_qrl_delta_unavailabl.
        RAISE EXCEPTION TYPE /iwbep/cx_qrl_delta_unavailabl.
    ENDTRY.
  5. Export the delta token which was calculated by the method in step 4:
    es_response_context-deltatoken = lv_delta_token.

Results

The ZCL_Z_EPM_RKT_DPC_EXT->BUSINESSPARTNERS_GET_ENTITYSET method and complete code should look similar to:
DATA:
  lt_return TYPE TABLE OF bapiret2,
  lv_delta_token TYPE string,
  lo_dp_facade TYPE REF TO /iwbep/if_mgw_dp_facade.

* retrieve all relevant entries for this entityset
CALL FUNCTION 'BAPI_EPM_BP_GET_LIST'
  TABLES
    headerdata = et_entityset
    return = lt_return.

* get the data provider facade
TRY.
  lo_dp_facade = /iwbep/if_mgw_conv_srv_runtime~get_dp_facade( ).
CATCH /iwbep/cx_mgw_tech_exception.
  RAISE EXCEPTION TYPE /iwbep/cx_mgw_tech_exception.
ENDTRY.

* call the delta token functionality
TRY.
  CALL METHOD /iwbep/cl_query_result_log=>create_update_log_entry_hash
    EXPORTING
      io_tech_request_context = io_tech_request_context
      io_dp_facade = lo_dp_facade
      ir_service_document_name = mr_service_document_name
      ir_service_version = mr_service_version
      it_entityset = et_entityset
    CHANGING
      ev_delta_token = lv_delta_token.
  CATCH /iwbep/cx_qrl_locked.
    RAISE EXCEPTION TYPE /iwbep/cx_qrl_locked.
  CATCH /iwbep/cx_qrl_delta_unavailabl.
    RAISE EXCEPTION TYPE /iwbep/cx_qrl_delta_unavailabl.
ENDTRY.

* export the delta token
es_response_context-deltatoken = lv_delta_token.