‎2008 Jul 07 7:50 AM
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
‎2008 Jul 07 7:59 AM
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.
‎2008 Jul 07 7:53 AM
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....
‎2008 Jul 07 7:54 AM
Hi,
In the above statement use INTO TABLE ist_bseg instead of
INTO CORRESPONDING FIELDS OF TABLE ist_bseg.
Regards,
Jaya Vani
‎2008 Jul 07 7:57 AM
Hello,
You might have to consider joining BKPF and BSEG, instead of 2 select queries..and FOR ALL ENTRIES etc..
Rgds,
Raghu.
‎2008 Jul 07 10:51 AM
>
> 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.
‎2008 Jul 07 7:59 AM
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.
‎2008 Jul 07 8:01 AM
Hi,
when you use for all entries. u have to use like this.
if not ist_bkpf[] is initial.
select query.
endif.
‎2008 Jul 07 8:08 AM
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
‎2008 Jul 07 10:50 AM
>
> 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.
‎2008 Jul 07 10:48 AM
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).
‎2008 Jul 08 7:16 AM
ya but bsis table has not field like matnr, ebeln,ebelp which i want.
‎2008 Jul 08 10:24 AM
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.
‎2008 Jul 07 10:55 AM
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
‎2008 Jul 07 11:12 AM
>
> 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?
‎2008 Jul 08 10:27 AM
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