Skip to Content
0
Former Member
Jan 02, 2008 at 04:09 PM

Performance issue - which one is better

15 Views

Method 1 :

  • IF ig_matwerks[] IS NOT INITIAL.

  • SELECT m~matnr

  • m~werks

  • m~ekgrp

  • m~mmsta

  • m~lgfsb

  • m~eisbe

  • m~bstfe

  • k~maktx

  • FROM marc AS m INNER JOIN makt AS k

  • ON mmatnr = kmatnr

  • INTO CORRESPONDING FIELDS OF TABLE ig_prefinal

  • FOR ALL ENTRIES IN ig_matwerks

  • WHERE m~matnr = ig_matwerks-matnr AND

  • m~werks = ig_matwerks-werks AND

  • k~spras = sy-langu.

***

  • SELECT m~matnr

  • r~werks

  • m~mtart

  • m~matkl

  • FROM mara AS m INNER JOIN marc AS r

  • ON mmatnr = rmatnr

  • INTO CORRESPONDING FIELDS OF TABLE ig_mara

  • FOR ALL ENTRIES IN ig_matwerks

  • WHERE m~matnr = ig_matwerks-matnr AND

  • r~werks = ig_matwerks-werks.

  • ENDIF.

***

  • Moving values mtart & matkl to prefinal table

***

  • IF ig_prefinal[] IS NOT INITIAL.

  • LOOP AT ig_prefinal.

  • SORT ig_mara BY matnr werks.

  • READ TABLE ig_mara WITH KEY matnr = ig_prefinal-matnr werks = ig_prefinal-werks BINARY SEARCH TRANSPORTING mtart matkl.

  • IF SY-SUBRC = 0.

  • ig_prefinal-mtart = ig_mara-mtart.

  • ig_prefinal-matkl = ig_mara-matkl.

  • MODIFY ig_prefinal TRANSPORTING mtart matkl.

  • ENDIF.

  • CLEAR: ig_mara, ig_prefinal.

  • ENDLOOP.

  • ENDIF.

( OR )

Method 2:

IF ig_matwerks[] IS NOT INITIAL.

SELECT m~matnr

m~werks

m~ekgrp

m~mmsta

m~lgfsb

m~eisbe

m~bstfe

k~maktx

a~mtart

a~matkl

FROM ( ( marc AS m INNER JOIN makt AS k

ON mmatnr = kmatnr )

INNER JOIN mara AS a

ON amatnr = kmatnr )

INTO CORRESPONDING FIELDS OF TABLE ig_prefinal

FOR ALL ENTRIES IN ig_matwerks

WHERE m~matnr = ig_matwerks-matnr AND

m~werks = ig_matwerks-werks AND

a~matnr = ig_matwerks-matnr AND

k~spras = sy-langu.

ENDIF.

Please let me know ....

Regards,

Abaper.