Hi all,
I have two non key checkboxes in table (of type XFELD) say control 1 and control2.
In table maintenance I have to validate that control 2 is checked only if control1 is checked i.e if control2 is checked without checking control2.
I have coded following lines in BeforeSave event:
LOOP AT extract.
MOVE extract TO zam_test1.
IF zam_test1-control2 EQ 'X'.
IF zam_test1-control1 NE 'X'.
DELETE extract.
MESSAGE e999 (/dceur/zais_msg) WITH 'error'.
ENDIF.
ENDIF.
ENDLOOP.
In this code if i give error message it is coming out to initial screen of SM30, if i am giving info message then it's saving the entries.
Please suggest me right event if above logic is correct or correct way of doing it.
Thanks in Advance,
Akash Modi
Hyderabad
Hi Akash,
try an info message in combination sy-subrc <> 0.
Best regards Erik
Hi Akash,
Here is how you should modify your code.
LOOP AT extract. MOVE extract TO zam_test1. IF zam_test1-control2 EQ 'X' AND. zam_test1-control1 NE 'X'. *-- Do not delete the record, let the user correct it * Just issue an message type 'S' and set the subrc to * a non-zero value sy-subrc = 4. MESSAGE s999 (/dceur/zais_msg) WITH 'error'. ENDIF. ENDLOOP.
If this helps, please don't forget the points.
Regards,
Srinivas
Add a comment