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: 

Problem in Select Query

Former Member
0 Kudos
157

Hi friends,

I am using this sql statement,

SELECT belnr hkont wrbtr bupla matnr FROM bseg

INTO CORRESPONDING FIELDS OF TABLE itab

FOR ALL ENTRIES IN it_bseg1

WHERE belnr = it_bseg1-belnr AND bupla = it_bseg1-bupla AND gjahr = it_bseg1-gjahr.

Here it_bseg1 have only one doc no.

And for that belnr bseg having the content like below

belnr gjahr bschl wrbtr hkont

0090000126 2007 01 53,920.00 0024410000

0090000126 2007 50 1,256.00 0040010000

0090000126 2007 50 1,256.00 0040010000

0090000126 2007 50 410.00 0040010000

0090000126 2007 50 445.00 0040010000

0090000126 2007 50 860.00 0040010000

0090000126 2007 50 410.00 0040010000

0090000126 2007 50 410.00 0040010000

0090000126 2007 50 410.00 0040010000

0090000126 2007 50 410.00 0040010000

0090000126 2007 50 873.00 0040010000

0090000126 2007 50 990.00 0040010000

0090000126 2007 50 873.00 0040010000

0090000126 2007 50 22,000.00 0040010000

0090000126 2007 50 18,000.00 0040010000

0090000126 2007 50 3,432.00 0040010000

0090000126 2007 50 1,885.00 0040010000

now when the sql statement writtent above is run then only 10 lines are fetched into itab.

The lines which are in bold are not fetched y this is happening through forallentries statement.

Please help me in this.

Thanks in advance.

Edited by: Dharmishta Suryavanshi on Mar 11, 2008 12:43 PM

Edited by: Dharmishta Suryavanshi on Mar 11, 2008 12:44 PM

5 REPLIES 5

Former Member
0 Kudos
143

Sort internal table before select statement

sort it_bseg1 by belnr bupla gja.

Former Member
0 Kudos
143

Hi make sure you are sorting the internal table

it_bseg1 by belnr bupla and gjahr before using it in for all entries.

this will surely solve your problem.

Former Member
0 Kudos
143

Hello,

as u r using for all entries you have to fetch all the primary key fields of table bseg along with the required fields.

while fetching the data also fetch

BUKRS

BELNR

GJAHR

BUZEI

form the table BSEG.

Regards,

Neelambari

dhruv_shah3
Active Contributor
0 Kudos
143

Hi,

Belnr is unique tht's why it is coming only once when there are also other records.

So you have to select the data from the item table and then display it.

HTH

Regards,

Dhruv Shah

Former Member
0 Kudos
143

Hi ,

Please can you check the field BUPLA for the 10 entries that you are not getting and also for the rest entries that are available.

Coz i think that the problem is with the data,

Please check all the fields by which you are selecting and also the fields of the data that is selected,

I guess there is no problem with the query,

Else provide me with the complete internal table data after the select query,may be i can help

Hope this is help full,

Taher

Edited by: taher kanchwala on Mar 11, 2008 1:29 PM