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

select-option field leveln validation

Former Member
0 Likes
1,286

Hi folks.

can you please tell me how to do a select-option field leveln validation, i know how to do incase the filed is defined as parameter. here my field is defined as select-option.

SELECT-OPTIONS: C_CTLPC FOR KNKK-CTLPC.

here i need to check for both low, high intervals?

please help me, thanks in advance.

regards

priya

Hi folks.

can you please tell me how to do a select-option field leveln validation, i know how to do incase the filed is defined as parameter. here my field is defined as select-option.

SELECT-OPTIONS: C_CTLPC FOR KNKK-CTLPC.

here i need to check for both low, high intervals?

please help me, thanks in advance.

regards

priya

11 REPLIES 11
Read only

Former Member
0 Likes
1,242

Hi priya,

1. one way is u can do like this

If c_ctlpc-low = 'xyz'.

If c_ctlpc-high = 'xyz'.

regards,

amit m.

Read only

madan_ullasa
Contributor
0 Likes
1,242

hi,

try this..

at selection-screen on fld_name.

if fld_name-low is initial.

message.

endif.

if fld_name-high is initial.

message.

endif.

reward if useful..

regards,

Madan..

Read only

0 Likes
1,242

Hi..

Thanks for your reply , my req is

select-options C_CTLPC FOR KNKK-CTLPC.

here the field may contain values from '01' to '11'.

but incase the user mistaken passed the vlues '1' to '11'

in this case report displaying the wrong data,

so i need to validate that filed should contatin '01' not '1'.

so plese tell me more clearly.

regards.

priya

Read only

0 Likes
1,242

Hi again,

1. so i need to validate that filed should contatin '01' not '1'

U can validate like this.

2. Data : myval like knkk-ctlpc.

myval = '01'.

if myval in c_ctlpc.

else.

*----- code for error message

endif.

regards,

amit m.

Read only

0 Likes
1,242

u can try like this

length = strlen( c_ctlpc-low ).
if length Ne 2.
  error meassage.
endif.

Message was edited by: Chandrasekhar Jagarlamudi

Read only

0 Likes
1,242

for select-options,

VALIDATIONS :

IF C_CTLPC[] IS NOT INITIAL.

*--Validations,only if select-options is NOT initial.

SELECT CTLPC

INTO V_CTLPC

FROM KNKK

UP T0 1 ROWS

WHERE CTLPC IN C_CTLPC.

IF SY-SUBRC <> 0.

*--No valid value given by user for this field,display err

MESSAGE E000 WITH 'Invalid CTLPC values'.

ENDIF.

ENDIF.

here the intention is, to check whether user entered atleast 1 valid value for that field or not, if we found atleast 1 valid entry,we can proceed further, else we will display error message,

check this.

Read only

0 Likes
1,242

Hi Priya,

Best option is use CONVERSION_EXIT_ALPHA_INPUT,

this will convert 1 to 01

select-options C_CTLPC FOR KNKK-CTLPC. 
INITIALIZATION.

loop at c_ctlpc.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT         = C_CTLPC-LOW
 IMPORTING
   OUTPUT        = C_CTLPC-LOW.
          

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT         = C_CTLPC-HIGH
 IMPORTING
   OUTPUT        = C_CTLPC-HIGH.

modify c_ctlpc index sy-tabix.
clear c_ctlpc.
          
endloop.

Read only

Former Member
0 Likes
1,242

Hi Priya,

Select option is an internal table of four fields-

SIGN

OPTION

LOW

HIGH

So u can use these fields as C_CTLPC-LOW and C_CTLPC-HIGH using at selection screen event...

At selection-screen on C_CTLPC-low.

and do the validation. U can see these fields even in debugging mode.

Hope this helps u.

Regards,

Seema.

Read only

Former Member
0 Likes
1,242

Hi Priya,

At selection-screen on C_CTLPC-low.

if not C_CTLPC-LOW is initial.

select singl * from KNKK where CTLPC = C_CTLPC -LOW.

if sy-subrc NE 0.

Error Message.

endif.

At selection-screen on C_CTLPC-HIGH.

if not C_CTLPC-HIGH is initial.

select singl * from T691A where CTLPC = C_CTLPC -HIGH.

if sy-subrc NE 0.

Error Message.

endif.

If useful reward.

Vasanth

Read only

Former Member
0 Likes
1,242

Hello,

you can do like this

AT SELECTION-SCREEN on c_CTLPC.

IF c_Ctplc-Low

Conditions

endif.

IF C_ctplc-high.

coniditons

endif.

Reward if helps.

Thanks,

krishna

Read only

Former Member
0 Likes
1,242

Hi

you can validate it as follows for for the whole range of values.

AT SELECTION-SCREEN ON C_CTLPC.

SELECT CTLPC FROM (VALUE TABLE OF CTLPC)

WHERE CTLPC IN C_CTLPC.

IF SY-SUBRC NE 0.

MESSAGE.

ENDIF.