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

select query does not fetch all records

Former Member
0 Likes
1,790

hello all...

i have a select query...

select belnr awkey xblnr from bkpf into table i_bkpf1

for all entries in i_mseg

where awkey = i_mseg-awkey.

if sy-subrc = 0.

select VBELN belnr BUZID BSCHL hkont dmbtr SHKZG from bseg

into corresponding fields of table i_bseg1

for all entries in i_bkpf1

where belnr = i_bkpf1-belnr and bschl = '99'.

endif.

The 1st select query has only one record for belnr = '2607021464'.

The 2nd select query fetches only 30 records for the above belnr, well as if i check this in se16...there are 38 records....

can any one tell me were am i going wrong ???

hello all...

i have a select query...

select belnr awkey xblnr from bkpf into table i_bkpf1

for all entries in i_mseg

where awkey = i_mseg-awkey.

if sy-subrc = 0.

select VBELN belnr BUZID BSCHL hkont dmbtr SHKZG from bseg

into corresponding fields of table i_bseg1

for all entries in i_bkpf1

where belnr = i_bkpf1-belnr and bschl = '99'.

endif.

The 1st select query has only one record for belnr = '2607021464'.

The 2nd select query fetches only 30 records for the above belnr, well as if i check this in se16...there are 38 records....

can any one tell me were am i going wrong ???

5 REPLIES 5
Read only

Former Member
0 Likes
1,017

Hello

Do not use construction for all entries.

In first query it select one record for one entry in i_mseg.

Read only

Former Member
0 Likes
1,017

Hi,

In the second query avoid using for all entries in i_bkpf1.

use this statement only.

select VBELN belnr BUZID BSCHL hkont dmbtr SHKZG from bseg

into corresponding fields of table i_bseg1

where belnr = i_bkpf1-belnr and bschl = '99'.

I hope this way you will be able to fetch all the 38 records.

Thanx.

Read only

Former Member
0 Likes
1,017

you need to mention all the key fileds in the select query.


select 
bukrs 
belnr
gjahr
buzei 
vbeln 
BUZID 
BSCHL 
hkont 
dmbtr 
SHKZG 
from bseg
into corresponding fields of table i_bseg1
for all entries in i_bkpf1
where belnr = i_bkpf1-belnr and bschl = '99'.

Read only

Former Member
0 Likes
1,017

Hi Poonam,

Hope the following Code will help you regarding your problem.

SELECT VBELN BELNR BUZID BSCHL HKONT DMBTR SHKZG

FROM bseg

into corresponding fields of table i_bseg1

where BELNR = i_bkpf1-belnr and bschl = '99'.

Thanks.

Nitesh

Read only

Former Member
0 Likes
1,017

Hello,

You are filter the data on posting key (and bschl = '99'.). Try removing that from the where condition.


select VBELN belnr BUZID BSCHL hkont dmbtr SHKZG from bseg
into corresponding fields of table i_bseg1
for all entries in i_bkpf1
where belnr = i_bkpf1-belnr. " remove this  and bschl = '99'.

regards,

Advait

Edited by: Advait Gode on Oct 27, 2008 10:55 AM