Skip to Content
-1

How to delete the salesorder items by using odata service

Oct 31, 2016 at 01:23 PM

136

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Venkatesh Ummarrao Nov 02, 2016 at 11:18 AM
0

hi Ryan and Bartosz ,

Problem solved with $batch processing .

Thank you

Share
10 |10000 characters needed characters left characters exceeded
Ryan Crosby Oct 31, 2016 at 01:32 PM
0

Hi Venkatesh,

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

Regards,

Ryan Crosby

Share
10 |10000 characters needed characters left characters exceeded
Venkatesh Ummarrao Oct 31, 2016 at 01:43 PM
0

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

Show 6 Share
10 |10000 characters needed characters left characters exceeded

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

1

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.

0

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

1

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

0

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

capture.png (45.3 kB)
0

I believe you can find the following post quite useful:

Simple steps to perform Batch Operations in SAP Gateway Services

1
Venkatesh Ummarrao Nov 01, 2016 at 01:05 PM
0

Hi Ryan,

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

Regards

venkatesh

Share
10 |10000 characters needed characters left characters exceeded