‎2008 Mar 26 3:13 AM
Hi,
I am working on screens. there a some input fields
in which user can enter only YES, NO or N/A value,
now my requirement is that if user enters any other
value except YES, NO or N/A than system should throw
the message 'Please Enter Only YES, NO or N/A'.
It's urgent.
Thanks
AK
‎2008 Mar 26 3:17 AM
Hi,
Parameters : field(10).
at selection-screen on output.
if field ne 'YES' OR FIELD ne 'NO' OR FIELD ne 'N/A'.
**fLASH ERROR MESSAGE HERE
ENDIF.Regards,
V.Balaji
Edited by: Balaji V on Mar 26, 2008 4:20 AM
Edited by: Balaji V on Mar 26, 2008 4:20 AM
‎2008 Mar 26 3:18 AM
Hi,
at selection-screen on value.
if value = 'YES' or value = 'NO' or value = 'N/A'.
ELSE.
MESSAGE 'ENTER VAILD VALUE' TYPE 'E'.
ENDIFRegards,
Balakumar.G
Reward Points if helpful.
‎2008 Mar 26 3:20 AM
Hi
You have to Validate the screen by using this code in At selection screen on field <fieldname>.
The code is
if <fieldname> ne 'YES' or <fieldname> ne 'NO' or <fieldname> ne 'N/A'.
message 'Please Enter Only YES, NO or N/A' type E.
endif.
‎2008 Mar 26 3:22 AM
Hi AK,
There are few ways you can achieve this ...
1. If you have a data element assigned to the field .. then you can have a value table / fixed value for that data element associated to the field ...
2. If it is a selection screen .. you can put the following condition in "At SELECTION-SCREEN output " event
" if value = 'yes' or value = 'no' or value = 'N/A'
else .
message 'Error'.
endif. "
3. If it is a screen .. then you can have your conidition in PBO Module ... between Chain and Endchain statments ....
Hope this helps a bit ..
Reward if useful.
Cheers
Kripa Rangachari.
‎2008 Mar 26 3:27 AM
Hi Kripa, Just to correct you. This can be done in the PAI, but not in the PBO.
And more over you can not use Chain Endchain in the PBO module.
Hi AK, As said by others u can just validate the field using IF statement. You can do it in module PAI between chain endchain giving the screen field name(s) you wnted.
CHAIN.
FIELD : SCREEN_FIELDNAME.
MODULE validate_input. " in this moduel u can write the IF statement
ENDCHAIN.Regards
Gopi
‎2008 Mar 26 3:25 AM
Try as below:
" PAI Event
CONSTANTS: c_yes TYPE char3 VALUE 'YES', " Global Declaration
c_no TYPE char3 VALUE 'NO',
c_na TYPE char3 VALUE 'N/A'.MODULE pai.
PERFORM validate.
Above example is w.r.t screen, should you be using in a report program check below example as well:
FORM validate.
IF NOT p_text EQ c_yes OR " Considering P_TEXT is screen field
NOT p_text EQ c_no OR
NOT p_text EQ n_na.
MESSAGE e001(00) WITH 'Please Enter Only YES, NO or N/A'.
ENDIF.
ENDFORM. " Validateparameters: p_text type char3 obligatory.
CONSTANTS: c_yes TYPE char3 VALUE 'YES',
c_no TYPE char3 VALUE 'NO',
c_na TYPE char3 VALUE 'N/A'.
at selection-screen.
IF NOT p_text EQ c_yes AND
NOT p_text EQ c_no AND
NOT p_text EQ c_na.
MESSAGE e001(00) WITH 'Please Enter Only YES, NO or N/A'.
ENDIF.
‎2008 Mar 26 3:35 AM
Hi use the code,
tables : mara.
Ranges : text for mara-ZEIAR.
Initialization.
text-sign = 'I'.
text-option = 'EQ'.
text-low = 'YES'.
append text. clear text.
text-sign = 'I'.
text-option = 'EQ'.
text-low = 'NO'.
append text. clear text.
text-sign = 'I'.
text-option = 'EQ'.
text-low = 'N/A'.
append text. clear text.
if field1 not in text.
message 'Please Enter Only YES, NO or N/A' type 'S'.
endif.
if field2 not in text.
message 'Please Enter Only YES, NO or N/A' type 'S'.
endif.
if field3 not in text.
message 'Please Enter Only YES, NO or N/A' type 'S'.
endif.
Regards,
Sankar.