I have created an OData service and implemented the get_entityset and get_entity method. The get_entityset is working fine but the get_entity method throws a 404 error. Below is the code for the get_entity method and the DB table has 6 fields as seen in the code. Also, find the error screenshot in gateway client.error.png
I have used this link as a reference.
METHOD headerset_get_entity.
DATA: ls_key_tab TYPE /iwbep/s_mgw_name_value_pair,
lv_tor_id TYPE zpayment_header-tor_id,
ls_header TYPE zpayment_header.
READ TABLE it_key_tab WITH KEY name = 'TOR_ID' INTO ls_key_tab.
lv_tor_id = ls_key_tab-value.
SELECT SINGLE * FROM zpayment_header INTO ls_header WHERE tor_id = lv_tor_id.
IF sy-subrc = 0.
er_entity-tor_id = ls_header-tor_id.
er_entity-source = ls_header-source.
er_entity-destination = ls_header-destination.
er_entity-dept_date_time = ls_header-dept_date_time.
er_entity-amount = ls_header-amount.
er_entity-status = ls_header-status.
ENDIF.
ENDMETHOD.