2008 May 16 7:07 AM
Hello frnds,
I m accessing bsis table with this query.
select bukrs hkont augdt augbl zuonr gjahr belnr buzei bschl
dmbtr prctr
from bsis into table i_temp2
for all entries in i_belnr2
where bukrs eq company
and hkont in r_hkont
and belnr = i_belnr2-belnr
and budat in date.
i_belnr2 contains some 3k records.
I m getting a time out dump after 25 mins...
Can anyone pls suggest me is there any way that
i can make this query optimized ?
or any function modules for this specific i/p and o/p parameters?
or any logical database ?
Rgds,
Santhosini K
2008 May 16 7:38 AM
Hi,
Check the sample code and proceed accordingly to optimize the Query on BSIS Table.
REPORT ztest NO STANDARD PAGE HEADING LINE-SIZE 80 MESSAGE-ID 00.
TABLES: bkpf, bseg, bsis.
DATA: bkpf_int TYPE TABLE OF bkpf WITH HEADER LINE,
bseg_int TYPE TABLE OF bseg WITH HEADER LINE,
bsis_int TYPE TABLE OF bsis WITH HEADER LINE,
BEGIN OF i_indata1 OCCURS 0,
t_pdate TYPE bkpf-budat,
t_kioid TYPE bseg-zuonr,
END OF i_indata1.
SELECT bukrs belnr gjahr budat
FROM bkpf INTO CORRESPONDING FIELDS OF TABLE bkpf_int
FOR ALL ENTRIES IN i_indata1
WHERE bukrs = 'BP01' AND
bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z') AND
gjahr = sy-datum+0(4) AND
budat = i_indata1-t_pdate.
SELECT bukrs belnr gjahr buzei zuonr wrbtr shkzg
FROM bseg INTO CORRESPONDING FIELDS OF TABLE bseg_int
FOR ALL ENTRIES IN bkpf_int
WHERE bukrs = bkpf_int-bukrs AND
belnr = bkpf_int-belnr AND
gjahr = bkpf_int-gjahr AND
koart = 'S'. "GL Accounts
SORT: bkpf_int BY bukrs belnr gjahr,
bseg_int BY bukrs belnr gjahr buzei,
i_indata1 BY t_kioid.
LOOP AT bseg_int.
READ TABLE i_indata1 WITH KEY
t_kioid = bseg_int-zuonr
BINARY SEARCH.
CHECK sy-subrc = 0.
READ TABLE bkpf_int WITH KEY
bukrs = bseg_int-bukrs
belnr = bseg_int-belnr
gjahr = bseg_int-gjahr
BINARY SEARCH.
CHECK sy-subrc = 0.
MOVE: bkpf_int-budat TO bsis_int-budat,
bseg_int-zuonr TO bsis_int-zuonr,
bseg_int-wrbtr TO bsis_int-wrbtr,
bseg_int-shkzg TO bsis_int-shkzg.
APPEND bsis_int.
ENDLOOP.
[/code]
Regards,
Raj
Hello frnds,
I m accessing bsis table with this query.
select bukrs hkont augdt augbl zuonr gjahr belnr buzei bschl
dmbtr prctr
from bsis into table i_temp2
for all entries in i_belnr2
where bukrs eq company
and hkont in r_hkont
and belnr = i_belnr2-belnr
and budat in date.
i_belnr2 contains some 3k records.
I m getting a time out dump after 25 mins...
Can anyone pls suggest me is there any way that
i can make this query optimized ?
or any function modules for this specific i/p and o/p parameters?
or any logical database ?
Rgds,
Santhosini K
2008 May 16 7:28 AM
Hi,
Before this select u write another select for retriving data in to i_belnr2 internam table.
Check this internal table is empty or contain records.
IF NOT i_belnr2[] IS INITIAL.
Then write u r code.
(select bukrs hkont augdt augbl zuonr gjahr belnr buzei bschl
dmbtr prctr
from bsis into table i_temp2
for all entries in i_belnr2
where bukrs eq company
and hkont in r_hkont
and belnr = i_belnr2-belnr
and budat in date.)
if u not check internal table is not iniotial ,it get's all the records i_belnr2 table if above condition is false.
insert this if end endif condition in u r report.
Reward if useful.
Regards,
Narasimha
2008 May 16 7:36 AM
Hi
Also u can create the INDEX on the above conditions. This will also improve the perforance.
Thanks
2008 May 16 7:38 AM
Hi,
Check the sample code and proceed accordingly to optimize the Query on BSIS Table.
REPORT ztest NO STANDARD PAGE HEADING LINE-SIZE 80 MESSAGE-ID 00.
TABLES: bkpf, bseg, bsis.
DATA: bkpf_int TYPE TABLE OF bkpf WITH HEADER LINE,
bseg_int TYPE TABLE OF bseg WITH HEADER LINE,
bsis_int TYPE TABLE OF bsis WITH HEADER LINE,
BEGIN OF i_indata1 OCCURS 0,
t_pdate TYPE bkpf-budat,
t_kioid TYPE bseg-zuonr,
END OF i_indata1.
SELECT bukrs belnr gjahr budat
FROM bkpf INTO CORRESPONDING FIELDS OF TABLE bkpf_int
FOR ALL ENTRIES IN i_indata1
WHERE bukrs = 'BP01' AND
bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z') AND
gjahr = sy-datum+0(4) AND
budat = i_indata1-t_pdate.
SELECT bukrs belnr gjahr buzei zuonr wrbtr shkzg
FROM bseg INTO CORRESPONDING FIELDS OF TABLE bseg_int
FOR ALL ENTRIES IN bkpf_int
WHERE bukrs = bkpf_int-bukrs AND
belnr = bkpf_int-belnr AND
gjahr = bkpf_int-gjahr AND
koart = 'S'. "GL Accounts
SORT: bkpf_int BY bukrs belnr gjahr,
bseg_int BY bukrs belnr gjahr buzei,
i_indata1 BY t_kioid.
LOOP AT bseg_int.
READ TABLE i_indata1 WITH KEY
t_kioid = bseg_int-zuonr
BINARY SEARCH.
CHECK sy-subrc = 0.
READ TABLE bkpf_int WITH KEY
bukrs = bseg_int-bukrs
belnr = bseg_int-belnr
gjahr = bseg_int-gjahr
BINARY SEARCH.
CHECK sy-subrc = 0.
MOVE: bkpf_int-budat TO bsis_int-budat,
bseg_int-zuonr TO bsis_int-zuonr,
bseg_int-wrbtr TO bsis_int-wrbtr,
bseg_int-shkzg TO bsis_int-shkzg.
APPEND bsis_int.
ENDLOOP.
[/code]
Regards,
Raj
2008 May 16 7:47 AM
Hi Santhosini,
SELECT SINGLE
buzei " Number of Line Item
dmbtr " Amount in local currency
waers " Currency key
FROM bsis
INTO (w_litem,
w_dmbtr,
w_waers)
WHERE bukrs EQ w_bukrs
AND hkont EQ c_acc_no_400310
AND gjahr EQ w_fyear
AND buzei IN r_acc_item
AND budat EQ w_wadat
AND xblnr EQ w_delv....If found helpfull do Reward.
Regards.
Eshwar.
2008 May 16 8:05 AM
Thank u for ur valuble suggestions.....
I have checked for initial and tried INDEXING. But still the system is struck in that query.
BAPI_GL_ACC_GETBALANCE
BAPI_GL_ACC_GETCURRENTBALANCE
BAPI_GL_ACC_GETPERIODBALANCES
also G_ACCOUNT_BALANCE_ACC_GET.
i have found out these BAPIs and FMs..
But i want some help in matching my i/p and o/p parameters with those of these
BAPI s and FMs.....
Rgds,
Santhosini
2008 May 17 9:11 PM
Since you have BUKRS and BELNR, it'll probably be faster just to go to BSEG to get your data.
Rob
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |