Tutorial Sap Workflow
Create asubtype „ZMARAJES‟of your material object type by entering your parent object „ZMARAJESUB‟.
Extend your new object type so that it meets additional requirements.
For the workflow development , you require events as triggering or terminating events of your tasks. Create two new events BasicMaterialChanged and OldMaterialChanged for your object type.
Implement the two events using eventcreation from change documents.The Change document required is MATERIAL. Restrict the triggering of the event for BasicMaterialChanged to the mara-wrkst field and for OldMaterialChanged to mara-bismt. For the Old MaterialChanged, add a field restriction so that the event is only triggered when mara-bismt changes from anything to NEW. Type transaction SWEC for the change document event creation.Define another DeadlineTest event for you object type with a LatestEndDate parameter Referring to the syst-datum field. This parameter will be used to transfer an end deadline for a step within a workflow.
Create a new ChangedBy attribute based on the mara-aenam field. This attribute specifies the user who last changed the underlying material. You will use this attribute later to filter out yourmaterial.
Create a new Change method on the basis of transaction MM02. This transaction writes your changes to the database using an update task. deselect the synchronous flag in General tab.
Now select the method and then choose the program icon to generate the code. BEGIN_METHOD CHANGE CHANGING CONTAINER. DATA: MATERIALVIEW TYPE T132T-STATM. SWC_GET_ELEMENT CONTAINER 'MaterialView'MATERIALVIEW. IF MATERIALVIEW IS INITIAL. MATERIALVIEW = 'K'. ENDIF. SET PARAMETER ID 'MAT' FIELD OBJECT-KEY-MATERIAL. SET PARAMETER ID 'MXX' FIELD MATERIALVIEW. CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN. END_METHOD. Create a new DisplayView method. The purpose ot this method is to display a material from a particular view. The Desired view is to be transferred using the MaterialView inputparameter. Select the flag dialog and synchronous in General tab.
Select the program icon to generate the code.You need to add code to set the view to K that is „Basis Data 1‟as a default(This default the view to the basis view if no view is received). You can diplay the actual view using transacation MM03. transaction MM03 recognizes a SET/GET parameter MXX Which you can use to control the viewwhere the transaction is started. Supply this SET/GET parameter with your input parameter value. BEGIN_METHOD DISPLAYVIEW CHANGING CONTAINER. DATA: MATERIALVIEW TYPE T132T-STATM. SWC_GET_ELEMENT CONTAINER 'MaterialView' MATERIALVIEW. IF MATERIALVIEW IS INITIAL. MATERIALVIEW = 'K'. ENDIF. SET PARAMETER ID 'MAT' FIELD OBJECT-KEY-MATERIAL. SET PARAMETER ID 'MXX' FIELD MATERIALVIEW. CALL TRANSACTION'MM03' AND SKIP FIRST SCREEN. SWC_set_ELEMENT CONTAINER 'MaterialView' MATERIALVIEW. END_METHOD. A Material master can be assigned to several different plants.Create a plant virtual attribute that refers to your object type zplantje. ZPLANTJE object type is following.
***** Implementation of object type ZPLANTJE ** INCLUDE . BEGIN_DATA OBJECT. " Do not change.. DATA is generated * only private...
Regístrate para leer el documento completo.