Objective:Send workitem to the user’s Business Workplace on Material Change.

Purpose:Whenever a Material will change in MM02, a workitem will be sent to the creator of the material and the user who will change the material with the description ‘Material Property is changed from ‘’ to ‘’ ‘to their Business Workplace.

Business Scenario:Whenever a Material ‘Unit (MEINS)’ will change from MM02 a workitem will be sent to the creator of the material and the user who will change the material with the description ‘Material Property is changed from ‘’ to ‘’ ‘to their Business Workplace.

Process: This demo will involve the following steps:       

  • Copy the Standard BUS BUS1001 (Material) into custom ZBUS1001.
  • Create an Event ‘CHANGED’ for Change Material to trigger the Workflow.
  • Make an entry in SWEC for ‘Events for Change Document’ and put the Change doc. Object: ‘MATERIAL’ Object Type: ‘ZBUS1001’ and Event ‘CHANGED’. Select the radio button Trigger event ‘On Change’.
  • Go to SWDD and build a Workflow.
  • Create a Method to get changed Material data using a Function Module.
  • Create a Multiline Container Element to hold multiple Agents in lines.
  • Create a Method to get Agent from multiline container element.
  • Use Fork to send mail to users parallely.
  • Use that Multiline Container Element in Send Mail step to send work item to different users.

Prerequisites: It is assumed that the reader of the document has the knowledge of Change Document and Workflow builder.

(Many business objects are changed frequently, and these changes are logged into change documents to make the changes traceable. Change documents can be created for changes already made as well as for planned changes. Tables: CDHDR and CDPOS)

Step by step Approach:

1.      Go to SWO1 and copy the Standard BO: BUS1001 to custom ZBUS1001.

/wp-content/uploads/2014/09/1_538464.jpg

Create an Event ‘CHANGED’.

/wp-content/uploads/2014/09/2_538465.jpg

1.      Change Release status by navigate Edit ->Change Release Status -> Object Type Component -> To Implemented.

Then go to Edit ->Change Release Status -> Object Type Component -> To Released.

/wp-content/uploads/2014/09/3_538475.jpg

Go to Txn. SWEC to connect the Event with Change Doc. Object to trigger the workflow on change.

/wp-content/uploads/2014/09/5_538476.jpg

/wp-content/uploads/2014/09/6_538477.jpg

Go to SWDD and create a Workflow. Go to Basic Data and put Abbreviation and name for your workflow. Then Save it.

/wp-content/uploads/2014/09/7_538484.jpg

Go to Basic data -> Start Event. Put The Event CHANGED and Activate and Click on automatic binding to start Workflow.

/wp-content/uploads/2014/09/8_538485.jpg

1.      To get the Changed Data of Material we need to create a custom Method. Here we will create a Function Module to return the value of changed data.

Go to SE37 and provide the Function Module name.

/wp-content/uploads/2014/09/9_538486.jpg

Select the radio button Remote-Enabled to create a RFC enabled function module.

/wp-content/uploads/2014/09/10_538490.jpg

Put Import and Export parameters and select Pass By Value button for RFC-Enabled FM.

/wp-content/uploads/2014/09/11_538491.jpg

/wp-content/uploads/2014/09/12_538492.jpg

Write this piece of code to fetch data from Change Document tables: CDHDR and CDPOS. Source Code:

/wp-content/uploads/2014/09/13_538493.jpg

/wp-content/uploads/2014/09/14_538494.jpg

/wp-content/uploads/2014/09/15_538495.jpg

/wp-content/uploads/2014/09/16_538496.jpg

Save and Activate.

1.      Now Go to SWO1 and create a Method.

Create with Function module as template ‘Yes’.

/wp-content/uploads/2014/09/17_538497.jpg

/wp-content/uploads/2014/09/18_538498.jpg

/wp-content/uploads/2014/09/19_538499.jpg

/wp-content/uploads/2014/09/20_538500.jpg

Complete the full process and select Yes.

/wp-content/uploads/2014/09/21_538501.jpg

Now press the red button to generate the method successfully and follow the step 3 to release the component type method.

Now Create a Task from PFTC->Standard Task. Give a name to the task and put the method over here. Select Background Processing.

/wp-content/uploads/2014/09/22_538573.jpg

Click on Binding button and press Automatic Binding. Save the Task.

/wp-content/uploads/2014/09/23_538578.jpg

1.      Now go to SWDD and create an Activity step and put the Task over here.

Click on Binding and press Automatic Binding.

/wp-content/uploads/2014/09/24_538580.jpg

/wp-content/uploads/2014/09/25_538581.jpg

Make all workflow container element as import export parameter.

Now create another method to get agents. Here workitem would send to the two different user, one who created the Material and one who changed the material.

To achieve this functionality 1stcreate a multiline container element to hold Agents. Give SOXNA-FULLNAMEas ABAP dict. type.

/wp-content/uploads/2014/09/26_538582.jpg

Click on import, export and multiline and click on continue on Properties tab.

Now go to SWO1and create another method GETAGENT. Create two parameters MATNR as imp and IT_AGENT as export./wp-content/uploads/2014/09/28_538584.jpg

Click on Program and write down this piece of code.

/wp-content/uploads/2014/09/29_538585.jpg

/wp-content/uploads/2014/09/30_538586.jpg

Save and generate this method successfully. Next follow the step 3 to release the component.

/wp-content/uploads/2014/09/31_538587.jpg

Create another Task and give the method name over here. Click on Background Processing. Do Automatic Binding.

/wp-content/uploads/2014/09/32_538588.jpg

Go to SWDD and create another activity. Click Automatic Binding.

/wp-content/uploads/2014/09/34_538589.jpg

/wp-content/uploads/2014/09/35_538591.jpg

Now send workitem to the users parallel. To achieve this functionality use Fork. Parallel Branch ‘02’. Necessary branch ‘01’.

/wp-content/uploads/2014/09/36_538597.jpg

Create Send Mailstep to each branch. Pass the multiline container element IT_AGENT to the Recipients.

/wp-content/uploads/2014/09/37_538596.jpg

Click on Control tab and do necessary bindings. Click Transfer Graphic.

/wp-content/uploads/2014/09/38_538595.jpg

/wp-content/uploads/2014/09/39_538601.jpg

Now Your Workflow will look like this.

/wp-content/uploads/2014/09/40_538602.jpg

Finally go to Basic Data-> Start Event tab and do binding with Event container element Material’ with workflow container element ‘MATNR’ to start the workflow on ‘MATERIAL’ change. Activate the workflow.

/wp-content/uploads/2014/09/41_538603.jpg

Go to MM02Txn and make necessary changes. Workitem will be sent to two different users to their Business Workplace.

/wp-content/uploads/2014/09/42_538610.jpg

/wp-content/uploads/2014/09/43_538611.jpg

To report this post you need to login first.

12 Comments

You must be Logged on to comment or reply to a post.

  1. Paul Bakker

    Hi,

    Wow – thank you for this very detailed document. That would have taken a while to put together.

    In your first step, I’m wondering why you copied the BOR object instead of creating a subtype. When you ‘subtype’ you get the advantage of keeping the original object as well as adding whatever methods / events you wish. Best of both worlds.

    The code in the ZBAPI is a bit restrictive. You seem to be assuming that changes can only be made through transaction MM02. And what if there are multiple changes to the same material? I would add some selection/sorting by date.

    Good work – keep on posting!

    cheers

    Paul

    (0) 
  2. Cholen Tuna

    Hi Rituparna,

    Thanks for this wonderful document! I am trying to implement the same workflow and have been following the steps above. However, I am encountering errors on creating the GetAgent task in SWDD. If I change the left-handside values, I get “An object compatible with ‘[BO.ZBUS1001]’ was expected as the source expression”.

    I would think it’s because the parameters in the method are object type ZBUS1001? Or maybe the task was not created properly? Can you please share any advise you may have? Thanks!

    Capture.JPG

    Regards,

    Cholen

    (0) 

Leave a Reply