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

Screen validations

ak_upadhyay
Contributor
0 Likes
701

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

7 REPLIES 7
Read only

Former Member
0 Likes
679

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

Read only

Former Member
0 Likes
679

Hi,

at selection-screen on value.
if value = 'YES' or  value = 'NO' or value = 'N/A'.
ELSE.
 MESSAGE 'ENTER VAILD VALUE' TYPE 'E'.
ENDIF

Regards,

Balakumar.G

Reward Points if helpful.

Read only

Former Member
0 Likes
679

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.

Read only

Former Member
0 Likes
679

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.

Read only

0 Likes
679

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

Read only

Former Member
0 Likes
679

Try as below:


CONSTANTS: c_yes TYPE char3 VALUE 'YES',   " Global Declaration
           c_no  TYPE char3 VALUE 'NO',
           c_na  TYPE char3 VALUE 'N/A'.
" PAI Event
MODULE pai.

  PERFORM validate.

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.  " Validate
Above example is w.r.t screen, should you be using in a report program check below example as well:
parameters: 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.

Read only

Former Member
0 Likes
679

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.