Application Development and Automation 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: 

getting error while update data through O DATA "status_reason Unsupported Media Type" "status_code 415"

0 Kudos
559

I AM GREETING BELOW ERROR WHILE UPDATING ZTABLE THROUH ODATA.

I AM FOLLOWING BELOW PROCEDURE

1) Execute GET to read single entity /sap/opu/odata/sap/ZUSERINFO_SRV/UserCollection('Test')

2) Click Use as Request button

3) Update your request properties.

4) Select HTTP method as POST

5) Query as /sap/opu/odata/sap/ZUSERINFO_SRV/UserCollection and execute



PLEASE HELP

1 ACCEPTED SOLUTION

0 Kudos
460

Hi Praveer

I have create one ztable and i want to update ztable through Odata but getting attached error screen shot

8 REPLIES 8

ipravir
Active Contributor
0 Kudos
460

Hi Ajay,

While kind of data are you trying to update through oData service.

Regards,

Praveer.

0 Kudos
461

Hi Praveer

I have create one ztable and i want to update ztable through Odata but getting attached error screen shot

0 Kudos
460

Hi Ajay,

Can you share the update code, just wondering how are you updating the information / data and what kind of data consist in your internal table or array when you are passing in odata service / URL.

Regards,

Praveer.

0 Kudos
460

method USERCOLLECTION_UPDATE_ENTITY.   DATA:  ls_request_input_data TYPE zcl_zuserinfo_mpc=>ts_user,         ls_key_tab            TYPE /iwbep/s_mgw_name_value_pair,         lv_userid            TYPE zuserinfo-userid,         ls_userinfo          TYPE zuserinfo. * Get key values   READ TABLE it_key_tab WITH KEY name = 'Userid' INTO ls_key_tab.   lv_userid = ls_key_tab-value.   IF lv_userid IS NOT INITIAL. * Read request data     io_data_provider->read_entry_data( IMPORTING es_data = ls_request_input_data ). * Update fields of table ZUSERINFO     UPDATE zuserinfo SET firstname = ls_request_input_data-firstname                         lastname  = ls_request_input_data-lastname                         email    = ls_request_input_data-email                         phone    = ls_request_input_data-phone                         country  = ls_request_input_data-country                         WHERE userid  = lv_userid.     IF sy-subrc = 0.       er_entity = ls_request_input_data. "Fill exporting parameter ER_ENTITY     ENDIF.   ENDIF. endmethod.

0 Kudos
460

thanks i got the solution myself

0 Kudos
460

What you think? Maybe it would be nice if you shared the solution? After all, you were expecting the community to help you with the issue - why not help the community by sharing what you discovered?

"I got the solution" isn't massively helpful to anyone. In fact it's more frustrating than this scenario:

http://imgs.xkcd.com/comics/wisdom_of_the_ancients.png

0 Kudos
460

Hi Matthew Billingham ,

I am trying to update multiple records that why it throw error.

Update and create Record one by one only. Follow below guide line.

Data  Operation HTTP Method Create POST         Insert

fromRead GET         Select Single * FromintoUpdate PUT/PATCH UpdatesetDelete DELETE         Delete fromQuery GET         Select *  FromInto Table Regards Ajay Singh Bisht

Message was edited by: Matthew Billingham - attempted to make it a bit more clear

0 Kudos
460

Great. Now please mark it as the correct answer for any future searchers.