我很好
分类: WINDOWS
2008-05-23 10:32:26
库存/需求清单(MD04)和MRP清单-物料(MD05)无论是输入和显示的内容都非常相像,它们的区别在于:MD04是动态的,实时显示库存/需求的变化情况;MD05是静态的,它仅仅显示对上一次MRP运行后的结果。
REPORT ZCR_TEST .
*TABLES : TSTCT.
**
*
*DATA : BEGIN OF I_TSTCT OCCURS 0.
*INCLUDE STRUCTURE TSTCT.
*DATA : END OF I_TSTCT.
**
*DATA I_RESULT LIKE I_TSTCT OCCURS 0 WITH HEADER LINE.
*DATA : L_TTEXT LIKE TSTCT-TTEXT.
**
*PARAMETERS : PSTR LIKE TSTCT-TTEXT.
**
*START-OF-SELECTION.
*SELECT * FROM TSTCT INTO I_TSTCT
*WHERE SPRSL = 'EN'.
*APPEND I_TSTCT.
*ENDSELECT.
**
*CONCATENATE '*' PSTR '*' INTO PSTR.
*LOOP AT I_TSTCT .
*CLEAR L_TTEXT.
*MOVE I_TSTCT-TTEXT TO L_TTEXT.
*IF L_TTEXT CP PSTR .
*MOVE-CORRESPONDING I_TSTCT TO I_RESULT.
*APPEND I_RESULT.
*ENDIF.
*ENDLOOP.
**
*WRITE :/5 'Tran. code'.
*WRITE : 20 'Description'.
*SKIP 1.
*LOOP AT I_RESULT.
*WRITE :/5 I_RESULT-TCODE.
*WRITE : 20 I_RESULT-TTEXT.
*ENDLOOP.
*******************************************
TABLES:
cm61w, "MRP Control
cm61m, "MRP Control Indicator -Material Level-
t399d, "Control Parameters for MRP
masel, "Help fields for line selection
mdkp,
mtcom,
mt61d,
cm61x,
t001w,
mdst. "Control string for stock
DATA: BEGIN OF i_mdpsx OCCURS 0.
INCLUDE STRUCTURE mdps.
DATA: END OF i_mdpsx.
DATA: BEGIN OF dummy OCCURS 0,
dummy,
END OF dummy.
DATA: BEGIN OF i_mdsta OCCURS 1.
INCLUDE STRUCTURE mdsta.
DATA: END OF i_mdsta.
SELECT SINGLE mdobj
mdaty
mdakt
into cm61x
FROM t450n
* INTO (t450n-mdobj,t450n-mdaty,t450n-mdakt)
WHERE tcode = 'MD04'.
* IF sy-subrc = 0.
* MOVE t450n-mdobj TO cm61x-plobj.
* MOVE t450n-mdaty TO cm61x-plauf.
* MOVE t450n-mdakt TO cm61x-plakt.
* MOVE sy-datlo TO cm61x-dispd.
* ENDIF.
SELECT SINGLE *
FROM t001w
INTO t001w
WHERE werks = '2031'.
SELECT SINGLE *
FROM t399d
INTO t399d
WHERE werks = '2031'.
MOVE t001w-fabkl TO cm61w-fabkl.
MOVE t001w-fabkl TO cm61w-fabkl.
MOVE t399d-umthz TO cm61w-umthz.
MOVE cm61x-dispd TO cm61w-dispd.
MOVE t399d-gterm TO cm61w-gterm. "Hinweis 40847
*--> Welche Zug?nge gehen in Bestandsreichweite 2 ein ?
MOVE t399d-selfe TO cm61w-selfe.
MOVE t399d-selbe TO cm61w-selbe.
MOVE t399d-selqm TO cm61w-selqm.
MOVE t399d-selba TO cm61w-selba.
MOVE t399d-selpa TO cm61w-selpa.
MOVE t399d-selpz TO cm61w-selpz.
MOVE t399d-selzr TO cm61w-selzr.
MOVE t399d-sella TO cm61w-sella.
MOVE 'MT61D' TO mtcom-kenng.
MOVE sy-langu TO mtcom-spras.
MOVE '000000000101000022' TO mtcom-matnr.
MOVE '2031' TO mtcom-werks.
CALL FUNCTION 'MATERIAL_LESEN'
EXPORTING
schluessel = mtcom
IMPORTING
matdaten = mt61d
TABLES
seqmat01 = dummy.
IF sy-subrc = 0.
endif.
CALL FUNCTION 'AUFBAUEN_MDPSX_ANZEIGEN'
EXPORTING
emt61d = mt61d
ecm61x = cm61x
ecm61w = cm61w
et399d = t399d
* ecm61b = cm61b
* esfilt = sfilt
IMPORTING
imdkp = mdkp
imdsta = i_mdsta
icm61m = cm61m
TABLES
mdpsx = i_mdpsx
EXCEPTIONS
error_message = 01.
* IF sy-subrc = 0.
* endif.
LOOP AT i_mdpsx.
write : / i_mdpsx-MNG01.
ENDLOOP.