‎2010 Feb 26 11:44 PM
Hello,
I have 4 parameters for date_low date_high time_low time_high. When there is values in these parameters everything works fine but when there are no values I get a sy-subrc 4 saying that there are no values for the select statement.
select * from ztable where date >= date_low and
date <= date_high and
time >= time_low and
time <= time_high.Requirement is to use parameters instead of select-options. Everything works fine when there is values but when the parameters are blank it doesnt select any values. Please help me out.> Thanks
Edited by: Vicky Vicky on Feb 27, 2010 12:45 AM
‎2010 Feb 26 11:53 PM
‎2010 Feb 26 11:53 PM
‎2010 Feb 27 12:01 AM
Hello Subas,
OR condition didnt help for me. Can you give an example. Thanks
‎2010 Feb 27 12:06 AM
try this.
select * from ztable where date >= date_low OR
date <= date_high OR
time >= time_low OR
time <= time_high.
Let me know if it not useful....
‎2010 Feb 27 12:07 AM
No Subas,
I tried this. This doesnt help because it selects all the values no matter u put in the parameters.
‎2010 Feb 27 12:35 AM
hi,
try the below code.
select * from ztable where date >= date_low OR
date <= date_high OR
time >= time_low OR
time <= time_high.
DATA: it_tab type table of ztable with header line.
DATA: date type sy-datum,
time type sy-uzeit.
ranges: r_date for sy-datum,
r_time for syst-uzeit.
if date cn '00000000'.
r_date-sign = 'I'.
r_date-option = 'LE'.
r_date-low = date-low.
r_date-high = date-high.
append r_date.
endif.
if time cn '000000'.
r_time-sign = 'I'.
r_time-option = 'LE'.
r_time-low = time-low.
r_time-high = time-high.
append r_time.
endif.
select * from ztable where date in and time in r_time.
Edited by: subas Bose on Feb 27, 2010 1:35 AM
Edited by: subas Bose on Feb 27, 2010 1:38 AM
‎2010 Feb 27 12:50 AM
‎2010 Feb 27 2:50 AM
HI Vicky,
Requirement is to use parameters instead of select-optionsDATA : R_DATE TYPE RANGE OF SY-DATUM, " Take Suitable one
R_TIME TYPE RANGE OF SY-UZEIT,
WA_DATE LIKE LINE OF R_DATE,
WA_TIME LIKE LINE OF R_TIME.
refresh r_date.
clear wa_date.
wa_date-sign = 'I'.
wa_date-option = 'EQ'. " You can change this to BT
wa_date-low = date-low.
wa_date-high = date-high.
append wa_date to r_date.
refresh r_time.
clear wa_time.
wa_time-sign = 'I'.
wa_time-option = 'EQ'. " You can change this BT
wa_time-low = date-low.
wa_time-high = date-high.
append wa_time to r_time.
select * from ztable where date in r_date " This is equivalent to Select Options
and time in r_time." OR Check this one
if not date-low is initial and not date-high is initial.
select * from ztable where date between date_low and date_high
and time between time_low and time_high.
endif.CHeers
Ram
Edited by: Ramchander Krishnamraju on Feb 27, 2010 3:50 AM
‎2010 Feb 27 5:00 AM
if date-high = space.
date-sign = 'I'.
date-option = 'BT'.
date-low = date-low.
date-high = date-high.
append date.
clear date.
else.
date-sign = 'I'.
date-option = 'EQ'.
date-low = date-low.
append date.
clear date.
endif.
if time-high = space.
time-sign = 'I'.
time-option = 'BT'.
time-low = time-low.
time-high = time-high.
append time.
clear time.
else.
time-sign = 'I'.
time-option = 'EQ'.
time-low = time-low.
append time.
clear time.
endif.
select * from ztable where date >= date-low and
date <= date-high and
time >= time-low and
time <= time-high.
Edited by: Krupaji on Feb 27, 2010 6:14 AM
‎2010 Feb 27 8:41 AM
dear vicky,
1) use select-options like parameters means select-options no extension no interval.
2)other wise make all parameter fields are all mandatory.
regards,
srinivas