Skip to Content
author's profile photo Former Member
Former Member

BADI/Exit for VF04


I did some research on this & could not find the solution so asking in this forum..

We have requirement to do some validation on invoices ( VF01/VF04/VF11) on dates and some other validations. Now i could not find the BADI/Exit which is called just before Save.

So we are using RV60AFZZ ( USEREXIT_NUMBER_RANGE USING US_RANGE_INTERN) to validate the data. This exit is called per Billing ( for each line item) and we loop at XVBRP and validates the dates and other line items..

Since there is no parameter to set the error ( like in some case of BADI we have), what we do is if the error comes, we raise a message via below code

MESSAGE e002(zxxx) WITH lv_frm_prd 'and' lv_to_prd DISPLAY LIKE lc_msgtyp_e. " Billing Date cannot be outside the periods

SET SCREEN syst-dynnr.


This works good for one billing document. However, when we process multiple documents( Via VF04) and if the first document has error, then system stops the whole processing there itself and does not move forward to next ( although next doc is good).

We would like to check each document individually and only raise message for those and keep moving so the batch of VF04 can be completed.

Please advice the strategy and solution for this as it looks like LEAVE SCREEN is stopping the process and without which the wrong document is also getting saved.

Thanks for your time!

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Mar 10, 2017 at 09:02 PM

    TLDR but such questions have been asked on SCN numerous times. SAP does not create any new functionality for this, so whatever is available has already been mentioned on SCN in the last 10 years.

    In general, it's too late for validations when you reach the point of billing. Do the validations in the preceding documents or change the process so that such validations become not needed. There are no BADIs/user exits because it is way too late to check anything at that stage.

    I've seen errors put in the VOFM routines in the copy control (I think) but this is not a good practice either.

    P.S. SAP standard already checks if posting period is open or not. Don't want postings in a period - don't open it. As if VF04 is the only place where postings could happen. Quite silly...

    Add comment
    10|10000 characters needed characters exceeded