‎2007 Dec 08 11:33 AM
select-options: s_kunnr for kna1-kunnr.
In my requirement I need to validate the above selection-screen parameters (i.e. s_kna1-low and s_kna1-high contained in database or not). Can anybody give the logic for this.
Regards,
Naseer.
‎2007 Dec 08 11:37 AM
In the At selection-screen event write select single queries as below
Data: gv_kunnr_low type kna1-kunnr.
Select Single kunnr from KNA1 into gv_kunnr_low where kunnr = s_kunnr-low.
if sy-subrc <> 0.
error message.
endif.Same as for high.
Regards,
Satish
‎2007 Dec 08 11:42 AM
Hi nasser,
You will be writing select query depending up on ur select-options field. There you can validate as per given input values if the select qurey is fecting values into internal table it is ok if not the value donest exits.
Ex:
Select-options: S_kunnr for kna1-kunnr.
Select * from KNA1 into table itab where kunnr in s_kunnr.
<b>IF NOT ITAB IS INITIAL .</b>
loop at itab
write: itab-kunnr.
endloop.
else.
message E001 with 'NO RECORDS AVAILABLE FOR GIVEN INPUT'.
ENDIF.
Hope this will help u.....
<b>reward if useful</b>
Regards,
sunil kairam.
‎2007 Dec 08 11:44 AM
Hi Naseer,
Check sy-subrc after the select statement if its success then proceed else thrw a error message.
For e.g
<b>AT SELECTION-SCREEN ON S_KUNNR.
Select single kunnr from kna 1
into loc_variable
where kunnr in s_kunnr.
if sy-subrc <> 0.
Write : 'No data'.
else.
..........
..........
........... (Your Coding).
Endif.</b>
Do it like this you will get error message if it error else you will proceed with your coding.
Hope its useful.
Thanks,
Sakthi C
*Rewards if useful*
‎2007 Dec 08 11:44 AM
Try
select single * from kna1 where kunnr in s_kunnr.
if sy-subrc eq 0 , then atleast one entry is there in your select option that is valid.
You shouldn't just check the high and low parameter.
Regards,
Abhishek
‎2007 Dec 08 11:48 AM
tables :
spfli.
select-options:
s_carr for spfli-carrid.
Hi,
i guess this code will solve ur problem.
data:
it_tab like table of spfli with header line.
select *
from spfli
into table it_tab
where carrid gt s_carr-low
and carrid le s_carr-high.
if sy-subrc eq 0.
loop at it_tab.
write: it_tab-carrid.
endloop.
endif.
plzz reward points if it helps.
‎2007 Dec 09 5:46 AM
Hi Naseer,
Try this code it may help full.
tables spfli.
data w_carrid type spfli-carrid.
select-options s_carrid for spfli-carrid.
selection-screen on s_carrid.
Loop at s_carrid.
if s_carrid-low is not initial.
select single carrid
into w_carrid
from spfli
where carrid eq s_carrid-low
if sy-subrc ne 0.
clear w_carrid.
message e015 ( Error message here)
endif.
if s_carrid-high is not initial.
select single carrid
into w_carrid
from spfli
where carrid eq s_carrid-high
if sy-subrc ne 0.
clear w_carrid.
message e015 ( Error message here)
endif.
endloop.
Plzz Reward if it is Useful,
Mahi.