Redefining the GET_ENTITYSET_DELTA Method
Redefine the GET_ENTITYSET_DELTA method to retrieve the entity set delta by comparing the current hash values to the hash values of the prior call.
Procedure
Results
DATA:
lt_return TYPE TABLE OF bapiret2,
lv_entity_set_name TYPE string,
lt_businesspartner TYPE zcl_z_epm_rkt_mpc=>tt_businesspartner,
ls_businesspartner TYPE zcl_z_epm_rkt_mpc=>ts_businesspartner,
lt_deleted_businesspartner TYPE zcl_z_epm_rkt_mpc=>tt_businesspartner,
ls_deleted_businesspartner TYPE zcl_z_epm_rkt_mpc=>ts_businesspartner,
lv_delta_token TYPE string,
lo_dp_facade TYPE REF TO /iwbep/if_mgw_dp_facade.
FIELD-SYMBOLS:
<lt_businesspartner> TYPE zcl_z_epm_rkt_mpc=>tt_businesspartner,
<lt_deleted_businesspartner> TYPE zcl_z_epm_rkt_mpc=>tt_businesspartner.
lv_entity_set_name = io_tech_request_context->get_entity_set_name( ).
IF lv_entity_set_name = 'BusinessPartners'.
* retrieve all relevant entries for this entityset
CALL FUNCTION 'BAPI_EPM_BP_GET_LIST'
TABLES
headerdata = lt_businesspartner
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 = lt_businesspartner
IMPORTING
et_deleted_entityset = lt_deleted_businesspartner
et_entityset = lt_businesspartner
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.
* export the deleted entity set
copy_data_to_ref( EXPORTING
is_data = lt_deleted_businesspartner
CHANGING
cr_data = er_deleted_entityset ).
* export the changed entity set
copy_data_to_ref( EXPORTING
is_data = lt_businesspartner
CHANGING
cr_data = er_entityset ).
ENDIF.
