cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI to delete sales order

NitinMahajan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Can I delete my sales order using a BAPI. I know it is possible using the screen transaction.

But I need to do it using a BAPI ?

Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

use 'BAPI_SALESORDER_DELETE'

and

Set UPDATEFLAG in ORDER_HEADER_INX.

Possible UPDATEFLAGS:

U = change

D = delete

I = add

PARAMETERS: p_vbeln  TYPE vbap-vbeln OBLIGATORY.

DATA:  i_hdrx TYPE bapisdh1x.

i_hdrx-updateflag = 'D'.

  CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

    EXPORTING

      salesdocument     = p_vbeln

      order_header_inx  = i_hdrx

    TABLES

      return            = i_ret.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

  LOOP AT i_ret.

    WRITE / i_ret-message.

  ENDLOOP.



After dont forget to use bapi


Use BAPI_TRANSACTION_COMMIT after you use BAPI_SALESORDER_CHANGE.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

      EXPORTING

        wait = 'X'.

rmazzali
Active Contributor
0 Kudos

I'm not sure for this: try BAPI_SALESSUPDOCUMENT_DELETE.

pls. reward if helpful

regards

Roberto

NitinMahajan
Product and Topic Expert
Product and Topic Expert
0 Kudos

this bapi does not have any code in it. Just an abstract bapi.