Skip to Content
Author's profile photo Suprio Chatterjee

DELETE Operation:Return message after Deletion

It is sometimes required  to delete an existing Document in SAP  from backend based upon http request from SAP Netweaver Gateway and return success or failure message.

DELETE operation  in SAP Netweaver Gateway doesn’t have provision to return message in body unlike READ.

Therefore the success or failure message after deletion will be returned through header of HTTP response of the URL.


Go to Tcode: SEGW and execute the following steps,

P1.png

Create Entity Z_XYZ importing  RFC  ZFMDEMO developed in ECC to delete document from SAP Backend.

P1.png


Enable DELETE operation in  Service Implementation part for Entity Set Z_XYZSET  using  parameters of RFC  ZFMDEMO


P3.png


Generate the Service with runtime artifacts and Redefine the Delete_Entity method as,


P4.png


Add the below custom code in the above method to return messages  in the header of http response  invoked by DELETE operation,


P1.png


Test the Service,

Execute the URI  in gateway client as,


P5.png


The highlighted box in the above figure shows a new entry with name ‘message into the response header and the corresponding message content is displayed.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.