cancel
Showing results for 
Search instead for 
Did you mean: 

Update entity from oData model

Former Member
0 Kudos

Hi,

I have created a webservice using SAP Netweaver Gateway.

I have implemented the method for updating data: PRODUCT_ENTITY_UPDATE.

When consuming the webservice i am passing following oData in the request

Now, how do I update the data in SAP from this oData model?

I cannot find the data in the parameters of method PRODUCT_ENTITY_UPDATE.

Please advise.

Philippe

Accepted Solutions (1)

Accepted Solutions (1)

ChandraMahajan
Active Contributor

Hi,

For your products collection, you need to redefine method PRODUCTS_UPDATE_ENTITY of your DPC_EXT class.

in this method, you can read the keys passed from URL from method importing parameter IT_KEY_TAB.

Just read the value of "Materialnumber" and write logic to update it.

Regards,

Chandra

Former Member
0 Kudos

Hi,

Table IT_KEY_TAB only contains the key fields that are passed from the URL. In this case the Materialnumber '4'.

But where do I find the values for the non-key fields: description, price, currency and EAN?

I have read some guides like this one on how to CREATE/UPDATE. It does not implement any ABAP logic, as if the data gets saved magically. Or am I missing something?

ChandraMahajan
Active Contributor
0 Kudos

Hi,

you will get all your input as

DATA: ls_request_input_data  TYPE ZCL_GW_SRV_MPC=>TS_PRODUCT. (this is your entity type strcuture)

io_data_provider->read_entry_data( IMPORTING es_data = ls_request_input_data ).


IO_DATA_PROVIDER is importing parameter.


Regards,

Chandra

Former Member
0 Kudos

Thank you so much! Couldn't find this in any guide.

ChandraMahajan
Active Contributor
0 Kudos

No Problem! better approach is always to put breakpoints in these methods and observe the data coming into method parameters. But yes sometime it is not very easy to figure out from objects like in this case IO_DATA_PROVIDER.

Answers (0)