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

how to select multiple data without select options?

Former Member
0 Likes
1,079

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

6 REPLIES 6
Read only

Former Member
0 Likes
1,037

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

Read only

0 Likes
1,037

    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?

Read only

0 Likes
1,037

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.

Read only

0 Likes
1,037

Hi Kaustav,

The code that I've given above will select the data in that date range.

Read only

0 Likes
1,037

Before playing with select-options for date field. It is good to have a look on to the below document.

Regards,

Philip.

Read only

yogendra_bhaskar
Contributor
0 Likes
1,037

Hi kaustav ,

Try this

select *

from DB_TAB

  into it_tab

   where date between l_cm_first and  l_cm_end.

Regards

Yogendra Bhaskar