cancel
Showing results for 
Search instead for 
Did you mean: 

Update(Put) No Response Data

former_member203215
Participant
0 Kudos

I Created a Gateway Service for Read,Create and Update . In Read(Get),Create(Post) I'm getting Response Data But for

Update(Put) I'm not getting any Response data as shown below

Thanks ...

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor

Hello

Successfull update will always shows 204 and no content is retuned.

So u need to raise an exception when ur update fails with the error messages.

When no error are encountered during update and if its success then u can decide update is successful based on 204 status.

U can also set ur custom messages as well like Syam suggested with appropriate success message returned by ur backend logic.

Regards

Ashwin

Answers (4)

Answers (4)

AshwinDutt
Active Contributor
0 Kudos

Hello Ravi,

Please have a look at this :

Regards,

Ashwin

former_member203215
Participant
0 Kudos

Thanks All,

Can anybody please provide me a sample code how to raise an exception from the update method.

sreehari_vpillai
Active Contributor
0 Kudos

Open the UPDATE_ENTITY method in *_DPC class. There you can find the "RAISE EXCEPTION" clause generated by sap. You can follow the same.

Sree

kammaje_cis
Active Contributor
0 Kudos

Sending error messages (with return code 204) for an Update operation in Response Header is a workaround and not really  OData compliant. You need to raise an exception if you need to get error messages as others suggested.

sreehari_vpillai
Active Contributor
0 Kudos

Ravi,


"When processing a PUT request servers return status 204 (No Content) to indicate success, no response body is needed"


Sreehari

former_member203215
Participant
0 Kudos

Thanks for your reply.

But while updating in crm we get return message like email is not provide etc...

so I want to display messsage which returned from function modulee....

SyambabuAllu
Contributor
0 Kudos

Hi Ravi,

If you want to display messages in Update and Delete operations, you can use below code. the messages you can see in response headers.

DATA ls_header  TYPE ihttpnvp.

IF lv_message IS NOT INITIAL.
ls_header
-name = 'STATUS' .
ls_header
-value = lv_message.
/iwbep/if_mgw_conv_srv_runtime
~set_header( ls_header ).
else.
ls_header
-name = 'STATUS' .
ls_header
-value = 'FAIL'."lv_message.
/iwbep/if_mgw_conv_srv_runtime
~set_header( ls_header ).


Thanks

Syam

sreehari_vpillai
Active Contributor
0 Kudos

Raise proper exceptions . Remember, OData is a protocol with defined rules . It does not support return data on success PUT. As a work around, you can manipulate it with POST operation . Wait a minute, do you really want to try that ? NO. Raise exceptions properly

Sree