Debugging tips – How to find the root cause of error message VF208 when cancelling an invoice ?
Which cancellation procedure is performed
As of Release 4.6 the R/3 System contains a new reversal function, which automatically clears the accounting documents for the source billing document and the reversal billing document in FI. If the new cancellation procedure fails, the old reversal function is used as a default and an automatic clearing is not performed.
Error VF208
The error message is displayed during the release of a cancellation invoice to accounting. Since Note 188538 has been implemented the error message VF208 (“Automatic clearing of billing document &1 and canc. doc. &2 not poss.”) is displayed in SD in such a case but the user is not informed why the new reversal cannot be used in that particular case.
The error message itself does not explain the root cause of the problem. It only provides information about the fact, that the automatic clearing of billing document and cancellation document failed.
Therefore, you have to find out at first, why the automatic clearing is disabled and what kind of error message triggers VF208.
Debugging
When the system checks whether the reversal function can be performed, it processes the function modules of all participating components.
The fact that the automatic clearing cannot be performed is probably due to one of the participating components.
When the system tries to release the cancellation invoice to accounting the following program is called:
Source code of LV60BU01
FUNCTION RV_ACCOUNTING_DOCUMENT_CREATE
…
call function ‘AC_DOCUMENT_REVERSE’ <<< BREAKPOINT
EXPORTING
i_accrev = loc_accrev
i_comp = i_comp
EXCEPTIONS
reverse_impossible = 1
error_message = 2
others = 3.
…
If the program quits with sy-subrc = 0 the billing documents are automatically cleared.
However, if sy-subrc = 1, then the automatic clearing of billing documents is not possible and the error message VF208 is displayed.
Therefore it is necessary to find out, why did function AC_DOCUMENT_REVERSE return with sy-subrc = 1 (reverse_impossible).
…
if sy-subrc eq 1 or sy-subrc = 3. <<< BREAKPOINT
if check eq con_x.
message id ‘VF’ type ‘I’ number ‘208’
with vbrk-sfakn vbrk-vbeln.
else.
o_new_cancel_fail = ‘X’.
endif.
endif.
…
To get to know which error stands behind VF208, the easiest way is to set a breakpoint in function AC_DOCUMENT_REVERSE in FORM routine CALL_DISPATCHER_STORNO_P.
Source code of LRWCLF10
FORM CALL_DISPATCHER_STORNO_P
…
CALL FUNCTION lt_trwpr-function <<< BREAKPOINT
CHANGING
i_accrev = r_accrev
EXCEPTIONS
reverse_impossible = 1
error_message = 2.
IF NOT sy-subrc IS INITIAL. <<< BREAKPOINT (check SY-MSGID, SY-MSGNO)
…
The variable LT_TRWPR-FUNCTION is used for the (dynamic) call of the individual function modules.
The content of field LT_TRWPR-FUNCTION is the name of the function module where the exception REVERSE_IMPOSSIBLE occurs.
If the automatic clearing is not possible, the indicator REVERSE_IMPOSSIBLE = 1 is set. At the second breakpoint it is recommended to check the content of fields SY-MSGID and SY-MSGNO that shows the error message.
The list of possible root causes is contained in note 309208.
Important Notes
1259505 – FAQ: New cancellation procedure in SD
309208 – Negative posting not performed
339928 – New cancellation procedure cannot be deactivated
—————————————————————————————————————————————————–
Example
When releasing the cancellation billing document 95035129 to accounting the error message is shown:
Automatic clearing of billing document 95035126 and canc. doc. 95035129 not poss.
Message no. VF208
Source code of LV60BU01
FUNCTION RV_ACCOUNTING_DOCUMENT_CREATE
…
call function ‘AC_DOCUMENT_REVERSE’
EXPORTING
i_accrev = loc_accrev
i_comp = i_comp
EXCEPTIONS
reverse_impossible = 1
error_message = 2
others = 3.
…
if sy-subrc eq 1 or sy-subrc = 3.
if check eq con_x.
message id ‘VF’ type ‘I’ number ‘208’
with vbrk-sfakn vbrk-vbeln.
else.
o_new_cancel_fail = ‘X’.
endif.
endif.
…
sy-subrc 1
vbrk-sfakn 0095035126
vbrk-vbeln 0095035129
sy-msgno 208
sy-msgid VF
sy-subrc = 1 so the new reversal function is not possible and error VF208 is given.
The variable LT_TRWPR-FUNCTION contains the function FI_DOCUMENT_CHECK_REV where an error occurs.
The error message is F5802
Source code of LRWCLF10
FORM CALL_DISPATCHER_STORNO_P
…
CALL FUNCTION lt_trwpr-function
CHANGING
i_accrev = r_accrev
EXCEPTIONS
reverse_impossible = 1
error_message = 2.
IF NOT sy-subrc IS INITIAL.
…
lt_trwpr-function FI_DOCUMENT_CHECK_REV
sy-subrc 1
sy-msgid F5
sy-msgno 802
After restarting the debugger the reason of F5802 can be found. The new cancellation procedure cannot be carried out for the billing document because it has at least one cleared item. When cancelling a billing document, in Form CHECK_CLEARING of function module FI_DOCUMENT_CHECK_REV a check will be carried out, if one of the items were already cleared:
Source code of LFACIF70
FORM CHECK_CLEARING
…
LOOP AT xbseg WHERE ( augbl NE space OR xpypr NE space ) “n1122483
* ALE: document is cleared in the sending application
AND augbl(4) NE ‘ALE-‘
* document with cleared credit card items from SD
* check open gl items on payment card clearing account note 0428955
AND ( rfzei EQ space OR “note 0428955
rfzei NE space AND “note 0428955
koart EQ char_s ). “note 0428955
EXIT.
ENDLOOP.
ENDIF. ” note 326707
* Beleg enthält ausgeglichene Positionen und kann nicht storniert werde
IF sy-subrc IS INITIAL AND xbseg-augbl NE space. “note 1122483
MESSAGE e802 WITH xbseg-belnr xbseg-bukrs xbseg-gjahr “note1067969
RAISING reverse_impossible.
…
sy-subrc 0
xbseg-augbl 0001700126
xbseg-belnr 8500008637
sy-msgno 802
sy-msgid F5
The accounting document 8500008637 was already cleared. The clearing document is 1700126, that is why the automatic clearing is not possible.
This situation is listed in SAP Note 309208 (part FI):
– The FI follow-on document of the SD document to be cancelled already contains cleared document items.
Thanks for the Explicit Document.
Very helpful for consulting.
Thanks for sharing.
Hi Csaba,
Great document indeed!!!
Regards
SD