MRP資訊彙總BAPI(Z_IF_MRP_TOTAL_LIST)

SAP劍客發表於2015-06-03

根據期間(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> <wbr> <wbr>REFRESH:
 <wbr> <wbr> <wbr> <wbr> <wbr>IT_MRP_TOTAL_LINES[],
 <wbr> <wbr> <wbr> <wbr> <wbr>IT_MRP_ITEM_LINES[],
 <wbr> <wbr> <wbr> <wbr> <wbr>IT_MRP_IND_LINES[].

 <wbr> <wbr> <wbr> <wbr>CALL <wbr>FUNCTION <wbr>'BAPI_MATERIAL_MRP_LIST'
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>EXPORTING
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>MATERIAL <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>= <wbr>IT_MARC-MATNR
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>PLANT <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>= <wbr> <wbr>I_WERKS
<wbr> <wbr> <wbr>MRP_AREA <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>=
<wbr> <wbr> <wbr>PLAN_SCENARIO <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>=
<wbr> <wbr> <wbr>DISPLAY_FILTER <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>=
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>PERIOD_INDICATOR <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>= <wbr>I_PERIOD_FLAG
<wbr> <wbr> <wbr>VENDOR_NO <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>=
<wbr> <wbr> <wbr>DISPLAY_TO <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>=
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>GET_ITEM_DETAILS <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>='X'
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>GET_IND_LINES <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>= <wbr>'X'
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>GET_TOTAL_LINES <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>='X'
<wbr> <wbr> <wbr>MATERIAL_EVG <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>=
<wbr>IMPORTING
<wbr> <wbr> <wbr>MRP_LIST <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>=
<wbr> <wbr> <wbr>RETURN <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>=
 <wbr> <wbr> <wbr> <wbr> <wbr>TABLES
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>MRP_ITEMS <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>= <wbr>IT_MRP_ITEM_LINES
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>MRP_IND_LINES <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>= <wbr>IT_MRP_IND_LINES
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>MRP_TOTAL_LINES <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>= <wbr>IT_MRP_TOTAL_LINES
<wbr> <wbr> <wbr>EXTENSIONOUT <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>=
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>.

 <wbr> <wbr> <wbr> <wbr>IF <wbr>SY-SUBRC <wbr>EQ <wbr>0.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>LOOP <wbr>AT <wbr>IT_MRP_ITEM_LINES.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>MOVE-CORRESPONDING <wbr>IT_MRP_ITEM_LINES <wbr>TO <wbr>TB_MRP_ITEM_LINES.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>TB_MRP_ITEM_LINES-MATNR <wbr>= <wbr>IT_MARC-MATNR.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>TB_MRP_ITEM_LINES-WERKS <wbr>= <wbr>I_WERKS.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>APPEND <wbr>TB_MRP_ITEM_LINES.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>ENDLOOP.

 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>LOOP <wbr>AT <wbr>IT_MRP_IND_LINES.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>MOVE-CORRESPONDING <wbr>IT_MRP_IND_LINES <wbr>TO <wbr>TB_MRP_IND_LINES.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>GT_MRP_IND_LINES-MATNR <wbr>= <wbr>IT_MARC-MATNR.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>TB_MRP_IND_LINES-WERKS <wbr>= <wbr>I_WERKS.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>APPEND <wbr>TB_MRP_IND_LINES.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>ENDLOOP.

 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>LOOP <wbr>AT <wbr>IT_MRP_TOTAL_LINES.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>MOVE-CORRESPONDING <wbr>IT_MRP_TOTAl_LINES <wbr>TO <wbr>TB_MRP_TOTAL_LINES.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>TB_MRP_TOTAL_LINES-MATNR <wbr>= <wbr>IT_MARC-MATNR.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>TB_MRP_TOTAL_LINES-WERKS <wbr>= <wbr>I_WERKS.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>APPEND <wbr>TB_MRP_TOTAL_LINES.
 <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>ENDLOOP.
 <wbr> <wbr> <wbr> <wbr>ENDIF.


 <wbr> <wbr>ENDLOOP.

ENDFUNCTION.

相關文章