Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Delete A Sales Order

Former Member
0 Kudos

Hi There,

I have used BAPI_SALESDOCUMENT_CHANGE to change a Sales Order.

I was wondering is there another BAPI that I can use to delete the Sales Order?

Many Thanks,

Colm

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Please check the sample code..


DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA: BAPISDH1X LIKE BAPISDH1X.

PARAMETERS: P_VBELN LIKE VBAK-VBELN.

*SET THE DELETION FLAG 
BAPISDH1X-UPDATEFLAG = 'D'.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = P_VBELN
order_header_inx = BAPISDH1X
tables
return = T_RETURN
.

COMMIT WORK.

Thanks

Naren

6 REPLIES 6

Former Member
0 Kudos

Try 'BAPI_SALESSUPDOCUMENT_DELETE' to delete sales order.

Regards,

Aparna Gaikwad

0 Kudos

This FM appears useful due to its name but there doesn't appear to be any source code in there to do anything.

Do you have an example of how I might use it?

Former Member
0 Kudos

Hi,

Use the same bapi or BAPI_SALESORDER_CHANGE. ...and pass order_header_inx-updateflag = 'D'...

Thanks

Naren

0 Kudos

Thanks Naren,

However when I try to do this I get the following message:

Field header_inx-updateflag is not an input field

Any ideas?

Former Member
0 Kudos

Hi,

Please check the sample code..


DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA: BAPISDH1X LIKE BAPISDH1X.

PARAMETERS: P_VBELN LIKE VBAK-VBELN.

*SET THE DELETION FLAG 
BAPISDH1X-UPDATEFLAG = 'D'.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = P_VBELN
order_header_inx = BAPISDH1X
tables
return = T_RETURN
.

COMMIT WORK.

Thanks

Naren

0 Kudos

Perfect. Many Thanks