cancel
Showing results for 
Search instead for 
Did you mean: 

Error: Method 'GET_ENTITY' not implemented in data provider class in OData extension

former_member213400
Active Participant

Hi @Andre Fischer,

Overview of the error like why or how this error came. We have a requirement that our client wants to allow employee to fill timesheet as per the quota left. for that what we done is, we extended the standard OData service and created one entityset to bring the quota available under 'Data Model'. when we are trying to implement 'service implementation' for the entityset it was not allowing since it took the reference of standard OData service. for that we implemented the entityset in the standard methods of

/IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_ENTITY

/IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_ENTITYSET

after implementing we generated run-time artifacts and it is successful.

After that we tried to run the request URI for entityset from gateway client then we are got this error.

This below link is reference of this issue,

Mapping not allowed. The model in project ZGW_HCM_MYTIMESHEET_X is redefining another

Thank you Andre Fischer. please help me on thismethod-get-entity-not-implemented-in-data-provider.png

View Entire Topic
former_member213400
Active Participant
0 Kudos

Thank you Andre Fischer, we found the issue and fixed it. the issue was Entityset was missing in the standard method.

SangeethaRaj
Explorer
0 Kudos

Hi,

I have similar issue , getting 500 in get entity set method ( standard search help import) after implementing entity set in method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_ENTITYSET. after implementing entityset as specific method also , still it gives 500 error in gateway client. Can you help to spot what went wrong.

My code as below:

method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_ENTITYSET.
DATA lv_entityset_name TYPE string.
data: EhhssElmEstRsk_get_entityset type ZCL_ZEHSINCREP_MPC=>TT_EHHSSELMESTRSK.

lv_entityset_name = io_tech_request_context->get_entity_set_name( ).

CASE lv_entityset_name.

*custom code to call search help
WHEN 'EhhssElmEstRsk'.
* Call the entity set generated method
EhhssElmEstRsk_get_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_tech_request_context = io_tech_request_context
IMPORTING
et_entityset = EhhssElmEstRsk_get_entityset
es_response_context = es_response_context
).
* Send specific entity data to the caller interface
copy_data_to_ref(
EXPORTING
is_data = EhhssElmEstRsk_get_entityset
CHANGING
cr_data = er_entityset
).


WHEN OTHERS.
super->/iwbep/if_mgw_appl_srv_runtime~get_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_tech_request_context = io_tech_request_context
IMPORTING
er_entityset = er_entityset ).
ENDCASE.
endmethod.



*custom code to call search help
WHEN 'EhhssElmEstRsk'.
* Call the entity set generated method
EhhssElmEstRsk_get_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_tech_request_context = io_tech_request_context
IMPORTING
et_entityset = EhhssElmEstRsk_get_entityset
es_response_context = es_response_context
).
* Send specific entity data to the caller interface
copy_data_to_ref(
EXPORTING
is_data = EhhssElmEstRsk_get_entityset
CHANGING
cr_data = er_entityset
).


WHEN OTHERS.
super->/iwbep/if_mgw_appl_srv_runtime~get_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_tech_request_context = io_tech_request_context
IMPORTING
er_entityset = er_entityset ).
ENDCASE.
endmethod.

My specific method implementation

method EHHSSELMESTRSK_GET_ENTITYSET.

DATA lo_filter TYPE REF TO /iwbep/if_mgw_req_filter.
DATA lt_filter_select_options TYPE /iwbep/t_mgw_select_option.
DATA lv_filter_str TYPE string.
DATA lv_MAX_HITS TYPE i.
DATA ls_paging TYPE /iwbep/s_mgw_paging.
DATA ls_converted_keys LIKE LINE OF et_entityset.
DATA ls_message TYPE bapiret2.
DATA lt_selopt TYPE ddshselops.
DATA ls_selopt LIKE LINE OF lt_selopt.
DATA ls_filter TYPE /iwbep/s_mgw_select_option.
DATA ls_filter_range TYPE /iwbep/s_cod_select_option.
DATA lr_DESCRIPTION LIKE RANGE OF ls_converted_keys-description.
DATA ls_DESCRIPTION LIKE LINE OF lr_DESCRIPTION.
DATA lr_CODE LIKE RANGE OF ls_converted_keys-code.
DATA ls_CODE LIKE LINE OF lr_CODE.
DATA lt_result_list TYPE /iwbep/if_sb_gendpc_shlp_data=>tt_result_list.
DATA lv_next TYPE i VALUE 1.
DATA ls_entityset LIKE LINE OF et_entityset.
DATA ls_result_list_next LIKE LINE OF lt_result_list.
DATA ls_result_list LIKE LINE OF lt_result_list.

*-------------------------------------------------------------
* Map the runtime request to the Search Help select option - Only mapped attributes
*-------------------------------------------------------------
* Get all input information from the technical request context object
* Since DPC works with internal property names and runtime API interface holds external property names
* the process needs to get the all needed input information from the technical request context object
* Get filter or select option information
lo_filter = io_tech_request_context->get_filter( ).
lt_filter_select_options = lo_filter->get_filter_select_options( ).
lv_filter_str = lo_filter->get_filter_string( ).

* Check if the supplied filter is supported by standard gateway runtime process
IF lv_filter_str IS NOT INITIAL
AND lt_filter_select_options IS INITIAL.
" If the string of the Filter System Query Option is not automatically converted into
" filter option table (lt_filter_select_options), then the filtering combination is not supported
" Log message in the application log
me->/iwbep/if_sb_dpc_comm_services~log_message(
EXPORTING
iv_msg_type = 'E'
iv_msg_id = '/IWBEP/MC_SB_DPC_ADM'
iv_msg_number = 025 ).
" Raise Exception
RAISE EXCEPTION TYPE /iwbep/cx_mgw_tech_exception
EXPORTING
textid = /iwbep/cx_mgw_tech_exception=>internal_error.
ENDIF.

* Get key table information
io_tech_request_context->get_converted_source_keys(
IMPORTING
es_key_values = ls_converted_keys ).

ls_paging-top = io_tech_request_context->get_top( ).
ls_paging-skip = io_tech_request_context->get_skip( ).

" Calculate the number of max hits to be fetched from the function module
" The lv_max_hits value is a summary of the Top and Skip values
IF ls_paging-top > 0.
lv_max_hits = is_paging-top + is_paging-skip.
ENDIF.

* Maps filter table lines to the Search Help select option table
LOOP AT lt_filter_select_options INTO ls_filter.

CASE ls_filter-property.
WHEN 'DESCRIPTION'. " Equivalent to 'Description' property in the service
lo_filter->convert_select_option(
EXPORTING
is_select_option = ls_filter
IMPORTING
et_select_option = lr_DESCRIPTION ).

LOOP AT lr_DESCRIPTION INTO ls_DESCRIPTION.
ls_selopt-sign = ls_DESCRIPTION-sign.
ls_selopt-option = ls_DESCRIPTION-option.
ls_selopt-low = ls_DESCRIPTION-low.
ls_selopt-high = ls_DESCRIPTION-high.
ls_selopt-shlpfield = 'DESCRIPTION'.
ls_selopt-shlpname = 'EHHSS_ELM_EST_RSK'.
APPEND ls_selopt TO lt_selopt.
CLEAR ls_selopt.
ENDLOOP.
WHEN 'CODE'. " Equivalent to 'Code' property in the service
lo_filter->convert_select_option(
EXPORTING
is_select_option = ls_filter
IMPORTING
et_select_option = lr_CODE ).

LOOP AT lr_CODE INTO ls_CODE.
ls_selopt-sign = ls_CODE-sign.
ls_selopt-option = ls_CODE-option.
ls_selopt-low = ls_CODE-low.
ls_selopt-high = ls_CODE-high.
ls_selopt-shlpfield = 'CODE'.
ls_selopt-shlpname = 'EHHSS_ELM_EST_RSK'.
APPEND ls_selopt TO lt_selopt.
CLEAR ls_selopt.
ENDLOOP.

WHEN OTHERS.
" Log message in the application log

ENDCASE.
ENDLOOP.

*-------------------------------------------------------------
* Map the Search Help returned results to the caller interface - Only mapped attributes
*-------------------------------------------------------------
IF ls_message IS NOT INITIAL.
* Call RFC call exception handling
me->/iwbep/if_sb_dpc_comm_services~rfc_save_log(
EXPORTING
is_return = ls_message
iv_entity_type = iv_entity_name
it_key_tab = it_key_tab ).
ENDIF.

CLEAR et_entityset.

LOOP AT lt_result_list INTO ls_result_list
WHERE record_number > ls_paging-skip.

" Move SH results to GW request responce table
lv_next = sy-tabix + 1. " next loop iteration
CASE ls_result_list-field_name.
WHEN 'CODE'.
ls_entityset-code = ls_result_list-field_value.
WHEN 'DESCRIPTION'.
ls_entityset-description = ls_result_list-field_value.
ENDCASE.

" Check if the next line in the result list is a new record
READ TABLE lt_result_list INTO ls_result_list_next INDEX lv_next.
IF sy-subrc <> 0
OR ls_result_list-record_number <> ls_result_list_next-record_number.
" Save the collected SH result in the GW request table
APPEND ls_entityset TO et_entityset.
CLEAR: ls_result_list_next, ls_entityset.
ENDIF.

ENDLOOP.

endmethod.