Application Development and Automation 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: 
Read only

Performance (Select at BKPF)

Former Member
0 Likes
605

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.

3 REPLIES 3
Read only

Former Member
0 Likes
561

Hi,

Select statement looks good.

All the data pertains to single fiscal year(GJAHR).

if you wants you can restrict it .

Regards,

Anji

Read only

Former Member
0 Likes
561

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.

Read only

Former Member
0 Likes
561

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.