2006 May 17 12:32 PM
Hi,
Is there any way to improve the performance of the following query as I am selecting data from clustered table BSEG for all entries found in one another internal table.
select belnr WRBTR dmbtr from bseg
for all entries in t_cobrb
where bukrs =t_cobrb-bukrs and
hkont = t_cobrb-hkont
and zuonr = t_cobrb-zuonr.
please suggest
thanks
2006 May 17 12:43 PM
Use following table instead of BSEG
BSEG Access
BSAD Accounting: Secondary index for customers (cleared items)
BSAK Accounting: Secondary index for vendors (cleared items)
BSAS Accounting: Secondary index for G/L accounts (cleared items)
BSID Accounting: Secondary index for customers
BSIK Accounting: Secondary index for vendors
BSIM Secondary Index, Documents for Material
BSIS Accounting: Secondary index for G/L accounts
regards
vinod
Hi,
Is there any way to improve the performance of the following query as I am selecting data from clustered table BSEG for all entries found in one another internal table.
select belnr WRBTR dmbtr from bseg
for all entries in t_cobrb
where bukrs =t_cobrb-bukrs and
hkont = t_cobrb-hkont
and zuonr = t_cobrb-zuonr.
please suggest
thanks
2006 May 17 12:35 PM
when using FOR ALL ENTRIES , check if the table is not initial
<b>if t_cobrb[] is not initial.</b>
select belnr WRBTR dmbtr from bseg
for all entries in t_cobrb
where bukrs =t_cobrb-bukrs and
hkont = t_cobrb-hkont
and zuonr = t_cobrb-zuonr.
<b>endif.</b>
2006 May 17 12:37 PM
Hai Bobby
write like this
first you will sort t_cobrb by Key field(bukrs)
if not t_cobrb[] is initial.
select belnr WRBTR dmbtr from bseg
for all entries in t_cobrb
where bukrs =t_cobrb-bukrs and
hkont = t_cobrb-hkont
and zuonr = t_cobrb-zuonr.
endif.
Thanks & regards
Sreenivasulu P
2006 May 17 12:43 PM
Use following table instead of BSEG
BSEG Access
BSAD Accounting: Secondary index for customers (cleared items)
BSAK Accounting: Secondary index for vendors (cleared items)
BSAS Accounting: Secondary index for G/L accounts (cleared items)
BSID Accounting: Secondary index for customers
BSIK Accounting: Secondary index for vendors
BSIM Secondary Index, Documents for Material
BSIS Accounting: Secondary index for G/L accounts
regards
vinod
2006 May 17 12:44 PM
hi Bobby,
sort t_cobrb by key fields. and also check if it is initial before selecting the data from bseg.
if t_cobrb is not initial.
select belnr WRBTR dmbtr from bseg
for all entries in t_cobrb
where bukrs =t_cobrb-bukrs and
hkont = t_cobrb-hkont
and zuonr = t_cobrb-zuonr.
endif.
into table is missing in the above query and also take care that the order of selection of fiels belnr,wrbtr,dmbtr matches the order in the datbase table bseg. this will improve the performance.
Award points if helpful.
regards,
keerthi.
2006 May 17 12:45 PM
Select statement will work faster if we provide the fields in WHERE clause in the same order as they exists in the table.
in your case ZUONR appears before than HKONT.so give ZUONR first & then HKONT next.
select belnr WRBTR dmbtr from bseg
for all entries in t_cobrb
where bukrs =t_cobrb-bukrs
<b>and zuonr = t_cobrb-zuonr
and hkont = t_cobrb-hkont.</b>
and also if you are using FOR ALL ENTRIES its always suggestable to check the table is not initial.
In your case first check T_COBRB[] IS NOT INTIAL. THEN go for select. else all records from BSEG will come to your table.
& one more thing <b>where is your target internal table</b> ??
regards
srikanth
Message was edited by: Srikanth Kidambi
2006 May 17 12:47 PM
Try to see the secondary index table BSIS , query on BSIS table,will solve problem. since BSEG is cluster.
if not t_cobrb[] is initial.
select belnr WRBTR dmbtr from<b> bsis</b>
for all entries in t_cobrb
where bukrs =t_cobrb-bukrs and
hkont = t_cobrb-hkont
and zuonr = t_cobrb-zuonr.
endif.Regards
vijay
2006 May 17 2:40 PM
hi,
the reproof to tables BSIK, BSAK, etc. isn't correct in that requirement.
Its' only correct when Bobby is searching documents from vendors or customers only. If he's searching documents for G/L-accounts ( it seems so, because of his where clause with HKONT) there are many accounts (P&L) which have no open item-management. And so no BSIS / BSAS.
So try 1st to select table bkpf and than Bseg with key bukrs belnr gjahr.
Andreas
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |