2007 Mar 13 5:38 AM
is there a better way to select at BKPF?
currently I am selecting at BKPF using all of the primary key and using for all enties.
but it is still taking a loong time to finish the select.
below is my select statement:
ct_scdoc contains 500,000 line items. (huge! internal table)
IF NOT ct_scdoc IS INITIAL.
SELECT bukrs
belnr
gjahr
bvorg
hwaer
bktxt
usnam
FROM bkpf
INTO TABLE i_bkpf
FOR ALL ENTRIES IN ct_scdoc
WHERE bukrs = ct_scdoc-bukrs
AND belnr = ct_scdoc-belnr
AND gjahr = ct_scdoc-gjahr.
ENDIF.
is there a better way to select at BKPF?
currently I am selecting at BKPF using all of the primary key and using for all enties.
but it is still taking a loong time to finish the select.
below is my select statement:
ct_scdoc contains 500,000 line items. (huge! internal table)
IF NOT ct_scdoc IS INITIAL.
SELECT bukrs
belnr
gjahr
bvorg
hwaer
bktxt
usnam
FROM bkpf
INTO TABLE i_bkpf
FOR ALL ENTRIES IN ct_scdoc
WHERE bukrs = ct_scdoc-bukrs
AND belnr = ct_scdoc-belnr
AND gjahr = ct_scdoc-gjahr.
ENDIF.
2007 Mar 13 5:42 AM
Hi,
Select statement looks good.
All the data pertains to single fiscal year(GJAHR).
if you wants you can restrict it .
Regards,
Anji
2007 Mar 13 5:43 AM
Marco,
Another better way to extract the data efficiently from DB is using Indicies. But here your case if different, you are using FOR ALL ENTRIES, ie, using a driver internal table, u are extracting data. so you cant use secondary index in this case.
Regards,
Sujatha.
2007 Mar 13 5:55 AM
Hi Marco,
This can be optimized breaking the CT_STDOC table into sets of lesser records and use APPENDING TABLE I_BKPF.
Eg: if CT_STDOC has 6000 entries the for every 1500 entries of CT_STDOC perform a SELECT with the APPENDING TABLE form.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |