Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8894

Detailing Function RV_INVOICE_DOCUMENT_ADD

$
0
0

The main objective of this document is to explain in detail what goes on inside function module RV_INVOICE_DOCUMENT_ADD.

This is one of the most important function modules in SD Billing.

Hopefully this will help you to find out where an issue is being originated.


1. Function RV_INVOICE_DOCUMENT_ADD


When a billing document is saved the system performs function module RV_INVOICE_DOCUMENT_ADD.


docadd.JPG

 

Let's have a look at the important parts of the source code of this function module:

 

LOOP AT xvbrk.                                            ---> Loop at all the billing documents to be updated

    ...

    PERFORM faktura_bearbeiten_ende USING preisfindungsart.  ---> Perform PRICING_COMPLETE

    ...

    CALL FUNCTION 'NUMBER_GET_NEXT'

          EXPORTING

            nr_range_nr             = da_numki

            object                  = 'RV_BELEG'

            ignore_buffer           = no_buffer

          IMPORTING

            returncode              = ld_returncode

            number                  = xvbrk-vbeln         ---> Get the new number from the number range object RV_BELEG

    ...

    CALL FUNCTION 'RV_ACCOUNTING_DOCUMENT_CREATE‘  ---> Release the billing document to accounting

    ...

    CALL FUNCTION 'REBATE_INDEX_BUILD‘                             ---> Update the table VBOX (rebate processing)

    ...

  ENDLOOP.

...

  CALL FUNCTION 'RV_INVOICE_POST' IN UPDATE TASK         ---> This function updates the new/updated document. It is performed in update task, so it cannot be debugged in normal debugging. The information stored in the internal tables XVBR* and YVBR* will be updated in database according to field UPDKZ

...

  CALL FUNCTION 'RV_INVOICE_REFRESH‘                             ---> This function executes the COMMIT in the database

 

 

1.1 Debugging in a productive system

 

Please keep in mind that during invoice creation it is very dangerous to debug function module RV_INVOICE_DOCUMENT_ADD in a productive system.

 

After the execution of the function NUMBER_GET_NEXT, the next number of object RV_BELEG will be used and there is the risk that this number is lost!

This causes a gap in the number range of SD billing (and in FI document if the numbering is the same).

 

It is important to know that gaps in SD billing and in FI document number are not allowed in many countries.


Viewing all articles
Browse latest Browse all 8894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>