根據期間(D,W,M)彙總MRP資訊行
<wbr>
<wbr> FUNCTION <wbr>Z_IF_MRP_TOTAL_LIST.
*"----------------------------------------------------------------------
*"*"Local <wbr>interface:
*" <wbr> <wbr>IMPORTING
*" <wbr> <wbr> <wbr> <wbr> <wbr>VALUE(I_WERKS) <wbr>TYPE <wbr> <wbr>BAPI_MRP_MAT_PARAM-PLANT
*" <wbr> <wbr> <wbr> <wbr> <wbr>VALUE(I_MATNR) <wbr>TYPE <wbr> <wbr>BAPI_MRP_MAT_PARAM-MATERIAL <wbr>OPTIONAL
*" <wbr> <wbr> <wbr> <wbr> <wbr>VALUE(I_PERIOD_FLAG) <wbr>TYPE <wbr> <wbr>BAPI_MRP_LIST_PARAM-PERIOD_INDICATOR
*" <wbr> <wbr>TABLES
*" <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>TB_MRP_ITEM_LINES <wbr>STRUCTURE <wbr> <wbr>ZST_MRP_ITEM_LINES <wbr>OPTIONAL
*" <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>TB_MRP_IND_LINES <wbr>STRUCTURE <wbr> <wbr>ZST_MRP_IND_LINES <wbr>OPTIONAL
*" <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>TB_MRP_TOTAL_LINES <wbr>STRUCTURE <wbr> <wbr>ZST_MRP_TOTAL_LINES <wbr>OPTIONAL
*"----------------------------------------------------------------------
<wbr> <wbr>DATA: <wbr>IT_MRP_TOTAL_LINES <wbr>TYPE <wbr>TABLE <wbr>OF <wbr>BAPI_MRP_TOTAL_LINES <wbr> <wbr>WITH <wbr>HEADER <wbr>LINE.
<wbr> <wbr>DATA: <wbr>BEGIN <wbr>OF <wbr>GT_MRP_ITEM_LINES <wbr>OCCURS <wbr>0.
<wbr> <wbr>DATA: <wbr>MATNR <wbr>TYPE <wbr>BAPI_MRP_MAT_PARAM-MATERIAL.
<wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>INCLUDE <wbr>STRUCTURE <wbr> <wbr>BAPI_MRP_ITEMS.
<wbr> <wbr>DATA: <wbr>END <wbr>OF <wbr>GT_MRP_ITEM_LINES.
<wbr> <wbr>DATA <wbr> <wbr>IT_MRP_ITEM_LINES <wbr>TYPE <wbr>TABLE <wbr>OF <wbr>BAPI_MRP_ITEMS <wbr>WITH <wbr>HEADER <wbr>LINE.
<wbr> <wbr>DATA: <wbr>BEGIN <wbr>OF <wbr>GT_MRP_IND_LINES <wbr>OCCURS <wbr>0.
<wbr> <wbr>DATA: <wbr>MATNR <wbr>TYPE <wbr>BAPI_MRP_MAT_PARAM-MATERIAL.
<wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>INCLUDE <wbr>STRUCTURE <wbr> <wbr>BAPI_MRP_IND_LINES.
<wbr> <wbr>DATA: <wbr>END <wbr>OF <wbr>GT_MRP_IND_LINES.
<wbr> <wbr>DATA <wbr>IT_MRP_IND_LINES <wbr>TYPE <wbr>TABLE <wbr>OF <wbr>BAPI_MRP_IND_LINES <wbr>WITH <wbr>HEADER <wbr>LINE.
<wbr> <wbr>DATA: <wbr>BEGIN <wbr>OF <wbr>IT_MARC <wbr>OCCURS <wbr>0,
<wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>MATNR <wbr>TYPE <wbr>BAPI_MRP_MAT_PARAM-MATERIAL.
<wbr> <wbr>DATA: <wbr>END <wbr>OF <wbr>IT_MARC.
FIELD-SYMBOLS: <wbr> <wbr>type <wbr>table.
FIELD-SYMBOLS: <wbr> <wbr>.
<wbr>if <wbr>I_MATNR <wbr>IS <wbr>INITIAL.
<wbr> <wbr>SELECT <wbr>MATNR <wbr>INTO <wbr>TABLE <wbr>IT_MARC <wbr>FROM <wbr>MARC <wbr>WHERE <wbr>WERKS <wbr>= <wbr>I_WERKS
<wbr> <wbr>AND <wbr>DISMM <wbr>IN <wbr>('M0','PD').
<wbr>ELSE.
<wbr> <wbr>SELECT <wbr>MATNR <wbr>INTO <wbr>TABLE <wbr>IT_MARC <wbr>FROM <wbr>MARC <wbr>WHERE <wbr>WERKS <wbr>= <wbr>I_WERKS
<wbr> <wbr>AND <wbr>DISMM <wbr>IN <wbr>('M0','PD')
<wbr> <wbr>AND <wbr>MATNR <wbr>= <wbr>I_MATNR.
<wbr>ENDIF.
<wbr> <wbr>CHECK <wbr>NOT <wbr>IT_MARC[] <wbr>IS <wbr>INITIAL.
<wbr> <wbr>LOOP <wbr>AT <wbr>IT_MARC.
<wbr> <wbr>