Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Odata get entity set is working but not get entity

jyothsna1234
Explorer
0 Kudos

Hi,

My Odata Services is working for get entityset perfectly and able to use display in the browser or gateway service.

The problem is when I try to use get_entity method where I use the signature of the method.

read table it_key_tab into data(ls_key_tab) with key name = 'Vbeln'.

It shows client error 400.

Why can't I read the table it_key_tab ?

Thanks

Jyothsna

  • SAP Managed Tags:
2 REPLIES 2

Andre_Fischer
Product and Topic Expert
Product and Topic Expert

The use of it_key_tab is outdated since years.

Use the API io_tech_request_context to retrieve the details of the incoming OData request.

Check out the SEGW project /IWBEP/GW_SAMPLEBASIC for more details.

ceterum censeo RAP esse utendam
  • SAP Managed Tags:

jyothsna1234
Explorer
0 Kudos

What prevents from getting the same data which was working in select statement into the et_entityset

but not into er_entity ?

Thank you. I checked the said sample project and copied the following that is relevant to my usage of tables. It didnot solve the problem. Hence I changed it to

METHOD SALESDOCHEADERSE_GET_ENTITY.

* DATA: ls_converted_keys TYPE /iwbep/cl_gwsample_bas_mpc=>ts_salesorder,
* lv_source_entity_set_name TYPE /iwbep/mgw_tech_name.
*
* lv_source_entity_set_name = io_tech_request_context->get_source_entity_set_name( ).
*
* IF lv_source_entity_set_name IS INITIAL.
* io_tech_request_context->get_converted_keys(
* IMPORTING
* es_key_values = ls_converted_keys ).
*
**er_entity = so_get_entity( ls_converted_keys-so_id ).
** ELSE.
** resolve_navigation_path(
** EXPORTING
** io_tech_request_ctx_entity = io_tech_request_context
** IMPORTING
** er_result = er_entity ).
* ENDIF.
DATA(lt_keys) = io_tech_request_context->get_source_keys( ) .
data: ls_key like line of lt_keys.



* read table lt_keys into ls_key with key name = 'Vbeln'. " This is giving error of expected edm.string

* hence

data: ls_vbeln type string value 'Vbeln'.

read table it_keys into ls_key with key name = ls_vbeln.
if Sy-subrc eq 0.
select single * from vbak into er_entity
where vbeln = ls_key-value.
endif.

ENDMETHOD.

Still the same 404 error.

  • SAP Managed Tags: