Skip to Content
0
Former Member
Jan 08, 2008 at 12:31 PM

Performance Tuning Issues ( How to Optimize this Code)

34 Views

_How to Optimize this Code_

FORM MATL_CODE_DESC.

SELECT * FROM VBAK WHERE VKORG EQ SAL_ORG AND

VBELN IN VBELN AND

VTWEG IN DIS_CHN AND

SPART IN DIVISION AND

VKBUR IN SAL_OFF AND

VBTYP EQ 'C' AND

KUNNR IN KUNNR AND

ERDAT BETWEEN DAT_FROM AND DAT_TO.

SELECT * FROM VBAP WHERE VBELN EQ VBAK-VBELN AND

MATNR IN MATNR.

SELECT SINGLE * FROM MAKT WHERE MATNR EQ VBAP-MATNR.

IF SY-SUBRC EQ 0.

IF ( VBAP-NETWR EQ 0 AND VBAP-UEPOS NE 0 ).

IF ( VBAP-UEPVW NE 'B' AND VBAP-UEPVW NE 'C' ).

MOVE VBAP-VBELN TO ITAB1-SAL_ORD_NUM.

MOVE VBAP-POSNR TO ITAB1-POSNR.

MOVE VBAP-MATNR TO ITAB1-FREE_MATL.

MOVE VBAP-KWMENG TO ITAB1-FREE_QTY.

MOVE VBAP-KLMENG TO ITAB1-KLMENG.

MOVE VBAP-VRKME TO ITAB1-FREE_UNIT.

MOVE VBAP-WAVWR TO ITAB1-FREE_VALUE.

MOVE VBAK-VTWEG TO ITAB1-VTWEG.

MOVE VBAP-UEPOS TO ITAB1-UEPOS.

ENDIF.

ELSE.

MOVE VBAK-VBELN TO ITAB1-SAL_ORD_NUM.

MOVE VBAK-VTWEG TO ITAB1-VTWEG.

MOVE VBAK-ERDAT TO ITAB1-SAL_ORD_DATE.

MOVE VBAK-KUNNR TO ITAB1-CUST_NUM.

MOVE VBAK-KNUMV TO ITAB1-KNUMV.

  • SELECT SINGLE * FROM KONV WHERE KNUMV EQ VBAK-KNUMV AND

  • KSTEU = 'C' AND

  • KHERK EQ 'A' AND

  • KMPRS = 'X'.

  • IF SY-SUBRC EQ 0.

  • ITAB1-REMARKS = 'Manual Price Change'.

  • ENDIF.

SELECT SINGLE * FROM KONV WHERE KNUMV EQ VBAK-KNUMV AND

KSTEU = 'C' AND

KHERK IN ('C','D') AND

KMPRS = 'X' AND

KRECH IN ('A','B').

IF SY-SUBRC EQ 0.

IF KONV-KRECH EQ 'A'.

MOVE : KONV-KSCHL TO G_KSCHL.

G_KBETR = ( KONV-KBETR / 10 ).

MOVE G_KBETR TO G_KBETR1.

CONCATENATE G_KSCHL G_KBETR1 '%'

INTO ITAB1-REMARKS SEPARATED BY SPACE.

ELSEIF KONV-KRECH EQ 'B'.

MOVE : KONV-KSCHL TO G_KSCHL.

G_KBETR = KONV-KBETR.

MOVE G_KBETR TO G_KBETR1.

CONCATENATE G_KSCHL G_KBETR1

INTO ITAB1-REMARKS SEPARATED BY SPACE.

ENDIF.

ELSE.

ITAB1-REMARKS = 'Manual Price Change'.

ENDIF.

CLEAR : G_KBETR, G_KSCHL,G_KBETR1.

MOVE VBAP-KWMENG TO ITAB1-QTY.

MOVE VBAP-VRKME TO ITAB1-QTY_UNIT.

IF VBAP-UMVKN NE 0.

ITAB1-KLMENG = ( VBAP-UMVKZ / VBAP-UMVKN ) * VBAP-KWMENG.

ENDIF.

IF ITAB1-KLMENG NE 0.

VBAP-NETWR = ( VBAP-NETWR / VBAP-KWMENG ).

MOVE VBAP-NETWR TO ITAB1-INV_PRICE.

ENDIF.

MOVE VBAP-POSNR TO ITAB1-POSNR.

MOVE VBAP-MATNR TO ITAB1-MATNR.

MOVE MAKT-MAKTX TO ITAB1-MAKTX.

ENDIF.

SELECT SINGLE * FROM VBKD WHERE VBELN EQ VBAK-VBELN AND

BSARK NE 'DFUE'.

IF SY-SUBRC EQ 0.

ITAB1-INV_PRICE = ITAB1-INV_PRICE * VBKD-KURSK.

APPEND ITAB1.

CLEAR ITAB1.

ELSE.

CLEAR ITAB1.

ENDIF.

ENDIF.

ENDSELECT.

ENDSELECT.

ENDFORM. " MATL_CODE_DESC