Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
nivedithaa
Explorer
16,610
Introduction:

This Blog is about to Basics on Workflow and how to create an Workflow for approval and rejection and then send an email to user. Before doing that I will explain about the basic terminology used in Workflow and when we will use this concept.

We generally use this concept in any module as per their business requirements in SAP. For Example, Employee submit his Leave Request to manager, manager needs to approve or reject the request. On this scenario we can use this concept by using work flow.

Workflow:

The workflow definition is the set of rules that determine the path that the process takes. For example, how a Leave request is processed from initial to end.

Basic terminology used in the workflow: 

Tasks are the steps in the process, which have to be performed either by people or automatically by the software. 

Workflow Instance, which is often simply referred to as the workflow, is a single workflow run.

Work item is the task instance that is performed as a single workflow step.

Agents are the people who process the tasks (via the work items).

Container is the place where all the data used in the workflow is collected.

Binding is the set of rules that define which data is passed to which part of the process.

Building a simple workflow application for approval and rejection and then send an email to user:

Step 1: T-code SWDD (Work flow Builder).


Click on Create button on top left in the screen and.


The initial workflow screen has the following parts:

  1. The start of the workflow definition, indicated by  Workflow Started.

  2. The end of the workflow definition, indicated by   Workflow Completed.

  3. The area in which you insert the new workflow definition is indicated by Undefined Double-click for new step.


Step 2: Now select the undefined step and select Create step or double click the undefined step. 

Among the different steps chose the User Decision by double clicking on it.


By Clicking on User Decision, it navigates to a window where we can define the terms like approve or reject.

Provide the Title and decision texts, then click on Transfer and to Graphic button as shown in below screen shot.


By clicking on Transfer button, a popup will appears for requesting for the abbreviation and the name for this task. Enter the same and press enter.


Step 3: Now enter you package and press enter.

Now select Transfer and to graphic button. Following screen appears:


Now we need to include a mail step to be sent to the requestor. Now select the line “Approve” and do a right click. Different options on shown on the context menu. Select Create button.


Now select the step “Send Mail” from the list.



 

 

 

 

 

 

 

 

 

 

 

 

 

Now enter the subject and the body of the message for the mail to be sent.


 Follow the same step(Approve) for the step “Reject”. The following screen appears


Press SAVE to save the workflow application. You need to enter an abbreviation and name for your workflow. You can change any of these at any later point. After saving, a number is assigned to your workflow starting with WS.

Output:

Click on Execute button. The following screen appears


Choose one among Approve  or Reject as part of the user decision. He can select the third option to retain the work item in his inbox and make the decision later.

Now suppose that the recipient has chosen one of the first options. Now a mail would be sent to the requestor with the status of his request(you can see the mail status in SOST Tcode).


Finally we achieved it, we can approve or reject the leave request using Workflow.

The summary of this blog is Workflow can be used in any module based on business requirements. Once we create a Workflow, we can achieve this functionality through SWDD or code.

Hope this blog might help you.

 
3 Comments
Labels in this area