Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Cancel billing document (VF11)
 For cancelling the billing document pass the billing document number from VBRP table to the function module and use commit.
*---declaration for fun module
   DATA: it_bapireturn1     LIKE bapireturn1     OCCURS 0 WITH HEADER LINE,
         it_bapivbrksuccess LIKE bapivbrksuccess OCCURS 0 WITH HEADER LINE,
         d_bill_doc         LIKE bapivbrksuccess-bill_doc.
 LOOP AT it_vbrp.
     CLEAR d_bill_doc.
     d_bill_doc = it_vbrp-vbeln.
*---cancel billing doc (transaction VF11)
     CALL FUNCTION 'BAPI_BILLINGDOC_CANCEL1'
       EXPORTING
         billingdocument = d_bill_doc
       TABLES
         return          = it_bapireturn1
         success         = it_bapivbrksuccess.
*---commit
       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
         EXPORTING
           wait = 'X'.
     ENDIF.
Endloop.