2014 Apr 08 1:39 PM
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.
2014 Apr 08 1:49 PM
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?
2014 Apr 08 1:53 PM
Write this , it will work... | MESSAGE 'Currency is not valid, Please Check' TYPE 'E'. |
2014 Apr 08 2:37 PM
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
2014 Apr 08 4:21 PM
You can try event 18 - After checking if data is changed or better 01 - Before save
2014 Apr 10 7:06 AM
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