‎2006 Sep 26 10:33 AM
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.
ENDSELECTPls comment whats wrong with the above code.
Thanks in advance.
‎2006 Sep 26 4:43 PM
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
‎2006 Sep 26 10:35 AM
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.
‎2006 Sep 26 10:35 AM
‎2006 Sep 26 11:03 AM
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?
‎2006 Sep 26 2:48 PM
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.
ENDSELECTRob
‎2006 Sep 26 4:14 PM
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.
‎2006 Sep 26 4:30 PM
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
‎2006 Sep 26 4:43 PM
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