*&---------------------------------------------------------------------*
*& Report ZSDR101
*&
*&---------------------------------------------------------------------*
*& Run finished MRP
*&
*&---------------------------------------------------------------------*
Report zsdr101.
Data:i_mrp_plan_param like Bapi_mrp_plan_param occurs 0 with HEADER line,
I_mrp_statistic like bapi_mrp_statistic occurs 0 with HEADER line,
I_return like Bapiret2 occurs 0 with HEADER line.
Data:begin of I_mara occurs 0,
Matnr like Mara-matnr,
Werks like Marc-werks,
END of I_mara.
DATA:I_DISMM like MARC-DISMM,
I_mmsta like Marc-mmsta.
Initialization.
Start-of-selection.
PERFORM GetData.
*&---------------------------------------------------------------------*
*& Form GetData
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
FORM GetData.
SELECT * into corresponding fields of TABLE I_mara
From Mara as a JOIN Marc as B
On a~matnr = B~matnr
WHERE A~mtart = ' Fert '
and a~lvorm = ' '
and b~lvorm = ' '
and (B~werks = ' 3110 ' or b~werks = ' 3120 ' or b~werks = ' 3220 ' or b~werks = ' 3130 ')
and Mstae = ". "Cross-plant material status freeze removed, in material master base data 1 view
Refresh:i_mrp_plan_param.
I_mrp_plan_param-proc_type = ' Netch '.
I_mrp_plan_param-create_purreq = ' 2 '.
I_mrp_plan_param-create_sched_lines = ' 3 '.
i_mrp_plan_param-create_mrp_list = ' 1 '.
I_mrp_plan_param-planning_mode = ' 1 '.
APPEND I_mrp_plan_param.
LOOP at I_mara.
* Select Single dismm mmsta from MARC to (I_dismm,i_mmsta)
* Where Matnr = I_mara-matnr and Werks = ' 1000 '.
SELECT single dismm from Marc to (I_DISMM)
WHERE Matnr = I_mara-matnr and Werks = I_mara-werks.
IF SY-SUBRC = 4.
CONTINUE.
ELSEIF SY-SUBRC = 0.
IF i_dismm = ' ND '.
CONTINUE.
ENDIF.
* IF i_mmsta ne '. "Specific plant material status removed, in MRP view
* CONTINUE.
* ENDIF.
ENDIF.
Call FUNCTION ' bapi_material_planning '
Exporting
Material = I_mara-matnr
Plant = I_mara-werks
* Mrp_area =
* Plan_scenario =
Mrp_plan_param = I_mrp_plan_param
* MATERIAL_EVG =
Importing
Mrp_statistic = i_mrp_statistic
return = I_return.
* TABLES
* Mrp_lists =
* Extensionout =
WRITE at:/2 (I_MARA-MATNR), I_return-message.
CLEAR:I_DISMM, I_mmsta.
Clear:i_mara.
Endloop.
EndForm. "GetData
zsdr101-Run finished MRP