01-12-2008 5:38 AM
Hello gurus,
I am using bseg,bsid,bsad,bkpf table in customer ledger without any inner join only using simple select statemnet , but my report get very slow whenever it get to collect data from bkpf.
Please guide me how to improve the performance , is LDB is the better option .
if yes , the n how i will be overlap my selection screen over ldb screen.
Please guide me .
Points will be surely awarded.
Priya.
01-12-2008 5:43 AM
hi,
What is LDB?.....
for ur try to use
for all entries in....
e.g
SELECT kunnr
umskz
bukrs
gjahr
belnr
budat
bldat
xblnr
blart
shkzg
gsber
dmbtr
zfbdt
zbd1t
zbd2t
zbd3t
vbeln
FROM bsid
INTO CORRESPONDING FIELDS OF TABLE i_bsid
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND hkont IN s_hkont
AND blart IN s_blart
AND budat LE p_date.
SELECT kunnr
bukrs
umskz
gjahr
belnr
budat
bldat
xblnr
blart
shkzg
gsber
dmbtr
zfbdt
zbd1t
zbd2t
zbd3t
FROM bsad
APPENDING CORRESPONDING FIELDS OF TABLE i_bsid
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND blart IN s_blart
AND budat LE p_date "posting date in the document
AND augdt GT p_date " clearing date
AND augdt LE sy-datum.
SELECT belnr "invoice no(document no).
gjahr "fisical year
bschl "Posting Key
zfbdt "Baseline date for due date calculation
FROM bseg
INTO TABLE i_bseg
FOR ALL ENTRIES IN i_bsid
WHERE belnr = i_bsid-belnr
AND gjahr = i_bsid-gjahr
AND bschl = c_15.
SELECT kunnr name1 FROM kna1
INTO TABLE i_kna1
FOR ALL ENTRIES IN i_bsid
WHERE kunnr = i_bsid-kunnr.
hope it is solved your problem.
Regards,
Arpit
01-12-2008 5:43 AM
hi,
What is LDB?.....
for ur try to use
for all entries in....
e.g
SELECT kunnr
umskz
bukrs
gjahr
belnr
budat
bldat
xblnr
blart
shkzg
gsber
dmbtr
zfbdt
zbd1t
zbd2t
zbd3t
vbeln
FROM bsid
INTO CORRESPONDING FIELDS OF TABLE i_bsid
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND hkont IN s_hkont
AND blart IN s_blart
AND budat LE p_date.
SELECT kunnr
bukrs
umskz
gjahr
belnr
budat
bldat
xblnr
blart
shkzg
gsber
dmbtr
zfbdt
zbd1t
zbd2t
zbd3t
FROM bsad
APPENDING CORRESPONDING FIELDS OF TABLE i_bsid
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND blart IN s_blart
AND budat LE p_date "posting date in the document
AND augdt GT p_date " clearing date
AND augdt LE sy-datum.
SELECT belnr "invoice no(document no).
gjahr "fisical year
bschl "Posting Key
zfbdt "Baseline date for due date calculation
FROM bseg
INTO TABLE i_bseg
FOR ALL ENTRIES IN i_bsid
WHERE belnr = i_bsid-belnr
AND gjahr = i_bsid-gjahr
AND bschl = c_15.
SELECT kunnr name1 FROM kna1
INTO TABLE i_kna1
FOR ALL ENTRIES IN i_bsid
WHERE kunnr = i_bsid-kunnr.
hope it is solved your problem.
Regards,
Arpit
01-12-2008 5:50 AM
Hi,
ya i had done the same coding using 'for all entries' but as data is very large it make the program very slow, whenever it reached to the statment to collect data from bkpf or bseg.
LDB : Logical database , we can club no of tables to improve the performance but we had to create down selection screen in ldb . but i need my program selection screen.
is it feasible?
thanks.
01-12-2008 5:48 AM
Hi,
It is always better to avoid to make use of BSEG table because it would lead to performance problem so it is always better to go for any of the secondary tables
GL Secondary table
BSAS
BSIS
Vendor Table
BSAK
BSIK
Customer Table
BSAD
BSID
REGARDS
suresh nair
01-12-2008 5:53 AM
hi suresh,
Ya it is fine ! but i had to collect value date field which is only present in bseg.
and secondly i had avoid the report to take reverse document so i had to bkpf table.
so i cannt avoid both of them.
01-12-2008 6:05 AM
01-12-2008 6:10 AM
hi arpit,
this is the part of my coding where i am getting problem.
SELECT kunnr bukrs belnr zuonr shkzg wrbtr gjahr budat blart xblnr umskz buzei vbeln augbl augdt
INTO TABLE i_bsad FROM bsad FOR ALL ENTRIES IN i_tab1
WHERE kunnr EQ i_tab1-kunnr AND budat IN d_date
AND umskz NE 'D' AND umskz NE 'M'
AND ( blart NE 'AB' ) AND ( ( blart EQ 'RV' ) OR ( blart EQ 'DZ' AND umskz NE 'C' )
OR ( blart EQ 'DR') OR ( blart EQ 'Z2' ) OR ( blart EQ 'DG') OR ( blart EQ 'SA' AND umskz NE 'C' )
OR ( blart EQ 'Z1') OR ( blart EQ 'Z4') OR ( blart EQ 'Z5')
OR ( blart EQ 'Z3') OR ( blart EQ 'DA') OR ( blart EQ 'ZR') ).
IF SY-SUBRC = 0.
SELECT belnr xreversal gjahr INTO TABLE i_bkpf FROM bkpf FOR ALL ENTRIES IN i_bsad
WHERE belnr = i_bsad-belnr AND gjahr = i_bsad-gjahr AND ( xreversal EQ '2' OR xreversal EQ '1' ).ENDIF.
LOOP AT i_bsad.
READ TABLE i_bkpf WITH KEY belnr = i_bsad-belnr gjahr = i_bsad-gjahr.
IF sy-subrc = 0 .
DELETE i_bsad.
ENDIF.
ENDLOOP.
*
SELECT kunnr bukrs belnr zuonr shkzg wrbtr gjahr budat blart xblnr umskz buzei vbeln augbl augdt
INTO TABLE i_bsad1 FROM bsad FOR ALL ENTRIES IN i_tab1
WHERE kunnr EQ i_tab1-kunnr AND augdt IN d_date
AND ( blart NE 'AB' ) AND ( ( blart EQ 'UE' AND umskz EQ 'C' )
OR ( blart EQ 'SA' AND umskz EQ 'C' ) OR ( blart EQ 'DZ' AND umskz EQ 'C' )
OR ( blart EQ 'SA' AND umskz EQ 'M' ) OR ( blart EQ 'DZ' AND umskz EQ 'M' ) )
AND umskz NE 'D' .
IF sy-subrc = 0.
SELECT belnr xreversal gjahr INTO TABLE i_bkpf1 FROM bkpf FOR ALL ENTRIES IN i_bsad1
WHERE belnr = i_bsad1-belnr AND gjahr = i_bsad1-gjahr AND ( xreversal EQ '2' OR xreversal EQ '1' ). ENDIF.
LOOP AT i_bsad1.
READ TABLE i_bkpf1 WITH KEY belnr = i_bsad1-belnr gjahr = i_bsad1-gjahr.
IF sy-subrc = 0 .
DELETE i_bsad1.
ENDIF.
ENDLOOP.
LOOP AT i_bsad1.
APPEND i_bsad1 TO i_bsad.
ENDLOOP.
The coding which is bold is getting problem.
Priya
01-12-2008 6:11 AM
Instead of BSEG, try to fetch data from BSAD/BSID ( not the Cluster table) which will have the same records as in BSEG ( Cluster table).
Revrt back if any issues.
Regards,
Naveen
01-12-2008 6:33 AM
hi,
i had told that i need 'VALUT' value date that is present in bseg only,
is thier any other option.
Priya
11-22-2008 9:11 AM
Hi,
It is always better to avoid to make use of BSEG table because it would lead to performance problem so it is always better to go for any of the secondary tables
GL Secondary table
BSAS
BSIS
Vendor Table
BSAK
BSIK
Customer Table
BSAD
BSID
REGARDS
suresh nair