SAP Function BAPI_BILLDOC_CANCEL - BAPI for Billing document cancel

Parameter Reference Type Length Default Optional Text
READ_ARCHIVE BAPI_READ_ARCHIVE u 1 SPACE X Read Archived Documents
REVERSAL_DOC BAPI_EXT_REVERSAL_DOC u 30 External Reversal Billing Doc.
REVERSED_DOC BAPI_EXT_REVERSED_DOC u 84 External Billing Doc. to Be Reversed
TESTRUN BAPI_AUX_INV-TESTRUN C 1 SPACE X Activate Simulation Mode

Parameter Reference Type Length Text
NEW_REVERSALDOC BAPI_NEW_REVERSALDOC u 12 New Reversal Billing Doc. Number

Parameter Reference Length Optional Text
EXTENSIONIN BAPIPAREX 990 X ExtensionIn
EXTENSIONOUT BAPIPAREX 990 X ExtensionOut
RETURN BAPIRET2 548 X Returns


You can use this method to reverse a billing document in the GenericContract Accounts Receivable and Payable (FI-CAX) system.
Billing documents that are already processed in FI-CAX can only bereversed but not deleted or deactivated.
A reversal billing document is created during the reversal process.
Actions,,Steps
Viewing a reversed billing document number: ,,Choose REVERSEDDOC andthen choose the field REFDOCNO.
Viewing a reversal billing document number:,,Choose REVERSALDOC and thenchoose the field REFDOCNO.
Billing Reversal
Depending on whether the billing document to be reversed is alreadyinvoiced or not, billing reversal takes place in the following twoscenarios:
  • Reversal of billing document not yet invoiced

  • For those billing documents that have to be reversed, the system createsa new reversal billing document containing a document header. However,the system does not create any new invoicing order, as the billingdocuments which are not yet invoiced already contain invoicing orders
    The system next deletes the invoicing order of the reversed billingdocument. After deletion, the system cannot invoice reversed billingdocuments or reversal billing documents once again.
    • Reversal of billing document already invoiced

    • For those billing documents that have to be reversed, the system createsa new reversal billing document containing a document header anddocument items. The system copies the document item values (amount andquantity) present in the reversed billing document and changes them tonegative values in the new reversal billing document.
      The system next deletes the invoicing order of the reversed billingdocument. After deletion, the system cannot invoice reversed billingdocuments or reversal billing documents once again.
      Enhancement
      You can enhance this BAPI by implementing the following BAdIs withoutany modification:
      • INV_BILL_CANCEL (along with all associated methods)

      • FKKINV_BAPIBILL (along with the method CONTRACT_ACCOUNT_DETERMINE)

      • Note:
        • This function module carries out the following actions:

        • Performs direct updates in a successful case and does not use the updatetask
          Performs a COMMIT WORK for each call
          Does not perform any separate authorization checks
          • With this function module, you cannot carry out the following actions:

          • Reverse simulated billing documents
            Reverse billing documents that have already been reversed again
            Reverse reversal billing documents
            • Reversal billing documents require a unique reference to a document in
            • the legacy system

              Description
              Contains the attributes of the newly-created reversal document.
              Note:
              The field BILLDOCNO contains the number of the reversal document.

              Description
              Ensures that the system can access billing documents to be reversed inthe archives.
              The system first searches for the billing document to be reversed in thedatabase. If no billing document is found in database and if theindicator is selected, the system searches for the document in thearchive.
              Note:
              Accessing the archived billing documents may lead to a longer runtime.

              Description
              Determines the attributes of the reversal document.
              Note:

              • Enter the document number of the reversal document, which is present in
              • the external system, in the field REFDOCNO.
                • You must provide a value for the field DOCTYPE_EXT so that the system
                • can determine the document type of the reversal document (using thevalues in the posting area 2645).
                  If you leave this field blank, the system makes a copy of the documenttype of the document to be reversed

                  Description
                  Identifies the billing document that needs to be reversed.
                  Note:

                  • You must provide values for the fields LOG_SYSTEM and REFDOCNO. These
                  • fields identify the billing document to be reversed with reference tothe source system.
                    • You must provide the contract account number of the document to be
                    • reversed in the field CONT_ACCT.

                      Description
                      If the import parameter TESTRUN is selected, the BAPI does not performany database changes. However, all checks are carried out. Any errorsthat occur are saved in the export table RETURN.

                      Description
                      You can provide the BAPI with additional data by using the import tableEXTENSIONIN. The BAPI does not directly use the table; instead, itforwards the table to the methods of the Business Add-In (BAdI)INV_BILL_CANCEL.

                      Description
                      The BAPI returns additional data to the calling function by using theexport table EXTENSIONOUT. The BAPI does not directly use the exporttable. If you want to make entries to the table, you must implement themethods of the Business Add-In (BAdI) INV_BILL_CANCEL.

                      Description
                      The export table RETURN contains all error log messages. The presence ofone or more messages of type E ("Error") or A ("Abort") in the tableindicates that an error occurred that terminated processing.