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

Between Clause in select query

Former Member
0 Likes
4,598

In the selection screen, i enter April month i.e. 04. Now i have to go 5 months back i.e. November i.e. 11. Now from table T247, I want to select data from November to April. Ho do i do it.

8 REPLIES 8
Read only

former_member156446
Active Contributor
0 Likes
1,559
select ....
   from
   into table...
where date+4(2) > 04 and   "<<<check where the months offset need to reflect
          date+4(2) < 05.
Read only

Former Member
0 Likes
1,559

Hi,

Give select-options for the month.

select data according to this select-options.

And then enter your specific range on selection screen.

Reward pts. if usefull.

regards,

Dhan

Read only

Former Member
0 Likes
1,559

HI

It is better to select all the months data and read it with u r month ........other wise fill the range table of month and get the values...........

Actually problem is if u want select the months from 11 to 04........u have to select 11,12,01,02,03,04.............But it will not select like that if u write the Between clause in select.

Edited by: vamshi naini on Jun 18, 2008 11:27 AM

Read only

0 Likes
1,559

How do i do it. I want to select 11,12,01,02,03,04 and user will enter only 04.

Read only

Former Member
0 Likes
1,559

ranges: r_mnr fro t247-mnr.

r_mnr-low = '04'.

r_mnr-option = 'EQ'.

r_mnr-sign = 'I'.

append r_mnr...............etc.

in select use this range table with IN

Read only

Former Member
0 Likes
1,559

hi!

1. declare the input variable as ranges.

2. assign the values for ranges sign, option, low, high

3. before assigning the values , calculate the needed months range and append the range.

i,e so_month-low = p_month

so_month-high = p_month - 5.

then assign these variables to ranges low and high.

hope ur needed ranges will come.

regards,

nagulan

Read only

Former Member
0 Likes
1,559

hi use this function module..

CCM_GO_BACK_MONTHS to get the date v_date high ..

v_date-low = s_date-low.

use the select * from pa0002

into table itab

where pernr = s_pernr

and begda le v_date-high

and endda ge v_date-low .

Read only

Former Member
0 Likes
1,559

Hi,

If you want you can also use BETWEEN clause in select condition.

Example :

DATA: LOW TYPE I VALUE '04',
           HIGH TYPE I VALUE '11.

SELECT FIELDS.....
FROM TABLE 
INTO TABLE ITAB
WHERE PARAMETER BETWEEN LOW AND HIGH.

This will help you.

Plz reward if useful.

Thanks,

Dhanahsri.

Edited by: Dhanashri Pawar on Jun 18, 2008 11:52 AM

Edited by: Dhanashri Pawar on Jun 18, 2008 11:53 AM