Application Development and Automation 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: 
Read only

Delete A Sales Order

Former Member
0 Likes
922

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
Read only

Former Member
0 Likes
853

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

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

6 REPLIES 6
Read only

Former Member
0 Likes
853

Try 'BAPI_SALESSUPDOCUMENT_DELETE' to delete sales order.

Regards,

Aparna Gaikwad

Read only

0 Likes
853

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?

Read only

Former Member
0 Likes
853

Hi,

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

Thanks

Naren

Read only

0 Likes
853

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?

Read only

Former Member
0 Likes
854

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

Read only

0 Likes
853

Perfect. Many Thanks