Skip to Content
0
Former Member
Mar 24, 2006 at 10:25 AM

Goods receipt report

18 Views

Hello,

I wrote a report regarding materials that don't have a goods receipt in the last x days. It works , but I am not satisfied by the performance of the report.

First, I have selected all the materials that I consider as active in the sistem.

SELECT DISTINCT mara~matnr FROM mara

JOIN marc ON maramatnr = marcmatnr

JOIN mard ON maramatnr = mardmatnr

INTO CORRESPONDING FIELDS OF TABLE T_MATNR

WHERE mara~matnr IN so_matnr

AND marc~werks = p_plant

AND marc~ekgrp IN s_raion

AND mara~lvorm <> 'X'

AND mard~labst <> 0

ORDER BY mara~matnr.

After this selection I am verifiy each material selected before if it has a goods receipt in my conditions.

LOOP AT t_matnr INTO s_matnr.

SELECT single msegmatnr mkpfbudat FROM mseg

JOIN mkpf ON msegmblnr = mkpfmblnr

INTO CORRESPONDING FIELDS OF TABLE T_MATNRX

WHERE matnr = s_matnr-matnr AND bwart = '101'

AND mseg~werks = p_plant

AND mkpf~budat > my_date

ORDER BY budat DESCENDING.

DELETE t_matnrx FROM 3.

IF t_matnrx[] IS INITIAL.

APPEND s_matnr TO t_matnry.

ENDIF.

ENDLOOP.

This takes very long, because I have ~ 40000 items in MARA. What can I do to improove the performance?