Skip to Content
0
Former Member
Jul 23, 2007 at 06:24 AM

please optimize the below code!!!!urgent

20 Views

friends,

i know that cluster tables cannot be joined with transparent tables....

however i need performance improvement for the following code....

if possible is there a way to join bkpf or bseg to improve performance....can we create view foe bkpf and bseg if yes then how.....

please modify the below code for improvement in performance.

START-OF-SELECTION.

SELECT bukrs belnr gjahr budat FROM bkpf INTO TABLE i_bkpf

WHERE bukrs = p_bukrs AND "COMPANY CODE

gjahr = p_gjahr AND "FISCAL YEAR

budat IN s_budat. "POSTING DATE IN DOC

IF sy-subrc = 0.

SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE

i_bseg FOR ALL ENTRIES IN i_bkpf

WHERE bukrs = i_bkpf-bukrs AND "COMPANY CODE

belnr = i_bkpf-belnr AND "A/CING DOC NO

gjahr = i_bkpf-gjahr AND "FISCAL YEAR

hkont = p_hkont. "General Ledger Account"

IF sy-subrc = 0.

SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE

i_bseg1 FOR ALL ENTRIES IN i_bseg

WHERE bukrs = i_bseg-bukrs AND "COMPANY CODE

belnr = i_bseg-belnr AND "A/CING DOC NO

gjahr = i_bseg-gjahr. "FISCAL YEAR

ENDIF.

ENDIF.

IF NOT i_bseg1[] IS INITIAL.

LOOP AT i_bseg1.

IF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'S'.

v_sumgl = v_sumgl + i_bseg1-dmbtr.

ELSEIF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'H'.

v_sumgl = v_sumgl - i_bseg1-dmbtr.

ELSEIF i_bseg1-hkont NE p_hkont .

IF i_bseg1-shkzg = 'H'.

i_bseg1-dmbtr = - i_bseg1-dmbtr.

ENDIF.

i_alv-hkont = i_bseg1-hkont.

i_alv-dmbtr = i_bseg1-dmbtr.

APPEND i_alv.

v_sumoffset = v_sumoffset + i_bseg1-dmbtr.

ENDIF.

ENDLOOP.

regards

Essam.(essamsaud@yahoo.co.in)