Scenario: Whenever a new record is created a workflow is executed which sends a mail to desired user intimating about the new record.


  1. Lets create table with emp id as key field.     

    

     2. Create the table maintenance generator for above table.

     

     3. For triggering the work flow we need to create an event. From below screen shot create an event. 

              

     Our scenario is generating a workflow whenever a record is created. So Event is creating a new entry.
        

    

     The code is to change the start date field to sy-datum and create an event using the function module SAP_WAPI_CREATE_EVENT.

     Once the  event is created it is linked to workflow. So click editor button .


     Write below code:

  

    

     4.Now we need to create a business object. Go to Tcode: SWO1 and give the name and press create button:

    

     5. Create an event and release the business object.

    

     6.  Now we need to create a work flow definition using workflow builder. Go to tcode: SWDD. By default last workflow will be there.           Create a new one and save it.
    

 

     7.Need to create an event by using basic data button on application tool bar as below.

    

     8.Activate the start events by clicking A button.

    

     9.   Do the binding now by clicking the B button. 

    

      

10. Now we need to do the agent assignment by clicking the on application tool bar.

     Click on attributes button    
    

     Go back and save it.

 

     11. Now workflow looks like:

    

     12. Add the Mail step type

    

     And press transfer to graphic button.


     13. Now workflow looks like as below:    
        

     Activate the workflow.

     Testing:          

     Create a record in SE16

    

     and save it. Now a mail will be triggered in tcode SBWP as below:

    

    



    

To report this post you need to login first.

10 Comments

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

  1. Jocelyn Dart

    Nice to see the old code slots have not been entirely forgotten! 

    Wondering if you have tried passing the key or some other details of the new table entry as event parameters? That would make for an even stronger scenario as you could then direct the table changes to the appropriate stakeholder e.g. based on which employee id was entered.

    Rgds,

    Jocelyn

    (0) 
  2. Vikas Singh

    Have you considered sending an email using class CL_BCS ? I like workflows when user decision steps are involved but for simple notifications I normally just use the class and not bother workflow engine.

    Of course, you can customize it better using the class methods.

    (0) 
    1. Bala Manchikalapat

      Hi Vikas Singh,

      Thanks for your reply. I too agree using CL_BCS triggering email. I will work with CL_BCS and simultanously , want to keep ready in SandBox enviornment on WORKFLOW if my lead says go with Workflow.

      Also please let me know the steps involve using Workflow.

      Where to write SELECT COMMANDS and how to trigger workflow when the stock falls below re-order pt. ( Only for some critical Parts ).

      This SELECT COMMAND will check the stock in MMBE for perticular Material and check against MM03, if stock is less than RE-ORDER PT then WORKFLOW Email should trigger.

      I need to have a condition ” If the stock falls below Re-order pt in Material Master – then email , else do nothing .

      Apprieciate, if you provide me the steps involve in this.

      With Regards,

      Bala M

      (0) 
  3. Tejas Joshi

    Good Example, and reusable in lot of spaces not only to send the Data and change notification but to handle some other scenarios as well on the change of table.

    E.G. We have used this to send a Letter to stakeholders based on the data changes in the table as this was to be sent to External stakeholders.

    (0) 
  4. gaurav jain

    Can you suggest , how to trigger event for Standard SAP table.

    Last time I remember doing that, it was not possible.

    Could you please let me know.

    (0) 

Leave a Reply