Delete an Entity using SAP OData

Delete operation is used when you want to remove a record from the database. For example, you have created one quotation and now you no longer want it. So you will delete the quotation using the DELETE request.

This article describes the step-by-step procedure to implement and test delete operation in SAP OData.

Context

Delete entity can be implemented by redefining the DELETE_ENTITY method.

Procedure

  1. Open *DPC_EXT class artifact of OData and redefine *DELETE_ENTITY method.
  2. Reimplement the delete method.
    Delete an Entity using SAP OData
    IT_KEY_TAB holds the values from the frontend.
  3. Activate the class and register the service.
  4. Execute and test the OData.
    1. Select Entity set
    2. Select DELETE option
    3. Add the key value to be deleted in the request URL
    4. Execute the request
      Delete an Entity using SAP OData Testing
    5. Status 204 represents success.
    6. Verify in the table the record is successfully deleted.

 

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.