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 tuning

Former Member
0 Likes
1,807

SELECT bukrs

belnr

gjahr

buzei

matnr

ebeln

ebelp

dmbtr

hkont

shkzg

mwskz

bschl

FROM bseg

INTO CORRESPONDING FIELDS OF TABLE ist_bseg

FOR ALL ENTRIES IN ist_bkpf

WHERE bukrs = ist_bkpf-bukrs

AND belnr = ist_bkpf-belnr

AND gjahr = ist_bkpf-gjahr

AND hkont IN (c_hkont1, c_hkont2, c_hkont3, c_hkont4, c_hkont5, c_hkont6 ).

the above statement taks lots of time in exuquting because of large entries.

can any change in the above statement which improve performance of program

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,761

BSEG is a cluster table, it always take mote time to fetch data compare to transparent tables. To improve the performance u should select data from its Secondary Index tables like BSAK,BSAD,BSAS,BSIK,BSID etc. (whichever meets ur requirement).

Regards,

Joy.

14 REPLIES 14
Read only

former_member195383
Active Contributor
0 Likes
1,761

make sure that u have checked ist_bkpf[] is not initial before this select query...

Only if its not inintial then go for the select query....

Read only

Former Member
0 Likes
1,761

Hi,

In the above statement use INTO TABLE ist_bseg instead of

INTO CORRESPONDING FIELDS OF TABLE ist_bseg.

Regards,

Jaya Vani

Read only

Former Member
0 Likes
1,761

Hello,

You might have to consider joining BKPF and BSEG, instead of 2 select queries..and FOR ALL ENTRIES etc..

Rgds,

Raghu.

Read only

0 Likes
1,761

>

> Hello,

> You might have to consider joining BKPF and BSEG, instead of 2 select queries..and FOR ALL ENTRIES etc..

>

BSEG is a cluster table. You can't join to a cluster table.

Read only

Former Member
0 Likes
1,762

BSEG is a cluster table, it always take mote time to fetch data compare to transparent tables. To improve the performance u should select data from its Secondary Index tables like BSAK,BSAD,BSAS,BSIK,BSID etc. (whichever meets ur requirement).

Regards,

Joy.

Read only

0 Likes
1,761

Hi,

when you use for all entries. u have to use like this.

if not ist_bkpf[] is initial.

select query.

endif.

Read only

Former Member
0 Likes
1,761

Hi,

1. First of all try to avoid the use of 'INTO CORRESPONDING FIELDS OF TABLE ist_bseg '

Instead use 'INTO TABLE ist_bseg'

2. Before using a internal table 'FOR ALL ENTRIES IN ist_bkpf'

check if the table is not empty, other wise all entries in select statemets will be executed.

ie 'IF NOT ist_bkpf IS INITIAL'. before select query.

3. BSEG is a cluster table, it always take more time to fetch data compared to other transparent tables. To improve the performance you should select data using its secondary index .

Check if secondary index exists and find out the best possible for you. And then use it in where clause of select satement in same order as specified.

Hope this helps you.

plz reward if useful.

thanks,

dhanashri.

Edited by: Dhanashri Pawar on Jul 7, 2008 9:08 AM

Read only

0 Likes
1,761

>

> Hi,

>

>> 3. BSEG is a cluster table, it always take more time to fetch data compared to other transparent tables. To improve the performance you should select data using its secondary index .

> Check if secondary index exists and find out the best possible for you. And then use it in where clause of select satement in same order as specified.

>

BSEG is a cluster table. You can't create secondary indexes on cluster tables.

Read only

christine_evans
Active Contributor
0 Likes
1,761

You're using BUKRS, BELNR and GJAHR in your WHERE clause and you can't do any better when selecting from BSEG. Any query that selects a lot of data will inevitably take a long time, however well indexed it is.

You're also using HKONT in your query, so a better starting point for you might be to use a table like BSIS, which is indexed on BUKRS and HKONT (as already mentioned further up).

Read only

0 Likes
1,761

ya but bsis table has not field like matnr, ebeln,ebelp which i want.

Read only

0 Likes
1,761

Ok then, you could start with a select on BSIS and use the resulting data set to query BSEG. But this would only help if the BSIS HKONT restriction gives you a much smaller set of data as a starting point for the BSEG select than you've already got in your FAE table. And you'd have the disadvantage of two selects rather than one.

Personally, I'd stick with BSEG because it's got everything in it. And I've never found that querying it on BUKRS / BELNR / GJAHR is that slow - unless you need to select a lot of data from it and (at the risk of repeating myself) large data quantities will slow down anything.

Read only

Former Member
0 Likes
1,761

Hi,

BSEG is cluster table, when V fetch data from Cluster tables it always take more time to fetch the data.

So better search for secondary tables which contain all field u want.(BSAK, BSIK,....)

regards,

shaik sha vali.P

Read only

0 Likes
1,761

>

> Hi,

> BSEG is cluster table, when V fetch data from Cluster tables it always take more time to fetch the data.

>

> So better search for secondary tables which contain all field u want.(BSAK, BSIK,....)

>

> regards,

> shaik sha vali.P

What is the point of advising the OP to use BSAK or BSIK when both will contain only vendor lines and are unlikely to contain the GL code lines that I'm assuming he is looking for?

Read only

Former Member
0 Likes
1,761

Hi,

Use FM FI_DOCUMENT_READ. pass belnr, bukrs and gjahr from bkpf table.

this fm gives a multiple rows for single row of data from bkpf. use it according to ur requirement.

my program runtime improved approx 30%.

regards,

madhu