Question:
Hi Guys.
I have requirement to extract records from the BSEG cluster table..hahah
Here is my code.
SELECT bukrs belnr gjahr
FROM bkpf
INTO TABLE i_bkpf
WHERE bukrs IN s_bukrs AND
( belnr IN r_apcred OR
belnr IN r_apinv OR
belnr IN r_ivi OR
belnr IN r_glpost ) AND
gjahr IN s_gjahr
ORDER BY bukrs belnr gjahr.
SELECT *
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE i_bseg PACKAGE SIZE 100000
FOR ALL ENTRIES IN i_bkpf
WHERE bukrs EQ i_bkpf-bukrs AND
belnr EQ i_bkpf-belnr AND
gjahr EQ i_bkpf-gjahr.
ENDSELECT.
FREE i_bkpf.
Is this code okay? What is the maximum package size?
Thanks in advance.
Davo
Answer:
Try it with an SQL trace running.
If you get a table scan for BKPF, break the select into seperate clauses - one for each OR alternative. ( Though as they are ranges, you could still get severe issues ).
Don't use SELECT * INTO CORRESPONDING.
use something like
DATA: BEGIN OF i_bseg OCCURS 0, "yes, I know, it's just an example ok?
a type a,
b type b,
c type c,
END OF i_bseg.
SELECT a b c FROM BSEG INTO TABLE i_bseg...
So, specify the fields you want to select, and make sure they are in the same order as your internal table.
Note also, that if i_bkpf is empty, you'll get the whole BSEG table.
regards
m@t
_________________
TULY The quality of answers is roughly proportional to the quality of the question.
The downside of being better than everyone else is that people tend to assume you're pretentious.
Answer:
Why not use a ldb ?
_________________
Champions League, here we come...