Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

performance

Hi

This is a piece of code . can anyone suggest me how to increase the performance . ,

tx

LOOP AT WERTETAB .

CLEAR : FLAG , FLAG1 .

MOVE-CORRESPONDING WERTETAB TO IT_FINAL .

SHIFT IT_FINAL-MATNR LEFT DELETING LEADING '0' .

IT_FINAL-SLEVEL = WERTETAB-AKT_MENGE .

****For stock level

  • Select single lbkum into IT_FINAL-SLEVEL from mbew

  • where matnr = wertetab-matnr and bwkey = wertetab-werks .

.

***For Total stock value

SELECT SUM( WBWBEST ) INTO IT_FINAL-SVALUE FROM S032

WHERE MATNR EQ

WERTETAB-MATNR

AND WERKS EQ

WERTETAB-WERKS.

*****For Total No of Usages

SELECT SUM( AGVBR ) FROM S033 INTO IT_FINAL-AGVBR

WHERE MATNR EQ WERTETAB-MATNR

AND WERKS EQ WERTETAB-WERKS

AND SPTAG IN S_DATE .

****

LOOP AT MSEG101 WHERE MATNR = WERTETAB-MATNR

AND WERKS = WERTETAB-WERKS .

  • IT_FINAL-BWART = MSEG101-BWART .

  • IT_FINAL-LGORT = MSEG101-LGORT .

IT_FINAL-LRDATE = MSEG101-BUDAT.

IT_FINAL-LRQTY = MSEG101-MENGE.

PERFORM REQ_USG .

  • APPEND IT_FINAL .

  • CLEAR : IT_FINAL-LRDATE , IT_FINAL-LRQTY, IT_FINAL-AFNAM ,

  • it_final-agvbr, IT_FINAL-BWART , IT_FINAL-LGORT,MSEG101 .

EXIT .

ENDLOOP .

LOOP AT MSEG201 WHERE MATNR = WERTETAB-MATNR

AND WERKS = WERTETAB-WERKS .

*clear : IT_FINAL-SLEVEL , IT_FINAL-SVALUE.

    • IT_FINAL-BWART = MSEG201-BWART .

  • IT_FINAL-LGORT = MSEG201-LGORT .

IT_FINAL-LIDATE = MSEG201-BUDAT.

IT_FINAL-LIQTY = MSEG201-MENGE .

IF FLAG NE 'X' .

PERFORM REQ_USG1 .

ENDIF.

  • APPEND IT_FINAL .

  • CLEAR : IT_FINAL-LIDATE , IT_FINAL-LIQTY,

  • IT_FINAL-AFNAM , it_final-agvbr,

*IT_FINAL-BWART,IT_FINAL-LGORT ,MSEG201.

EXIT .

ENDLOOP .

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question