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 valuses in Select statment.

Former Member
0 Likes
1,785

Hi experts,

i am retriving the data from the data base table and in where cluse im using the RANGE tables i difiened and appending the values of sign option low ,high to it.

i have defined as:

ranges:post for bsak-budat.

post-sign = post_dat-sign .

post-option = post_dat-option.

post-low = post_dat-low.

post-high = post_dat-high.

append post.

comp-sign = comp_code-sign .

comp-option = comp_code-option.

comp-low = comp_code-low.

comp-high = comp_code-high.

append comp.

vend-sign = vendor-sign .

vend-option = vendor-option .

vend-low = vendor-low.

vend-high = vendor-high .

append vend.

select bukrs gjahr belnr

xblnr lifnr wskto

skfbt waers wrbtr

wmwst augdt budat

bldat cpudt zfbdt

zterm zbd1t zbd2t

zbd3t zbd1p zbd2p

zlsch from bsak into corresponding fields of table g_bsak

where

budat in post and

bukrs in comp and

lifnr in vend .

but in select i am not getting any rows retrieval but entries are there in Table for same condition.

Plz help me how to code ranges values in select statement where condition and in anything wrong in my code mentioned above.

Mahesh

Edited by: mahesh s on Sep 4, 2009 10:59 AM

did u try the code which I have provided....

14 REPLIES 14
Read only

Former Member
0 Likes
1,746

Hi,

What are the structures post_dat, comp_code and vendor and how are they getting populated?

Regards,

Nick

Read only

0 Likes
1,746

hi

i am filling them using select-option

and assigning them to ranges.

'plz help me

'

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,746

Hello Mahesh,

Then you donot have to move the SELECT-OPTION to RANGES.

select bukrs gjahr belnr
xblnr lifnr wskto
skfbt waers wrbtr
wmwst augdt budat
bldat cpudt zfbdt
zterm zbd1t zbd2t
zbd3t zbd1p zbd2p
zlsch from bsak into corresponding fields of table g_bsak
where
budat in post and
bukrs in comp and
lifnr in vend .

Hope this is clear.

BR,

Suhas

Read only

0 Likes
1,746

Hi,

If post_dat, comp_code and vendor are select-options you don't need to move them into ranges. The problem is coming from the fact that you are not looping at the select-options to fill the ranges, but in truth you don't need to do this step at all.


select bukrs gjahr belnr
xblnr lifnr wskto
skfbt waers wrbtr
wmwst augdt budat
bldat cpudt zfbdt
zterm zbd1t zbd2t
zbd3t zbd1p zbd2p
zlsch from bsak into corresponding fields of table g_bsak
where
budat in post_dat and                      "Just use the selection options
bukrs in comp_code and              "Just use the selection options
lifnr in vendor.                           "Just use the selection options

Regards,

Nick

Read only

0 Likes
1,746

Hi,

As per Suhas Saha Answer Select query :.it is working when all the fields list in internal table is same as BSAK fields list in order. If you change order in internal table fields which is not same as BSAK then it wont get the data into internal table.

Read only

0 Likes
1,746

hi,

actually i am using this code in FM so in fm i can not use select-option so taken the SELOPT structure and filling it in import parameter and

i am filling them using select-option

and assigning them to ranges.

how too loop the select-option to assign to ranges.

plz help

Read only

0 Likes
1,746

did u try the code which I have provided....

Read only

0 Likes
1,746

Hi,

Move the select-options data to ranges through this way.



loop at post_dat.
move-corresponding post_dat to post.
append post_dat.
clear post_dat.
endloop.

Same way populate for other ranges and use it in the select query

Regards,

Vikranth

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,746

Hello Mahesh,

What are post_dat, comp_code, vendor? Please clarify.

From your code i understand that post_dat, comp_code, vendor are (some kind of) range. Why do you want to move these values to post, comp, vend.

Please revert back.

BR,

Suhas

Read only

Former Member
0 Likes
1,746

hi,

actuly i am using this code in FM so in fm i can not use select-option so taken the SELOPT structre and filling it in import parameter and

i am filling them using select-option

and assigning them to ranges.

plz help

Read only

Former Member
0 Likes
1,746

hi,

actually i am using this code in FM so in fm i can not use select-option so taken the SELOPT structre and filling it in import parameter and

i am filling them using select-option

and assigning them to ranges.

plz help

Read only

Former Member
0 Likes
1,746

Hi,

But even if you are using this in a function module you shouldn't need to fill the ranges tables. You're just passing data from one table with structure SELOPT to a differently named table with structure SELOPT, the SELECT statement will accept the original structures without filling ranges.

Regards,

Nick

Read only

Former Member
0 Likes
1,746

Hi,

Can you please remove corresponding fields of in select statement and try again.

Edited by: MR Venkat on Sep 4, 2009 11:10 AM

Read only

Former Member
0 Likes
1,746

Hi,

Thats true if you are using select-options to get the values then its not required for you to move into ranges...

but stil if you want to move them into ranges....

use the following code...

ranges:post for bsak-budat.

loop at post_dat.
move post_dat to post.
append post.
endloop.

loop at comp_code.
move comp_code to comp.
append comp.
endloop.

loop at vendor.
move vendor to vend.
append vend.
endloop.

select bukrs gjahr belnr
xblnr lifnr wskto
skfbt waers wrbtr
wmwst augdt budat
bldat cpudt zfbdt
zterm zbd1t zbd2t
zbd3t zbd1p zbd2p
zlsch from bsak into corresponding fields of table g_bsak
where
budat in post and
bukrs in comp and
lifnr in vend .

Regards,

Siddarth