Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table Entry Validation

jaheer_hussain
Active Contributor
0 Likes
659


Hi,

For table entry validation I have two events.

01  BEF_SAVE

02. AF_CORR.when I change currency I am triggering this event.

   I am checking validation for currency in the second event 02-AF_CORR.If currency does not match ,I am throwing error message,but wrong currency(say example USD) is getting updated in the table.It should not happen as per my expectation.

This is code which I have put in the event 02 AF_CORR. Can some body throw light on this issue please? How to stop wrong currency is getting updated in my Z table. Is there any coding problem?

FORM AF_CORR.

  LOOP AT TOTAL.

 

    SELECT SINGLE * FROM T001K WHERE BWKEY = TOTAL+21(4).


    IF SY-SUBRC EQ 0.


  SELECT SINGLE * FROM T001 WHERE BUKRS = T001K-BUKRS.



      IF TOTAL+70(5) <>  T001-WAERS.

 


        MESSAGE 'Currency is not valid, Please Check' TYPE 'S' DISPLAY LIKE 'E'.


 


        vim_abort_saving = 'X'.



        CLEAR SY-SUBRC.


        EXIT.



      ENDIF.


    ENDIF.


  ENDLOOP.



ENDFORM.

5 REPLIES 5
Read only

Former Member
0 Likes
627

Jaheer, As per SAP documentation the DISPLAY LIKE edition does no impact the behavior determined by the message type, but only the time of display.

So why not try just displaying an error message?

Read only

Former Member
0 Likes
627

Write this , it will work...

MESSAGE 'Currency is not valid, Please Check' TYPE 'E'.
Read only

0 Likes
627

Hi,

I put  MESSAGE 'Currency is not valid, Please Check' TYPE 'E'. in my coding,but still the issue.

which event I have to use for editing particular field(currency)? I am using 08,it is correct?

With Regards,

Jaheer

Read only

0 Likes
627

You can try event 18 - After checking if data is changed or better 01 - Before save

Read only

anubhab
Active Participant
0 Likes
627

Hello Jaheer,

         I'll suggest to use Event 21 along with message type 'E'. Although it's description says Fill hidden fields, it can be used for validation too.

Please let us know, if it works fine in your case or not.

Regards,

Anubhab