‎2007 Jul 30 4:38 PM
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.
‎2007 Jul 30 5:22 PM
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
‎2007 Jul 30 4:44 PM
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>
‎2007 Jul 30 4:45 PM
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
‎2007 Jul 30 4:48 PM
if i enter from 1 to 10 and 9 is not correct how i will get the err
‎2007 Jul 30 4:49 PM
if i enter from 1 to 10 and 9 is not correct how i will get the err
‎2007 Jul 30 4:51 PM
hi,
wat do you mean by 9 is not correct???
its inside the range 1 to 10....isn't it??
‎2007 Jul 30 4:52 PM
‎2007 Jul 30 4:55 PM
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
‎2007 Jul 30 4:59 PM
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
‎2007 Jul 30 5:10 PM
OK friends i accept your answer
but if i put in s_tanum 3 tanum how i can get the err
‎2007 Jul 30 5:13 PM
‎2007 Jul 30 5:21 PM
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
‎2007 Jul 30 5:22 PM
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
‎2007 Jul 30 5:24 PM
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
‎2007 Jul 30 5:24 PM
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