cancel
Showing results for 
Search instead for 
Did you mean: 

Validation should be processed only by entering or change of the field.

Former Member
0 Kudos

Hi,

I should create validation in FI, which should check whether the entered VAT date takes place in already closed period. If takes place in already closed period than an error message is risen.

I wrote the code shown below. The prerequisite is the vatdate to be different than u201900.00.0000u2019. The call up point is 3.

The validation works fine during the posting of a document, but not for change of a document.

The system checks the validation for each change of the document, nevertheless that this change is not related to the VAT DATE. In this case if an old document, already reported with vat date in closed period, is changed, the system will rise error message.

Is there any possibility to write in the code that this validation should be processed only by entering or change of the vat date?

Thanks in advance!

Stefka

Edited by: Stefka Nasheva on Apr 21, 2010 2:01 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Here is the program:


-----------------------------------------------------------------------------------------------------------------------------------------------------
form UFI1    USING bool_data TYPE gb002_015
             changing b_result.
 data:  zt001b      like t001b,
        monat       like bkpf-monat,
        gjahr       like bkpf-gjahr,
        refer       type i,
        ref1v       type i,
        ref1b       type i,
        ref2v       type i,
        ref2b       type i.

   monat = bkpf-vatdate+4(2).
   gjahr = bkpf-vatdate+0(4).
   select single * from t001b into zt001b
             where bukrs = bkpf-bukrs
             and   mkoar = '+'.
   refer =  gjahr        * 1000 + monat.        "Eingegebener Zeitpunkt
   ref1v =  zt001b-frye1 * 1000 + zt001b-frpe1.    "Intervall Zeitraum 1
   ref1b =  zt001b-toye1 * 1000 + zt001b-tope1.    "Intervall Zeitraum 1
   ref2v =  zt001b-frye2 * 1000 + zt001b-frpe2.    "Intervall Zeitraum 2
   ref2b =  zt001b-toye2 * 1000 + zt001b-tope2.    "Intervall Zeitraum 2

   if not ( refer between ref1v and ref1b or refer between ref2v and
   ref2b ).
     b_result = b_false.
   else.
   LOOP AT bool_data-bseg INTO bseg
        where  koart eq 'K' or koart eq 'D'.
        select single *  from t001b into zt001b
             where bukrs = bkpf-bukrs
             and   mkoar = bseg-koart.
        refer =  gjahr        * 1000 + monat.        "Eingegebener Zeitpunkt
        ref1v =  zt001b-frye1 * 1000 + zt001b-frpe1.    "Intervall Zeitraum 1
        ref1b =  zt001b-toye1 * 1000 + zt001b-tope1.    "Intervall Zeitraum 1
        ref2v =  zt001b-frye2 * 1000 + zt001b-frpe2.    "Intervall Zeitraum 2
        ref2b =  zt001b-toye2 * 1000 + zt001b-tope2.    "Intervall Zeitraum 2

        if not ( refer between ref1v and ref1b or refer between ref2v and ref2b ).
        b_result = b_false.
        else.
        b_result = b_true.
        endif.
        exit.
   endloop.
   endif.
endform.                    "PERIOD_CHECK