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

Former Member
0 Likes
1,470

i have select option s_tanum

i need to make check if the tanum is in LTAP if not to give message

how??

i made it but not

select tanum

from ltap

into ztanum

where tanum in s_tanum.

if sy-subrc <> 0.

write : / s_tanum-low.

endif.

endselect.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,443

Hi,

in your case, do the following.

if s_tanum-option = 'EQ'.

select tanum from ltap into ztanum where tanum in s_tanum.

if sy-subrc ne 0.

message e000 with 'Invalid'.

endif.

elseif s_Tanum-option = 'BT'.

loop at s_tanum.

select tanum from ltap into ztanum where tanum in s_tanum-low.

if sy-subrc ne 0.

message e000 with 'Invalid'.

endif.

endloop.

endif.

Regards,

Niyaz

14 REPLIES 14
Read only

Former Member
0 Likes
1,443

this code selects tanum from ltap into ztanum, for all the values of tanum specified in the selection screen.

if it happens u need to print the lower value of select-options from tanum.

if you want to know if tanum is present in ltap...

select * from ltap where tanum in s_tanum.

if sy-subrc ne 0.

message e000 with 'tanum not in ltap'.

endif.

regards,

srinivas

<b>*reward for useful answers*</b>

Read only

Former Member
0 Likes
1,443

write it under at selection-screen event.,

tables : ltap.

select single * from ltap where tanum in s_tanum.

if sy-subrc ne 0.

message e000 with 'Enter Valid Tanum'.

endif.

Thansk

mahesh

Read only

0 Likes
1,443

if i enter from 1 to 10 and 9 is not correct how i will get the err

Read only

0 Likes
1,443

if i enter from 1 to 10 and 9 is not correct how i will get the err

Read only

0 Likes
1,443

hi,

wat do you mean by 9 is not correct???

its inside the range 1 to 10....isn't it??

Read only

0 Likes
1,443

it inside the range but 9 is <b>not exist</b> in ltap

Read only

0 Likes
1,443

Ok normally validation at selection screen is done.. if the program finds one valid value then it will consider that one value and proceed further. How ever the values which are wrong will be skipped in the further processing ..

And also remember its not always 1-10 or 1-100.. it can be some thing like 1-10 and 20-70 and exclude 50-52 and exclude 65.. it is very difficult to build a logic to process so many combinations..

instead just use my previous logic for a single shot validation and this is how it is done by all.

Thanks

mahesh

Read only

0 Likes
1,443

do u want to display all the values that are specified in your range of values and that are not in the ltap table

regards,

srinivas

Read only

Former Member
0 Likes
1,443

OK friends i accept your answer

but if i put in s_tanum 3 tanum how i can get the err

Read only

0 Likes
1,443

i mean taht all in s_tanum-low

Read only

0 Likes
1,443

Here you go a sample code..Ensure that your select-options does not have intervals

TABLES : vbak.

SELECT-OPTIONS : s_vbeln FOR vbak-vbeln NO INTERVALS.

AT SELECTION-SCREEN.

LOOP AT s_vbeln.

SELECT SINGLE * FROM vbak WHERE vbeln = s_vbeln-low.

IF sy-subrc NE 0.

MESSAGE e001(zs).

EXIT.

ENDIF.

ENDLOOP.

Thanks

Mahesh

Read only

Former Member
0 Likes
1,444

Hi,

in your case, do the following.

if s_tanum-option = 'EQ'.

select tanum from ltap into ztanum where tanum in s_tanum.

if sy-subrc ne 0.

message e000 with 'Invalid'.

endif.

elseif s_Tanum-option = 'BT'.

loop at s_tanum.

select tanum from ltap into ztanum where tanum in s_tanum-low.

if sy-subrc ne 0.

message e000 with 'Invalid'.

endif.

endloop.

endif.

Regards,

Niyaz

Read only

Former Member
0 Likes
1,443

Hi,

in your case, do the following.

if s_tanum-option = 'EQ'.

select tanum from ltap into ztanum where tanum in s_tanum.

if sy-subrc ne 0.

message e000 with 'Invalid'.

endif.

elseif s_Tanum-option = 'BT'.

loop at s_tanum.

select tanum from ltap into ztanum where tanum in s_tanum-low.

if sy-subrc ne 0.

message e000 with 'Invalid'.

endif.

endloop.

endif.

Regards,

Niyaz

Read only

Former Member
0 Likes
1,443

Hi,

in your case, do the following.

if s_tanum-option = 'EQ'.

select tanum from ltap into ztanum where tanum in s_tanum.

if sy-subrc ne 0.

message e000 with 'Invalid'.

endif.

elseif s_Tanum-option = 'BT'.

loop at s_tanum.

select tanum from ltap into ztanum where tanum in s_tanum-low.

if sy-subrc ne 0.

message e000 with 'Invalid'.

endif.

endloop.

endif.

Regards,

Niyaz