‎2014 Aug 12 7:03 AM
Dear experts,
I have a rquirement that i have a one selection screen and in that selection screen on date field is there which is parameter type. we using this parameter date field in the program for selecting data..after that i am using the logic to multiple value..now my requirement is how to select the data for multiple value..
PARAMETERS : SO_DATE TYPE SY-DATUM OBLIGATORY.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = so_date
DAYS = 1
MONTHS = 0
SIGNUM = '-'
YEARS = 0
IMPORTING
CALC_DATE = so_date
.
l_cm_first+0(6) = so_date+0(6). " month & year
l_cm_first+6(2) = '01'. " date
l_cm_end = so_date.
my requirement is that how to use l_cm_first and l_cm_end multiple selection in select query ??
eg- i want to fetch the data from 1/8/2014 to 11/08/2014 using this field l_cm_first and l_cm_end
‎2014 Aug 12 7:13 AM
Hi Kaustav,
Your Selection should be:
SELECT * FROM TABLE xxxx INTO itab
WHERE ( date GE l_cm_first
AND date LE l_cm_end ).
Hope, this helps.
Regards,
Sharmila
‎2014 Aug 12 7:25 AM
l_cm_first+0(6) = so_date+0(6). " month & year
l_cm_first+6(2) = '01'. " date
l_cm_end = so_date.
after executing this line l_cm_first = 1/8/2014 and l_cm_end = 11/08/2014
now i have to select in this range how to do it?
‎2014 Aug 12 7:34 AM
Hi kaustav das,
Ranges can be described as programatic version of select-option. They are used to filter data from database or internal table. They work similar to select-options.
Define a range: same like select-options.
Ranges: r_field for <table>.--> can be any dbtable.
if not field1 is initial.
r_field-sign = 'I'.
r_field-option = 'EQ'.
r_field-option-low = field1.
append r_field.
endif.
if not field2 is initial.
r_field-sign = 'I'.
r_field-option = 'EQ'.
r_field-option-low = field2.
append r_field.
endif.
if field1 is initial and field2 is initial.
r_field-sign = 'I'.
r_field-option = 'EQ'.
append r_field.
endif.
select * from <table> where field1 in r_field.
‎2014 Aug 12 7:37 AM
Hi Kaustav,
The code that I've given above will select the data in that date range.
‎2014 Aug 12 7:41 AM
‎2014 Aug 12 8:11 AM
Hi kaustav ,
Try this
select *
from DB_TAB
into it_tab
where date between l_cm_first and l_cm_end.
Regards
Yogendra Bhaskar