Updating the document flow
The total quantity to be billed is transferred to the sequential data record. Quantities which have already been billed are managed within the SAP system. This process is influenced by user exits. User exits directly influence the update of compressed document flow VBAPF in the system. This document flow accumulates quantities which have already been billed and compares them to new billing quantities. A new billing document is then created with the following quantity:
Quantity to be billed = New quantity - quantity already billed
Using user exits, you can specify the keys to which records of the compressed document flow are to be stored.
The following user exits have been designed for the general billing interface:
User exit |
Description |
Table VBAPFZZ |
Used for adding customer-specific key fields to table VBAPF |
Report RV45PFZZ |
Used for adding customer-specific key fields from VBRK to internal work table FXVBAPF |
Report RV60AFZA |
Used for adding values in customer-specific key fields from interface structure XKOMFKGN or from cancellation VBRK in field list XVBAPF_KEY. |
Following is an example of how user exits are used in the SAP IS-H:
An interim settlement for 10 days (KWMENGE) is created for patient account 4711 (VBELN) on June 30. In this case, the invoice is paid by various payers.
The payer ‘AOK Insurance’ agrees to pay 30% (=3 days) while patient 122 assumes the role of a second payer and pays the rest, 70% (=7 days). The following billing documents are created:
On July 30, a complete settlement is prepared for a total patient stay of 20 days.
Without using user exits
During the program run, a record is created in compressed document flow (VBAPF) with the cumulative quantity already billed from the interim settlement (=10 days).
In the final settlement, payer ‘AOK Insurance’ is billed for a total of 6 days (30% of 20 days). The compressed document flow (VBAPF) shows 10 days as already having been billed: the document flow without payer as key field cannot process percentage divisions.
A new billing document 3 is created for payer ‘AOK Insurance’ with a billing quantity of -4:
Quantity to be billed = Quantity to be billed from KOMFKGN - quantity already billed
6 days - 10 days = 4 days
Using user exits
For a correct result in this case, the payer must be taken into account in document flow (VBAPF) for quantities which have already been billed. This can be accomplished by making the appropriate settings for these user exits:
Transaction |
Configuration |
Table VBAPFZZ: |
|
® SE11 |
Object name: table VBAPFZZ |
Delete available fields | |
Add field name KUNRG with data element KUNRG | |
Report RV45PFZZ |
FORM USEREXIT_FXVBAPF_KEY. |
® SE38 |
MOVE VBRK_KUNRG TO FXVBAPF-KUNRG. |
ENDFORM. | |
Report RV60AFZA |
FORM USEREXIT_XVBAPF_KEY. |
® SE38 |
MOVE XKOMFKGN-KUNRG TO XVBAPF_KEY-KUNRG. |
ENDFORM. | |
FORM USEREXIT_XVBAPF_KEY_CANC. | |
MOVE * VBRK-KUNRG TO XVBAPF_KEY-KUNRG. | |
ENDFORM. |
During the program run, two records are created in the compressed document flow with the cumulative quantity already billed from the interim settlement (=10 days).
In the final settlement, payer ‘AOK Insurance’ is billed for a total of 6 days (30% of 20 days). The compressed document flow (VBAPF) shows 3 days as already having been billed due to the setting for payer (KUNRG) in the user exits. A new billing document 4 is created for payer ‘AOK Insurance’ with a billing quantity of 3:
Quantity to be billed = Quantity to be billed from KOMFKGN - quantity already billed from VBAPF
that means 6 days -3 days = 3 days
Adding new partner functions
You can define new partner functions for those existing in the standard (sold-to party, ship-to party, bill-to party, payer).
Copy new partner function ‘representative number’ from the interface.
Use Report RV60AFZA as a user exit:
FORM USEREXIT_AVBPAK_ADD.
MOVE "VE" TO AVBPAK-PARVW.
IF NOT XKOMFKGN-VRTNR IS INITIAL.
AVBPAK-PERNR=XKOMFKGN-VRTRNR.
ENDIF.
APPEND AVBPAK.
It is not yet possible to use user exits for document flow update with new partner functions.
See also:
The topic on updating the document flow in
Working with User Exits.Deviating CpD address data
In order to process deviating CpD address data in different partner functions using the general billing interface, you must modify the INCLUDE structure KOMFKZZ according to table structure KOMFKGN as well as the user exit USEREXIT_AVBPAK_CPD (Report RV60AFZB).
There are, however, several limitations:
Another example:
* CpD fields
WA_KOMFKGN-CPD_PARVW1 |
= |
‘AG’ |
WA_KOMFKGN-CPD_PARVW2 |
= |
‘RE’ |
WA_KOMFKGN-CPD-ANRED |
= |
‘Mr.’ |
WA_KOMFKGN-NAME1 (length 30) |
= |
‘FIRST_CPD_NAME’ |
WA_KOMFKGN-LAND1 |
= |
‘US’ |
WA_KOMFKGN-PSTLZ |
= |
‘99999’ |
WA_KOMFKGN-ORT01 |
= |
‘New York’ |
* Different address - Ship-to party (CpD customer)
WA_KOMFKGN-WE_PARVW |
= |
‘WE’ |
WA-KOMFKGN-WE_ANRED |
= |
‘Ms.’ |
WA_KOMFKGN-WE_NAME1 (length 30) |
= |
SECOND_CPD_NAME |
WA-KOMFKGN-WE_LAND1 |
= |
‘US’ |
WA_KOMFKGN-WE_PSTLZ |
= |
‘9999’ |
WA_KOMFKGN-WE_ORT01 |
= |
‘Boston’ |
TRANSFER WA_KOMFKGN TO DS_NAME1....
Partner functions in the billing document would appear as follows:
Billing document FX
Partner function |
Partner |
Name | |
SP |
Sold-to party |
ODL-CPD |
FIRST_CPD_NAME |
BP |
Bill-to party |
ODL |
FIRST_CPD_NAME |
PY |
Payer |
ODL |
Address in customer master |
SH |
Ship-to party |
ODL-CPD |
SECOND_CPD_NAME |
To add a different CpD address for all partners other than the sold-to party, change the user exit.
Another example:
The sold-to party is a CpD customer
The CpD address is valid for the sold-to party
A different CpD address is valid for all other partners
Sample report RVAFSS01 which creates the sequential file would then contain the following coding:
* CpD fields
WA_KOMFKGN-CPD_PARVW1 |
= |
‘SP’ |
WA_KOMFKGN-CPD_ANRED |
= |
‘Mr.’ |
WA_KOMFKGN-NAME1 (length 30) |
= |
‘FIRST_CPD_NAME’ |
WA_KOMFKGN-LAND1 |
= |
‘US’ |
WA_KOMFKGN-PSTLZ |
= |
‘99999’ |
WA_KOMFKGN-ORT01 |
= |
‘New York’ |
* Different address - Ship-to party (CpD customer)
WA_KOMFKGN-WE_PARVW |
= |
‘XX’ (e.g. ‘BP’, ‘SH’, etc.) |
WA-KOMFKGN-WE_ANRED |
= |
‘Ms.’ |
WA_KOMFKGN-WE_NAME1 (length 30) |
= |
‘SECOND_CPD_NAME’ |
WA-KOMFKGN-WE_LAND1 |
= |
‘CH’ |
WA_KOMFKGN-WE_PSTLZ |
= |
‘9999’ |
WA_KOMFKGN-WE_ORT01 |
= |
‘Basel’ |
TRANSFER WA_KOMFKGN TO DS_NAME1.
Partner functions in the billing document would appear as follows:
Billing document FX
Partner function |
Partner |
Name | |
SP |
Sold-to party |
ODL-CPD |
FIRST_CPD_NAME |
BP |
Bill-to party |
ODL |
SECOND_CPD_NAME |
PY |
Payer |
ODL |
SECOND_CPD_NAME |
SH |
Ship-to party |
ODL-CPD |
SECOND_CPD_NAME |
User exit RV60AFZB appears as follows (changes can be identified by an ‘*’ at the beginning of the line):
FORM USEREXIT_AVBPAK_CPD.
IF XKOMFKGN-WE_PARVW NE SPACE.
LOOP AT AVBPAK.
LOOP AT AVBPAK WHERE PARVW EQ XKOMFKGN-WE_PARVW.
MOVE '00000000'TO AVBPAK-ADRNR.
MOVE AVBPAK-PARVWTO AVBPAK-ADRNR(2).
*MOVE XKOMFKGN-WE_PARVWTO AVBPAK-ADRNR(2).
MOVE 'B' TO AVBPAK-ADRDA.
MOVE 'X' TO AVBPAK-XCPDK.
MODIFY AVBPAK.
*ENDLOOP.
CLEAR XVBADR.
MOVE '0000000'TO XVBADR-ADRNR.
MOVE AVBPAK-PARVWTO XVBADR-ADRNR(2).
MOVE XKOMFKGN-WE_PARVWTO XVBADR-ADRNR(2).
MOVE XKOMFKGN-WE_ANREDTO XVBADR-ANRED.
MOVE XKOMFKGN-WE_NAME1TO XVBADR-NAME1.
MOVE XKOMFKGN-WE_PSTLZTO XVBADR-PSTLZ.
MOVE XKOMFKGN-WE_ORT01TO XVBADR-ORT01.
MOVE XKOMFKGN-WE_LAND1TO XVBADR-LAND1.
APPEND XVBADR.
* Fehlerprotokoll (Error log)
*
PERFORM GN_CPD_CHECK USINGSY-SUBRC
XKOMFKGN-WE_LAND1
*XKOMFKGN-WE_NAME1
*XKOMFKGN-WE_PSTLZ
*XKOMFKGN-WE_ORT01.
*
*IF SY-SUBRC NE 0.
EXIT.
ENDIF.
ENDLOOP.
*
ENDIF.
ENDFORM.