‎2009 Apr 17 4:54 AM
Hi Friends,
I have four input fields,I want to restrict the user from entering in more than one field.If it is so i have to give error message while saving saying that he should not enter in more than one field.
How to achieve this.....
Thanks in advance.
‎2009 Apr 17 5:04 AM
Hi,
You can achieve this with foloowing:
PARAMETERS: p_a TYPE c,
p_b TYPE c,
p_c TYPE c,
p_d TYPE c.
DATA : flag TYPE i VALUE 0.
AT SELECTION-SCREEN.
IF p_a IS NOT INITIAL.
flag = flag + 1.
ENDIF.
IF p_b IS NOT INITIAL.
flag = flag + 1.
ENDIF.
IF p_c IS NOT INITIAL.
flag = flag + 1.
ENDIF.
IF p_d IS NOT INITIAL.
flag = flag + 1.
ENDIF.
IF flag > 1.
MESSAGE e000(00) WITH 'No input in more than 1 fields'.
ENDIF.
Regards,
Mansi.
‎2009 Apr 17 5:00 AM
you will use at selection screen event
at selection- screen.
if not p_1 is initial.
if not p_2 is initial or if not p_3 is initial or if not p_4 is initial.
error message...
endif.
endif.
if not p_2 is initial.
if not p_1 is initial or if not p_3 is initial or if not p_4 is initial.
error message...
endif.
endif.
,,,,,,
,,,,,
‎2009 Apr 17 5:04 AM
Hi,
You can achieve this with foloowing:
PARAMETERS: p_a TYPE c,
p_b TYPE c,
p_c TYPE c,
p_d TYPE c.
DATA : flag TYPE i VALUE 0.
AT SELECTION-SCREEN.
IF p_a IS NOT INITIAL.
flag = flag + 1.
ENDIF.
IF p_b IS NOT INITIAL.
flag = flag + 1.
ENDIF.
IF p_c IS NOT INITIAL.
flag = flag + 1.
ENDIF.
IF p_d IS NOT INITIAL.
flag = flag + 1.
ENDIF.
IF flag > 1.
MESSAGE e000(00) WITH 'No input in more than 1 fields'.
ENDIF.
Regards,
Mansi.
‎2009 Apr 17 5:09 AM
You can also check for each selection field that it is filled or not??
If more than one is NOT INITIAL. Give the error message.
‎2009 Apr 17 5:15 AM
hi,
PARAMETERS: p_a TYPE c,
p_b TYPE c.
AT SELECTION-SCREEN.
IF SY-UCOMM = 'SAVE'.
CLEAR FLAG. "OTHER WISE FOR EVERY INPUT GET INCREMENT
IF p_a IS NOT INITIAL.
flag = flag + 1.
ENDIF.
IF p_b IS NOT INITIAL.
flag = flag + 1.
ENDIF.
IF flag > 1.
MESSAGE e000(00) WITH 'No input in more than 1 fields'.
ENDIF.
ENDIF.
‎2009 Apr 17 5:20 AM
Hi ,
In AT SELECTION-SCREEN event.
if p1_a is not initial.
and if p1_b is not initial and if p1_c is not initial and ....
dispaly the error message
MESSAGE 'You have entered more than one text box. Enter only one' TYPE 'E'.
Check the rest of the text boxes also
Hope it helps
‎2009 Apr 17 5:25 AM
‎2009 Apr 17 5:27 AM
hi,
there two ways one is after enter one value u can disable the other fields ..
or else u can check each field in AT selection-screen event ..
and u can give proper message.