cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete the salesorder items by using odata service

Former Member

Dear Experts,

i developed a Gateway service which creates salesorder with multiple items, thats working fine. Now i need to delete the selected items of the salesorder. For this how can i proceed now?? i didn't worked on DELETE operation in the service. Can anybody give me your suggestions to resolve this problem!

Thankyou

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Ryan and Bartosz ,

Problem solved with $batch processing .

Thank you

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ryan,

Thank you, i started working on $batch Option, get back to you.

Regards

venkatesh

Former Member
0 Kudos

hi Ryan,

Thanks for your response i am not asking the BAPI, i am asking the procedure how to develop a gateway service which can deletes the multiple items data of the sales order.

Thankyou

Ryan-Crosby
Active Contributor

Hi Venkatesh,

Your question is too vague for me to know what exactly you need help with - a service for deleting order items would likely have a SalesOrderItem entity and then the entity would be mapped to the BAPI I mentioned in SEGW for the delete operation. Then in your application you simply call your oDataModel.remove() with the necessary information to trigger the appropriate handling on the back end.

Regards,

Ryan Crosby

Former Member
0 Kudos

Hi Ryan,

Thank you for your response i already did what you suggesting. i mapped 'BAPI_SALESORDER_CHANGE' and it is successfully deeleting the item of salesorder.

my URL ::

/sap/opu/odata/SAP/YSAMPLE_SRV/SalesOrderItemCollection(Salesdocumentin='0051021027',ItmNumber='000010')

Suppose my salesorder '0051021027' contain multiple items and i want delete selected items from the order how can i proceed.

Ryan-Crosby
Active Contributor

HI Venkatesh,

If you want to delete multiple items from the order then you need to use batch processing to handle that in one request. You would override the implementation of the 'CHANGESET_BEGIN' and 'CHANGESET_END' methods of the DPC_EXT class. The begin method would have your preparatory work for the BAPI call if any is required and then the end method would execute your BAPI. I have used it several times for some prototype work on UI5 and it works like a charm.

Regards,

Ryan Crosby

Former Member
0 Kudos

Hi Ryan,

Thank you for your suggestion, i didn't use '$batch' method before. Can you please provide the sample code to use the $batch method in this scenario.

Regards

Venkatesh

Ryan-Crosby
Active Contributor
0 Kudos

Hi Venkatesh,

If you use sap.ui.model.odata.v2.oDataModel then it is setup to do batch processing by default. All you have to do is implement those methods and you'd want to override the default handling of the DELETE operation for SalesOrderItem so you can collect them up into a table or something.

Regards,

Ryan Crosby

ziolkowskib
Active Contributor

I believe you can find the following post quite useful:

Simple steps to perform Batch Operations in SAP Gateway Services

Ryan-Crosby
Active Contributor
0 Kudos

Hi Venkatesh,

'BAPI_SALESORDER_CHANGE' will allow you to remove items from an order.

Regards,

Ryan Crosby