Skip to Content
0
Former Member
May 11, 2010 at 10:49 AM

Performance tuning for Sales Order and its configuration data extraction

49 Views

I write here the data fetching subroutine of an extract report.

This report takes 2.5 hours to extract 36000 records in the quality server.

Kindly provide me some suggestions for performance tuning it.

SELECT auart vkorg vtweg spart vkbur augru

kunnr yxinsto bstdk vbeln kvgr1 kvgr2 vdatu

gwldt audat knumv

FROM vbak

INTO TABLE it_vbak

WHERE vbeln IN s_vbeln

AND erdat IN s_erdat

AND auart IN s_auart

AND vkorg = p_vkorg

AND spart IN s_spart

AND vkbur IN s_vkbur

AND vtweg IN s_vtweg.

IF NOT it_vbak[] IS INITIAL.

SELECT mvgr1 mvgr2 mvgr3 mvgr4 mvgr5

yyequnr vbeln cuobj

FROM vbap

INTO TABLE it_vbap

FOR ALL ENTRIES IN it_vbak

WHERE vbeln = it_vbak-vbeln

AND posnr = '000010'.

SELECT bstkd inco1 zterm vbeln

prsdt

FROM vbkd

INTO TABLE it_vbkd

FOR ALL ENTRIES IN it_vbak

WHERE vbeln = it_vbak-vbeln.

SELECT kbetr kschl knumv

FROM konv

INTO TABLE it_konv

FOR ALL ENTRIES IN it_vbak

WHERE knumv = it_vbak-knumv

AND kschl = 'PN00'.

SELECT vbeln parvw kunnr

FROM vbpa

INTO TABLE it_vbpa

FOR ALL ENTRIES IN it_vbak

WHERE vbeln = it_vbak-vbeln

AND parvw IN ('PE', 'YU', 'RE').

ENDIF.

LOOP AT it_vbap INTO wa_vbap.

IF NOT wa_vbap-cuobj IS INITIAL.

CALL FUNCTION 'VC_I_GET_CONFIGURATION'

EXPORTING

instance = wa_vbap-cuobj

language = sy-langu

TABLES

configuration = it_config

EXCEPTIONS

instance_not_found = 1

internal_error = 2

no_class_allocation = 3

instance_not_valid = 4

OTHERS = 5.

IF sy-subrc = 0.

READ TABLE it_config WITH KEY atnam = 'IND_PRODUCT_LINES'.

IF sy-subrc = 0.

wa_char-obj = wa_vbap-cuobj.

wa_char-atnam = it_config-atnam.

wa_char-atwrt = it_config-atwrt.

APPEND wa_char TO it_char.

CLEAR wa_char.

ENDIF.

READ TABLE it_config WITH KEY atnam = 'IND_GQ'.

IF sy-subrc = 0.

wa_char-obj = wa_vbap-cuobj.

wa_char-atnam = it_config-atnam.

wa_char-atwrt = it_config-atwrt.

APPEND wa_char TO it_char.

CLEAR wa_char.

ENDIF.

READ TABLE it_config WITH KEY atnam = 'IND_VKN'.

IF sy-subrc = 0.

wa_char-obj = wa_vbap-cuobj.

wa_char-atnam = it_config-atnam.

wa_char-atwrt = it_config-atwrt.

APPEND wa_char TO it_char.

CLEAR wa_char.

ENDIF.

READ TABLE it_config WITH KEY atnam = 'IND_ZE'.

IF sy-subrc = 0.

wa_char-obj = wa_vbap-cuobj.

wa_char-atnam = it_config-atnam.

wa_char-atwrt = it_config-atwrt.

APPEND wa_char TO it_char.

CLEAR wa_char.

ENDIF.

READ TABLE it_config WITH KEY atnam = 'IND_HQ'.

IF sy-subrc = 0.

wa_char-obj = wa_vbap-cuobj.

wa_char-atnam = it_config-atnam.

wa_char-atwrt = it_config-atwrt.

APPEND wa_char TO it_char.

CLEAR wa_char.

ENDIF.

READ TABLE it_config WITH KEY atnam = 'IND_CALCULATED_INST_HOURS'.

IF sy-subrc = 0.

wa_char-obj = wa_vbap-cuobj.

wa_char-atnam = it_config-atnam.

wa_char-atwrt = it_config-atwrt.

APPEND wa_char TO it_char.

CLEAR wa_char.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP. " End of loop on it_vbap

Edited by: jaya rangwani on May 11, 2010 12:50 PM

Edited by: jaya rangwani on May 11, 2010 12:52 PM