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: 

Sequential read instead of array fetch

Former Member
0 Kudos

Hi Guys,

Im banging my head by trying to figure out why my SQL statement always turned up with sequential read(check against ST05) instead of array fetch eventhough i put INTO TABLE statement. FYI, im extracting data from table BSET(under cluster RFBLG). This is the code:

    SELECT bukrs belnr gjahr buzei bupla mwskz hkont  
           txgrp shkzg hwbas hwste ktosl knumh kbetr 
           mlddt stbkz 
      INTO TABLE LT_TEMP 
      FROM bset 
      PACKAGE SIZE 3000
      FOR ALL ENTRIES IN lt_bkpf
      WHERE bukrs  =  lt_bkpf-bukrs            
      AND   belnr  =  lt_bkpf-belnr     
      AND   gjahr  =  lt_bkpf-gjahr.                 
    ENDSELECT

Pls comment whats wrong with the above code.

Thanks in advance.

1 ACCEPTED SOLUTION

christian_wohlfahrt
Active Contributor
0 Kudos

Hi!

BSET is 'just' a cluster table. The fields of BSET are not mapped 1:1 to the fields of the 'real' DB-table.

Now it seems, that only the complete primary key can be accessed directly in the cluster, not parts.

Your program might get much faster, when you add the line numbers (BUZEI) into lt_temp. Of course you have a bigger select statement (executed, not in source!), but this might be compensated by index access.

Regards,

Christian

7 REPLIES 7

Former Member
0 Kudos

You have to change your statement like this :

SELECT bukrs belnr gjahr buzei bupla mwskz hkont

txgrp shkzg hwbas hwste ktosl knumh kbetr

mlddt stbkz

INTO corresponding fields of TABLE LT_TEMP

FROM bset

PACKAGE SIZE 3000

FOR ALL ENTRIES IN lt_bkpf

WHERE bukrs = lt_bkpf-bukrs

AND belnr = lt_bkpf-belnr

AND gjahr = lt_bkpf-gjahr.

Former Member
0 Kudos

Hi

Why do you need a ENDSELECT?

Regards,

Raj

0 Kudos

Hi Ravi,

FYI, your statement will not solve the prob. thank for your comment.

Hi Raj,

Why i used ENDSELECT? Please press F1 on SELECT. PACKAGE SIZE does the matter.

Any other ideas, guys?

Former Member
0 Kudos

I think your code is correct. But remember that you have to process the internal table insice the SELECT/ENDSELECT:


   SELECT bukrs belnr gjahr buzei bupla mwskz hkont  
           txgrp shkzg hwbas hwste ktosl knumh kbetr 
           mlddt stbkz 
      INTO TABLE LT_TEMP 
      FROM bset 
      PACKAGE SIZE 3000
      FOR ALL ENTRIES IN lt_bkpf
      WHERE bukrs  =  lt_bkpf-bukrs            
      AND   belnr  =  lt_bkpf-belnr     
      AND   gjahr  =  lt_bkpf-gjahr. 
*  LOOP AT lt_temp.
*  ENDLOOP.
*    or
*  APPEND LINES OF lt_temp
*    TO lt_new.
    ENDSELECT

Rob

0 Kudos

Hi Rob,

May i know why i have to code LOOPENLOOP within my SELECTENDSELECT !!!??? Please give your comment here.

As i stated clearly on my first post, my problem now is happening on the sequential read.

Thanks anyway.

0 Kudos

Because each package will overlay the previous one. If you don't process the internal table for each package, it will be lost.

I don't get what you mean by the problem is now on the sequential read. The code you posted is for an array fetch.

Rob

christian_wohlfahrt
Active Contributor
0 Kudos

Hi!

BSET is 'just' a cluster table. The fields of BSET are not mapped 1:1 to the fields of the 'real' DB-table.

Now it seems, that only the complete primary key can be accessed directly in the cluster, not parts.

Your program might get much faster, when you add the line numbers (BUZEI) into lt_temp. Of course you have a bigger select statement (executed, not in source!), but this might be compensated by index access.

Regards,

Christian