Skip to Content
0
Former Member
Nov 29, 2005 at 11:40 AM

Regarding Performance tuning issue in following ABAP Code

240 Views

Hi All,

I have issue regarding <b>Performance Tuning</b> of a program. can any body solve how can i increase the performance of the program.

I am giving the main part of code which we need to tune to decrease the execution time.

Here is main code that we need to tune.

FORM f_find_lead_time.

DATA i_temp_marc LIKE i_marc OCCURS 0 WITH HEADER LINE.

CONSTANTS: c_eq(2) TYPE c VALUE 'EQ',

c_i TYPE c VALUE 'I'.

DATA: l_werks LIKE i_marc-werks,

l_wzeit LIKE i_marc-wzeit,

l_material LIKE csap_mbom-matnr,

l_plant LIKE csap_mbom-werks,

l_bom_usage LIKE csap_mbom-stlan,

l_alternative LIKE csap_mbom-stlal,

l_tabix_marc LIKE sy-tabix,

l_tabix_marc1 LIKE sy-tabix,

l_tabix_upd LIKE sy-tabix,

l_tabix_wzeit LIKE sy-tabix,

l_matnr LIKE mara-matnr.

LOOP AT i_bom.

l_material = i_bom-matnr.

l_plant = i_bom-werks.

l_bom_usage = i_bom-stlan.

l_alternative = i_bom-stlal.

CLEAR: i_stpo, r_range_matnr.

REFRESH: i_stpo, r_range_matnr.

CALL FUNCTION 'CSAP_MAT_BOM_READ'

EXPORTING

material = l_material

plant = l_plant

bom_usage = l_bom_usage

alternative = l_alternative

TABLES

t_stpo = i_stpo

EXCEPTIONS

error = 1

OTHERS = 2.

IF sy-subrc <> 0.

CONTINUE.

ENDIF.

LOOP AT i_stpo.

CLEAR l_matnr.

l_matnr = i_stpo-component.

READ TABLE i_marc WITH KEY matnr = l_matnr

werks = i_bom-werks BINARY SEARCH.

IF sy-subrc EQ 0.

l_tabix_upd = sy-tabix.

i_marc-upd = c_x.

MODIFY i_marc INDEX l_tabix_upd. CLEAR i_marc.

ENDIF.

r_range_matnr-option = c_eq.

r_range_matnr-sign = c_i.

r_range_matnr-low = i_stpo-component.

APPEND r_range_matnr. CLEAR r_range_matnr.

ENDLOOP.

i_temp_marc[] = i_marc[].

DELETE i_temp_marc WHERE NOT ( matnr IN r_range_matnr AND

werks = i_bom-werks ).

SORT i_temp_marc BY wzeit DESCENDING.

READ TABLE i_temp_marc INDEX 1.

READ TABLE i_marc WITH KEY matnr = i_bom-matnr

werks = i_bom-werks BINARY SEARCH.

IF sy-subrc EQ 0.

l_tabix_marc = sy-tabix.

i_marc-ztlt = i_temp_marc-wzeit .

i_marc-wzeit = i_marc-zlt + i_marc-ztlt.

i_marc-upd = c_x.

MODIFY i_marc INDEX l_tabix_marc. CLEAR i_marc.

ENDIF.

l_werks = i_bom-werks.

DO.

READ TABLE i_marc WITH KEY matnr = i_bom-matnr

werks = l_werks BINARY SEARCH.

IF sy-subrc = 0.

l_tabix_marc = sy-tabix.

IF i_marc-ind IS INITIAL.

l_wzeit = i_marc-wzeit.

i_marc-ind = c_x.

i_marc-upd = c_x.

MODIFY i_marc INDEX l_tabix_marc TRANSPORTING ind upd.

CLEAR i_marc.

ELSE.

EXIT.

ENDIF.

LOOP AT i_marc WHERE matnr = i_bom-matnr AND pwwrk = l_werks.

  • READ TABLE i_marc WITH KEY matnr = i_bom-matnr

  • pwwrk = l_werks.

  • IF sy-subrc = 0.

l_tabix_marc1 = sy-tabix.

  • LOOP AT i_marc FROM l_tabix_marc1.

  • IF i_marc-matnr = i_bom-matnr AND i_marc-werks = l_werks.

i_marc-ztlt = l_wzeit.

i_marc-wzeit = i_marc-zlt + i_marc-ztlt.

l_werks = i_marc-werks.

i_marc-upd = c_x.

MODIFY i_marc INDEX l_tabix_marc1 TRANSPORTING ztlt wzeit upd.

CLEAR i_marc.

  • ELSE.

  • EXIT.

  • ENDIF.

  • ENDLOOP.

  • ENDIF.

ENDLOOP.

IF sy-subrc NE 0.

EXIT.

ENDIF.

ELSE.

EXIT.

ENDIF.

ENDDO.

ENDLOOP.

ENDFORM. "f_find_lead_time

While Running above code program is taking lot of time so can any body give me the solution how to solve this performance issue to make the program run fast.

In the above program as per our test data

<b>I_BOM Internal table is containing 6 Rows of Data</b>.

<b>I_STPO Internal table is containing 2 Rows of Data</b>.

<b>I_MARC Internal table is containing more than 4000 Rows of Data</b>.

So can anybody solve my issue where by i can reduce the execution time of above code[PERFORM] without changing any program logic.

Can anybody solve my problem.

Also please clarify how can we do the parallel processing to the above.

Thanks in advance.

waiting for a reply.

Thanks & Regards,

Rayeez.