‎2008 Dec 16 10:25 AM
Hi Guru's
this is the select Query which is taking much time in Production. so please help me to improve the preformance with BSEG.
this is my select query:
select bukrs
belnr
gjahr
bschl
koart
umskz
shkzg
dmbtr
ktosl
zuonr
sgtxt
kunnr
from bseg
into table gt_bseg1
for all entries in gt_bkpf
where bukrs eq p_bukrs
and belnr eq gt_bkpf-belnr
and gjahr eq p_gjahr
and buzei in gr_buzei
and bschl eq '40'
and ktosl ne 'BSP'.
UR's
GSANA
‎2008 Dec 16 10:36 AM
You are using the primary key, so not much you can do, other than making sure that gt_bkpf is not empty, is sorted by belnr and contains no duplicate belnr.
BSEG is usually a large table, so if you have many entries in gt_bkpf going into the select, it will take time.
BS* tables will not help here, I cannot see any customer, vendor or g/l account in the selection criteria.
Thomas
‎2008 Dec 16 10:30 AM
Hi gsana sana,
Use other tables then BSEG
BSAD Accounting: Secondary Index for Customers Cleared Items
BSAK Accounting: Secondary Index for Vendors Cleared Items
BSID Accounting: Secondary Index for Customers
BSIK Accounting: Secondary Index for VendorsAlso have a look on other BS* tables
it will be good for performace..
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
‎2008 Dec 16 10:34 AM
Delete the FAE clause and use the in clause in the where condition.
‎2008 Dec 16 10:36 AM
You are using the primary key, so not much you can do, other than making sure that gt_bkpf is not empty, is sorted by belnr and contains no duplicate belnr.
BSEG is usually a large table, so if you have many entries in gt_bkpf going into the select, it will take time.
BS* tables will not help here, I cannot see any customer, vendor or g/l account in the selection criteria.
Thomas
‎2008 Dec 16 11:55 AM
>
> BS* tables will not help here, I cannot see any customer, vendor or g/l account in the selection criteria.
in the original code: and bschl eq '40' (read: posting key = 40 ==> G/L debit entries)
this clearly indicates that we search for G/L postings, so BSIS/BSAS could be alternatives
‎2008 Dec 16 12:38 PM
OK, but which ones? If you don't have any account numbers to narrow down the selection, then BSIS/BSAS are pretty much useless. It seems that OP is coming from a BKPF selection, probably using BUDAT, CPUDT, BLART or the likes, and now is looking up the corresponding BSEG entries.
We will not know until he publishes more of his code.
Thomas
‎2008 Dec 16 11:32 AM
hi,
Better u can use the table bsik,bsak,bsad,bsid,bsas.
if u want to use the bseg table means just include the KOART field also.
regards
sathis
‎2008 Dec 17 7:26 AM
Hi Sana,
How many entries are present in gt_bkpf ?
All other things seems fine. But if you can give logic to fetch data in gt_bkpf - it might be possible to combine bseg and bkpf query and use Join instead.
Regards,
Mohaiyuddin
‎2008 Dec 18 9:39 AM
>
> Hi Guru's
>
> this is the select Query which is taking much time in Production. so please help me to improve the preformance with BSEG.
>
> this is my select query:
>
> select bukrs
> belnr
> gjahr
> bschl
> koart
> umskz
> shkzg
> dmbtr
> ktosl
> zuonr
> sgtxt
> kunnr
> from bseg
> into table gt_bseg1
> for all entries in gt_bkpf
> where bukrs eq p_bukrs
> and belnr eq gt_bkpf-belnr
> and gjahr eq p_gjahr
> and buzei in gr_buzei
> and bschl eq '40'
> and ktosl ne 'BSP'.
>
> UR's
> GSANA
Hi,
This is what I know and please if any expert think its incorrect, please do correct me.
BSEG is a cluster table with BUKRS, BELNR, GJAHR and BUZEI as the key whereas other key will be stored in database as raw data thus SAP apps will need to convert that raw data first if we are using other keys in where condition. Hence, I suggest to use up to buzei in the where condition and filter other condition in internal table level like using Delete statement. Hope its help.
Regards,
Abraham
‎2008 Dec 18 10:47 AM
Hi,
The same fields can be found in the index tables
BSID
BSAD
BSIK
BSAK
BSIS
BSAS
for customers, vendors and G/L accounts seperately. Please select the data from these 6 tables or from customer and vendor related tables using appending in the select query.
eg:
select * from bsad into table i_bseg where <conditions>.
select * from bsid appending table i_bseg where <conditions>.
Try using these tables as surely there will be remarkable improvement in the performance.
Regards
Thabitha.