cancel
Showing results for 
Search instead for 
Did you mean: 

Check on VF01 for accounting document

moazzam_ali
Active Contributor
0 Kudos

Dear All

In my company we are using automatic posting to FI in billing documents. We can not block posting and release to accounting with VF02 due to certain reasons. Now my problem is this that when we create SD invoice some times system saves SD invoice but due to posting period change / GL not extended for company code / Tax statement missing or any other reason system don't create accounting document but saves SD invoice. I want to restrict the system that due to any possible reason when ever no accounting document is generated system should also not save the SD invoice.

Any suggestions?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi moazzamjii

You would need a modification for this, it cannot be done in the standard.

So you can see how to handle it check this in your system you can do these

steps below and run VF01 to create an invoice

Put a breakpoing at the call to 'RV_ACCOUNTING_DOCUMENT_CREATE'

from function RV_INVOICE_DOCUMENT_ADD below

RV_INVOICE_DOCUMENT_ADD

...

CALL FUNCTION 'RV_ACCOUNTING_DOCUMENT_CREATE' >>>

...

IF sy-msgid = 'VF' AND sy-msgno = '051' AND sy-subrc = 4.

xvbrk-rfbsk = 'B'.

ENDIF.

This is the interface to FI If you execute this in debug (F6) and there is an error

you will see that the system fills the billing staus with 'B' above 'xvbrk-rfbsk '

but of course continues with the save of the billing document generation of the

output etc

If there is no error the posting status is set to 'C' below and you have success

...

IF sy-subrc < 2.

xvbrk-rfbsk = 'C'. >>>

The system will then call AC_DOCUMENT_POST and actually prepare the FI document

for saving before the COMMIT WORK

....

CALL FUNCTION 'AC_DOCUMENT_POST' >>>>

To achieve what you are looking for here you would need to check if the posting to FI

would go through or not and if it does not you would need to exit RV_INVOICE_DOCUMENT_ADD

with your own error message and log. You modification would need to be in and around this.

Hope this helps confirm the system behaviour

Kind regards

Brian

Answers (3)

Answers (3)

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

I'm not sure that you can avoid to create the invoice if FI is lock because the period is opened or closed. Try to do it with an owned copy requirement (VOFM) in copy rules. In this VOFM use the function module 'FI_PERIOD_CHECK' to check if the period is closed or no (use FI_PERIOD_DETERMINE to determine period). Other possibility, is change the date of invoice with a copy rule according with this functions. Use VOFM 011 as a template (include FV60C011).

I hope this helps you

Regards

Eduardo

Lakshmipathi
Active Contributor
0 Kudos

Not sure how far you will be successful even if you implement the exit already suggested. In order to narrow down to the root cause, in the said exit, system should validate the field RFBSK from VBRK while saving in background and if anything other than "C" populates, then that billing document should not get saved.

G. Lakshmipathi

PhaniKalvagunta
Contributor
0 Kudos

Hi,

Please try to meet your requirement using the below exit

USEREXIT_FILL_VBRK_VBRP (Module pool SAPLV60A, program RV60AFZC)

With the check on the date,system will stop saving the invoice.

Regards,

Phani Prasad

Edited by: phani.prasad on Nov 10, 2011 12:17 PM