Skip to Content
0
Former Member
Dec 02, 2008 at 09:05 AM

mkpf table performance

150 Views

here is my code . its taking 12 hours to complete for one plant which is having 14000 material for 300 days.

when i see in sm51 it is showing error in MKPF table.

any body can give any idea?? i shall be thankful.

SELECT MATNR WERKS FROM MARC INTO TABLE IT_MARC

WHERE MATNR IN S_MATNR

AND WERKS = P_WERKS.

IF IT_MARC[] IS NOT INITIAL.

SELECT MATNR MTART MATKL FROM MARA INTO TABLE IT_MARA

for all entries in IT_MARC

WHERE matnr = it_marc-matnr

and MTART in s_MTART

AND MATKL IN S_MATKL.

ENDIF.

LOOP AT IT_MARA.

IT_STOCK-MATNR = IT_MARA-MATNR.

IT_STOCK-WERKS = P_WERKS.

IT_STOCK-MTART = IT_MARA-MTART.

IT_STOCK-MATKL = IT_MARA-MATKL.

APPEND IT_STOCK.

ENDLOOP.

SELECT AMBLNR AMJAHR ABUDAT BZEILE BMATNR BMENGE BDMBTR BSHKZG BWERKS BBWART BXAUTO BBUSTW BSJAHR BSMBLN B~MEINS

INTO TABLE I_STK_GRGI

FROM MKPF AS A INNER JOIN MSEG AS B ON AMBLNR = BMBLNR

AND AMJAHR = BMJAHR

FOR ALL ENTRIES IN IT_STOCK

WHERE A~MBLNR BETWEEN '0000000001' AND '9999999999'

AND A~BUDAT BETWEEN L1_STDATE AND L_DATE

AND B~MATNR = IT_STOCK-MATNR

AND b~bwart NOT IN (311, 312)

AND B~WERKS = IT_STOCK-WERKS.