Material Master method (Long)
Stiles, Les
Les.Stiles at icn.siemens.com
Wed Mar 26 08:20:24 EST 2003
I take no credit as the original instructions were posted on this forum by
Ronen Fox on Jan. 16, 2003. My version is shown here for informational
purposes only. For the most part, it works in our 4.6C environment with the
exception of the MRP and Forecast profile parameters (Help!).
Steps for implementing the method:
1. Create a subtype for BUS1001006
2. In the subtype create a new synchronous method called
'Create_Specific_View'
3. Create the following parameters for the method (all havve 'import'
attribute:
Name Table-Field Description (Ref.
Parameter ID)
MaintenanceStatus MOFF-STATUM Maintenance Status
ViewPlant MOFF-WERKS Plant WRK
SalesOrganization MOFF-VKORG Sales Organization VKO
DistChnl MOFF-VTWERG Distribution Channel VTW
MRPProfile MARC-DISPR MRP profile DPR
ForecastProfile MPRP-PROPR Forecast Profile PPR
SLoc MOFF-LGORT Storage Location LAG
WMNo MOFF-LGNUM Warehouse Number LGN
StorageType MOFF-LGTYP Storage Type LGT
4. Create the following coding for the method:
BEGIN_METHOD CREATE_SPECIFIC_VIEW CHANGING CONTAINER.
DATA: MAINTENANCESTATUS LIKE SY-ENTRY,
VIEWPLANT LIKE MOFF-WERKS,
SalesOrganization like MOFF-VKORG,
DistChnl like MOFF-VTWEG,
MRPProfile like MARC-DISPR,
ForecastProfile like MPRP-PROPR,
SLoc like MOFF-LGORT,
WMNo like MOFF-LGNUM,
StorageType like MOFF-LGTYP,
IT_MOFF TYPE MOFF.
SWC_GET_ELEMENT CONTAINER 'MaintenanceStatus' MAINTENANCESTATUS.
SWC_GET_ELEMENT CONTAINER 'ViewPlant' VIEWPLANT.
SWC_GET_ELEMENT CONTAINER 'SalesOrganization' SalesOrganization.
SWC_GET_ELEMENT CONTAINER 'DistChnl' DistChnl.
SWC_GET_ELEMENT CONTAINER 'SLoc' SLoc.
SWC_GET_ELEMENT CONTAINER 'WMNo' WMNo.
SWC_GET_ELEMENT CONTAINER 'StorageType' StorageType.
SWC_GET_ELEMENT CONTAINER 'MRPProfile' MRPProfile.
SWC_GET_ELEMENT CONTAINER 'ForecastProfile' ForecastProfile.
SELECT SINGLE * FROM MOFF INTO IT_MOFF
WHERE STATM = MAINTENANCESTATUS
AND MATNR = OBJECT-KEY-MATERIAL.
IF SY-SUBRC IS INITIAL.
PERFORM CREATE_ONE_VIEW USING IT_MOFF
ViewPlant
SalesOrganization
DistChnl
SLoc
WMNo
StorageType
MRPProfile
ForecastProfile.
ENDIF.
END_METHOD.
FORM CREATE_ONE_VIEW USING MOFF STRUCTURE MOFF
ViewPlant
SalesOrganization
DistChnl
SLoc
WMNo
StorageType
MRPProfile
ForecastProfile.
SET PARAMETER ID 'MAT' FIELD OBJECT-KEY-MATERIAL.
SET PARAMETER ID 'WRK' FIELD ViewPlant.
SET PARAMETER ID 'VKO' FIELD SalesOrganization.
SET PARAMETER ID 'VTW' FIELD DistChnl.
SET PARAMETER ID 'LAG' FIELD SLoc.
SET PARAMETER ID 'LGN' FIELD WMNo.
SET PARAMETER ID 'LGT' FIELD StorageType.
SET PARAMETER ID 'DPR' FIELD MRPProfile.
SET PARAMETER ID 'PPR' FIELD ForecastProfile.
SET PARAMETER ID 'MTA' FIELD MOFF-MTART.
SET PARAMETER ID 'MTP' FIELD MOFF-MBRSH.
SET PARAMETER ID 'BWT' FIELD ' '.
SET PARAMETER ID 'MXX' FIELD MOFF-STATM. "Sicht-Popup #bergehen
SET PARAMETER ID 'MM5' FIELD ' '. "Org-Popup #bergehen
SET PARAMETER ID 'MM6' FIELD ' '. "Mat.VB durchlaufen-Flag
CALL TRANSACTION 'MM01' and Skip First Screen.
ENDFORM.
5. Create a task for each specific view to be using the method and make sure
to pass the specific parameter values for that view to the task via the
binding in the workflow step.
I also created another synchronous method to add multiple Storage Locations.
It uses the 'MMSC' to perform this task. However, I cannot use it because
the transaction will not terminate correctly and return to the workflow. It
leaves the workflow hanging at that step. It does appear to initiate (open)
the transaction properly. I am providing it so that maybe someone can
determine how to make it work correctly (parameter ViewPlant is setup the
same as in the previous method):
BEGIN_METHOD CREATE_STORAGE_VIEW CHANGING CONTAINER
DATA: VIEWPLANT LIKE MOFF-WERKS.
SWC_GET_ELEMENT CONTAINER 'ViewPlant' VIEWPLANT.
Set Parameter ID 'MAT' field object-key-material.
set Parameter ID 'WRK' field ViewPlant.
IF SY-SUBRC IS INITIAL.
Call transaction 'MMSC' and skip first screen.
ENDIF.
END_METHOD.
Hopes this helps someone,
Les Stiles
Systems Analyst, QM & WF
Siemens ICN
Lake Mary FL
les.stiles at icn.siemens.com
More information about the SAP-WUG
mailing list