Application Development 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: 

ranges not working

Former Member
0 Kudos
1,654

I have doubt about ranges statement

my query is the below

SELECT * FROM t077s WHERE ktopl EQ 'NCCA' AND

ktoks IN ('CONS','CONT','INVY').

t_hkont-sign = 'I'.

t_hkont-option = 'BT'.

t_hkont-low = t077s-bisnr.

t_hkont-high = t077s-vonnr.

APPEND t_hkont.

ENDSELECT.

SELECT * FROM bseg INTO CORRESPONDING FIELDS OF table

t_bseg

WHERE

**************when removing this like its working*

hkont in t_hkont AND

**************but records there in db for this range***

gjahr EQ p_gjahr AND

bukrs EQ 'NCCP' AND

bschl IN

('89','99','86','96','40','50') AND

augbl EQ space AND

bustw EQ 'WE01'.

that t_hkont table having three rows

Kindly advise me how to handle..

prakash

16 REPLIES 16

Former Member
0 Kudos
421

Hi prakash

if you want to filter the select from the internal table

you have to use FOr all entries in the select statement.

regards

kishore

Former Member
0 Kudos
421

HI

SELECT * FROM bseg INTO CORRESPONDING FIELDS OF table

t_bseg for all entries in t_hkont

WHERE

bisnr eq t_hkont-bisnr and

gjahr EQ p_gjahr AND

bukrs EQ 'NCCP' AND

bschl IN

('89','99','86','96','40','50') AND

augbl EQ space AND

bustw EQ 'WE01'.

regards

kishore

Former Member
0 Kudos
421

HAI,

How s t_hkont is declared it should be declared in thos way.

ranges : t_hkont for t077s-bisnr.

and then the code what you have declared should be working

cheers

0 Kudos
421

hi kishore,

i have a range ...thats between of two values.. for u specified there is single only comes right ??? but i need set of matched records,

hi kumar,

yes. i have specified the range what u wrote..

thanks of u both,

pls suggest any other solution

0 Kudos
421

no try giving 'EQ' and use <b>in t_hknont</b>,

using in means searching in the whole table, it is not wrong, try and see

hymavathi_oruganti
Active Contributor
0 Kudos
421

try changing like this and see

<b>t_hkont-option = 'EQ'.</b>

try in debugging wheteher t_hkont is filled or not.

vinod_gunaware2
Active Contributor
0 Kudos
421

t_hkont-low = t077s-vonnr.

t_hkont-high = t077s-bisnr.

U have used wrong way.

Pls try this.

Regard

vinod

Former Member
0 Kudos
421

Hi Prakash,

1. Use your select statement by having the clause

for all entries in t_hkont.

2. before this make a check that the table t_hkont is NOt initial else it would all entries in table if the table t_hkont is INITIAL.

Cheers,

Tarun

0 Kudos
421

vinod u r correct but i have tried that coding if i got any error supposed to change the range limits...but not working..

tarun... for having clause can u give correct syntax... here problem in syntax

0 Kudos
421

HI,

I think your are mislead by statement Having ..

You do not have to use "having"

use this:

check <tablename> is NOT initial.

SELECT * FROM bseg INTO CORRESPONDING FIELDS OF table

t_bseg for all entries in table <table name> WHERE

<conditions>.

Former Member
0 Kudos
421

Hi prakash

SELECT * FROM t077s WHERE ktopl EQ 'NCCA' AND

ktoks IN ('CONS','CONT','INVY').

t_hkont-sign = 'I'.

t_hkont-option = 'BT'.

t_hkont-low = t077s-bisnr.

t_hkont-high = t077s-vonnr.

APPEND t_hkont.

ENDSELECT.

in this t_hkont-low and t_hkont-high contains the last value of the table t077s for the selection criteria.

Is that Ok?

I suggest First you generate a internal table for t077s as per the selection criteria then you can select the matching records from BSEG using FOR ALL ENTRIES.

For ALL ENTRIES will match all the records in the internal table with the database table.

regards

kishore

0 Kudos
421

Hi Kishore... yes i did what u said... but no records return...pls look the below

SELECT * FROM bseg INTO CORRESPONDING FIELDS OF wa_bdc

for all entries in t_hkont

WHERE

hkont gt t_hkont-low and

hkont le t_hkont-high

*intead of this line i tried like hkont eq t_hkont-low

*t_hkont-high , t_hkont not allowing bcsz it has to *declare the equvalent record right ??

gjahr EQ p_gjahr AND

bukrs EQ 'NCCP' AND

ebeln IN t_po AND

bschl IN

('89','99','86','96','40','50') AND

augbl EQ space AND

bustw EQ 'WE01'.

MOVE-CORRESPONDING wa_bdc to t_bseg.

APPEND t_bseg.

ENDSELECT.

0 Kudos
421

I |BT |0000501001|0000503999

I |BT |0000511001|0000529999

I |BT |0000221001|0000221999

FYI: this is the t_hkont values

0 Kudos
421

HI parakash

SELECT * FROM bseg INTO CORRESPONDING FIELDS OF wa_bdc

for all entries in t_hkont

WHERE

hkont gt t_hkont-low and

hkont le t_hkont-high and

gjahr EQ p_gjahr AND

bukrs EQ 'NCCP' AND

ebeln IN t_po AND

bschl IN

('89','99','86','96','40','50') AND

augbl EQ space AND

bustw EQ 'WE01'.

MOVE-CORRESPONDING wa_bdc to t_bseg.

APPEND t_bseg.

ENDSELECT.

have you checked the table. does it contain the rows which satisfies this condition.

regards

kishore

0 Kudos
421

Kishore,

Sorry to say tht records which is not satisfy the condition.....

actualy that rows just cleared before i run the query.. so i didnt much consider all the conditions

sorry to waste all of ur time....any wayy hearty thanks ...to u all...

Former Member
0 Kudos
421

Hello Prakash,

t_hkont-low = t077s-bisnr.

t_hkont-high = t077s-vonnr.

this should be interchanged as u are assigning he upperlimit (bisnr) to low instead of high