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

range in select option

SwarnaliBasu
Participant
0 Likes
1,077

HI

My requirement is i have to consider all the sales order between two shipping dates.

eg: s_cmngv for vbak_cmngv
               
 IF s_cmngv IS NOT INITIAL.


 SELECT vbak~vbeln vbak~spart vbak~vkorg vbak~vtweg vbak~knkli vbak~cmngv
             fpltc~ccins fpltc~ccnum fpltc~ccname fpltc~datbi

             INTO TABLE i_next
             FROM vbak INNER JOIN fpltc
             ON vbak~rplnr = fpltc~fplnr
             WHERE fpltc~datbi < s_cmngv-low btw fpltc~datbi < s_cmngv-high.

please tell me how to write the select statement that all the CMNGV falls between these range.

Edited by: Rob Burbank on Dec 3, 2009 9:28 AM

10 REPLIES 10
Read only

Pawan_Kesari
Active Contributor
0 Likes
1,037
IF s_cmngv IS NOT INITIAL.

SELECT vbak~vbeln vbak~spart vbak~vkorg vbak~vtweg vbak~knkli vbak~cmngv
fpltc~ccins fpltc~ccnum fpltc~ccname fpltc~datbi

INTO TABLE i_next
FROM vbak INNER JOIN fpltc
ON vbak~rplnr = fpltc~fplnr
WHERE fpltc~datbi IN s_cmngv

ENDIF.

If you are filling data in S_SMNGV then make sure data is filled as below

s_cmngv-sign = 'I' .

s_cmngv-option = 'BT' .

s_cmngv-low = date1 .

s_cmgv-high = date2 .

where date1 <= date2 .

If data is coming from select-option then you don't have to do anything it is taken care of.

Edited by: Pawan Kesari on Dec 3, 2009 4:06 PM

Edited by: Pawan Kesari on Dec 3, 2009 4:08 PM

Read only

0 Likes
1,037

HI

i cannot use IN because i want to compare two dates which are from different tables.

please chek once more

Read only

0 Likes
1,037

Hi,

Can you explain what do ypu mean by this :


 i want to compare two dates which are from different tables.

Regards,

Swarna Munukoti

Read only

0 Likes
1,037

>

> HI

> i cannot use IN because i want to compare two dates which are from different tables.

>

> please chek once more

Prepare the range from those two dates from different tables

s_cmngv-sign = 'I' .

s_cmngv-option = 'BT' .

s_cmngv-low = date from first table .

s_cmgv-high = date from second table .

append s_cmngv .

Now use s_cmngv in select with IN operator..

OR

If you really don't want to use IN then use below statement

SELECT vbak~vbeln vbak~spart vbak~vkorg vbak~vtweg vbak~knkli vbak~cmngv
fpltc~ccins fpltc~ccnum fpltc~ccname fpltc~datbi
INTO TABLE i_next
FROM vbak INNER JOIN fpltc
ON vbak~rplnr = fpltc~fplnr
WHERE fpltc~datbi >= s_cmngv-low AND fpltc~datbi <= s_cmngv-high.

Edited by: Pawan Kesari on Dec 3, 2009 4:30 PM

Read only

Nawanandana
Active Contributor
0 Likes
1,037

hi


data : s_cmngv for vbak_cmngv.

 IF s_cmngv IS NOT INITIAL.

            SELECT vbak~vbeln vbak~spart vbak~vkorg vbak~vtweg vbak~knkli vbak~cmngv
            fpltc~ccins fpltc~ccnum fpltc~ccname fpltc~datbi

            INTO TABLE i_next
            FROM vbak
            INNER JOIN fpltc    ON vbak~rplnr = fpltc~fplnr
            WHERE fpltc~datbi IN s_cmngv.

  endif.

regard

nawa.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,037

if s_cmngv is a selection screen field

you can just use in s_cmngv in your query.

or if you are building the range ,

then

s_cmngv-sign = 'I'.

s_cmngv-option = 'BT'.

s_cmngv-low = '20071212'.

s_cmngv-high = '20081212'.

append s_cmngv.

then use in statement

Edited by: ksd on Dec 3, 2009 4:20 PM

Read only

0 Likes
1,037

HI

My S_cmngv-low/ high values are never fixed, its a variable so how will i use a fixed value for it

Read only

0 Likes
1,037

values are never fixed

what do you mean by this?Could you explain more

Read only

Nawanandana
Active Contributor
0 Likes
1,037

hi


data : s_cmngv for vbak_cmngv.

 IF s_cmngv IS NOT INITIAL.

            SELECT vbak~vbeln vbak~spart vbak~vkorg vbak~vtweg vbak~knkli vbak~cmngv
            fpltc~ccins fpltc~ccnum fpltc~ccname fpltc~datbi

            INTO TABLE i_next
            FROM vbak
            INNER JOIN fpltc    ON vbak~rplnr = fpltc~fplnr
            WHERE fpltc~datbi IN s_cmngv.

  endif.

regard

nawa.

Read only

SwarnaliBasu
Participant
0 Likes
1,037

thanks but none of them worked