Workflows from the scratch!!!

SAP is one of the leading Enterprise solutions available in the market today. Earlier the market was being dominated by oracle products, but SAP has given it a healthy competition. All this has been very obvious with the amount of research input into the product by team SAP. Every year, SAP comes up with another feature to increase its strong hold on the ES market. I started working in SAP around five months back, and was astonished to know about the ever growing modules of SAP. Just a few days back, I completed the Security module, but I think another one will be on its way. But now, we are not here to discuss the different modules but — WORKFLOWS. One of the most astounding feature of SAP, the workflows, provide the programmer to forget about the programming and concentrate on the process. Something very similar to MS Studio. It is basically a flow based concept designed by SAP, as most of the organizations work on a Steady Flow concept rather than ad-hoc basis. During my learning of WorkFlows, I came across several issues which were solved by my friends and seniors, and so I thought of sharing them through this SDN Blog.

WORKFLOWS :: Lets try to define them!!!

SAP Workflow ensures ” the right work is brought in the right sequence at the right time to the right people”. It is a tool designed to facilitate and automate business processes that require tasks to be performed by people…. Blah, blah blah!!! All this and more is something you will find anywhere on google. So let me define it the way I think it is.

A workflow is a flowchart which depicts how work flows in an organization. Its often that the client just needs his software, he doesn’t want to get into the details of programming or transactions, he wants results. So here are Workflows. They do the job of data abstraction. They hide the functionality and simply carry the job for the client.

For the time being, take this as base, and start working with workflows.

Before starting to work in workflows, you should know the different components of workflows.

Workflows follow a three tier hierarchy. Each level affects the next and no over lapping takes place. Each workflow is controlled by tasks and business objects, terms which might sound alien to you at this moment, but for the time being just take this as a reading assignment.

A workflow is initiated once an event occurs in the SAP environment. It triggers the workflow and rest depends on the functionality of the workflow.

First Step::

To start with workflows, open swdd. You will see the screen has been divided into various sections like information area, navigation area, Graphical Model, etc. Explore these yourself. J

The graphical model is where we design the workflow. The three boxes visible are called steps in workflows. We will learn work flows here by doing an assignment whose difficulty level will be gradually increased as we move ahead. First things first, we will start off by creating a workflow which sends a mail to the workflow initiator, whenever a PO is generated. A workflow initiator is one who performs an event which is linked with our workflow and hence triggers it. He is a usual SAP user.

Here is the basic workflow look like when u first open swdd.

Double click on the middle button. A popup will show containing the various step types that you can use to create the workflows.

Since this is the first step in our assignment, in which we are going to send an email, we will be using the send mail step type. But as we go ahead with our tutorial, we will demonstrate and use the remaining ones too. For the time being, read the names of the different step types and try to find out what they r used for (most of them have obvious names). Double click on the Send Mail step type . the following window appears .

It has five tabs in it. For the time being, concentrate on the mail tab only. There are three sections in this . the first one says Recipients. Here we mention the name of the person we want to send the mail to. A recipient can be of 3 types.

Workflow initiator.

Organizational address and

Email address.

Workflow initiator I have already explained. Email address is an external pop3 email address like gmail or yahoo email id. This is used if u want to send mail outside the SAP environment. The third one is the organizational object. This explains the organizational structure for which the workflow is being created. It means the mail will be sent to a position in an organization.

To start with, put in as shown the workflow initiator, write something in the subject and some text as the body of the mail. Now when u clock on the control tab, a task will be automatically created. Double clicking it will show a method which is the default method to send mails. Take a note of this as we will be using it while working with other step types. Save all and activate the workflow.

On the top, there is a button called the basic data which looks like a hat.

Click on it. It is the basic data which acts as a catchet of events. It is her e that we mention the event which will trigger the workflow and hence, whenever that event occurs, the workflow gets triggered.

Once a screen opens, give a name and an abbreviation. Then click on the start events tab.

Select the category as applicable(we will be using business objects, so select BO). Now, u need to know wat are business objects. Business objects, in layman language, can be considered as flags, which get set to certain values, once the events related to them happen. For eg, when a purchase order event is triggered, the BUS2012 business object gets activated. In our example, we will use this business object. So put in bus2012 in Object Type. In the event tab, if you press f4, you will get all the events associated with the business transaction BUS2012. it has events for po creation, deletion, released, etc. we will use the ReleaseStepCreated event. Once we make these selections, we see the binding happens automatically, and a diamond appears under the Activation tab. Click on it. This creates a linkage between the event, business object and the initiating workflow. You can see this linkage by going to the transaction SWETYPV. You can even give manual linkages in this transaction.

Save and Activate the workflow. You are ready to launch. Simply go to me21n, create a PO and once u save it, a mail will pop up in the user’s inbox.

NEXT STEPS!!!!

What we did above was the very basic of workflows. We used the send mail step type to send the mail. Now we will send mail without using this step type. This can be done using the activity step type. This step type can be used to trigger any task that we have created. Tasks can be created in PFTC transaction.

Enter the task type as standard task and give it a name. then click on the new button.

The following window will open.

Since we are making the task for sending mail, simply put in the object type and name as in the default task which was present in the send mail step type (I asked u to take a note of that ). Below you will find three check boxes, the first one is checked to make the task work in background. Confirm end of processing notifies the user each time the task is about to end. The third is used when we want the task to execute along with a sapform.

Give an appropriate name to the task and save it.

Now go back to swdd, create a new step type “Activity” and enter the task name you created above. Set the other attributes as explained in the send mail step type. And you are done. Check again by creating another po and saving it.

There is a tab called latest end. It is used when we want to do deadline monitoring. In this we can mention the time, during which, if the user does not respond to the activity, then automatic action is taken. This can be explored yourself.

NEXT STEP TYPE:::

Now since you have done the basic assignment, we will quickly wrap up with another important step type called user decision while expecting the user to explore the remaining.

USER DECISION:: With the user decision, the requester can decide to revise and resubmit the notification of absence if the head of department rejects it.

Creating a user decision as a step in the workflow definition

Chooseunder step type. The cursor changes shape.

Position the cursor on the Undefined step that follows the outcome notification of absence Rejected and click.

By doing so, you add a user decision to your workflow definition. The step definition is shown in the right-hand part of the screen. The Decision tab is displayed.

Entering basic data for user decision

Enter Your request was rejected by &. Revise? in the Title field.

This text is used as the title for the alternative decisions when the workflow is executed. The variable & is a placeholder for a parameter that is filled from the task container at runtime.

Choose the F4 input help in the Parameter 1 field. The Expression for first parameter of user decision dialog box is then displayed.

Choose the Approver container element by double-clicking it.

Entering alternative decisions

Define the alternative decisions. Enter the following texts:

Decision texts

Name

Decision: Revise request?

Revise notification of absence

Decision: Withdraw request?

Withdraw notification of absence

9. The decision texts you enter here appear as decision options on the screen that can be processed by the requester after their leave request has been rejected.10. The descriptions are the terms used to describe the outcomes in the workflow definition.

Entering the agents responsible

Choose Workflow initiator (expression) under Agents.

The system enters the expression &_WF_INITIATOR& in the Expression field and in the input field beside the checkbox.

Concluding step definition

Choose to check the step definition.

Choose to exit the step definition.

Choose to view the entire workflow definition in the workflow area on the screen.

You can see that your workflow definition contains a user decision in the Notification of absence rejected branch. This has two outcomes whose branches converge again in the Notification of absence rejected branch. Each new branch contains an undefined step.

Choose .

The workflow definition is checked, saved, and, provided it does not contain any errors, activated. The system displays a message if problems are encountered during the test.

Result

You can now subject your workflow definition to another test. Similarly, you have many more step types like multiple condition, event creator, process control, etc. It has been left for you to find and explore.With this, we come to an end with a scratch blog on workflows. Keep checking for further blogs for more information. Take care. God Bless!!!

Thanks for appreciation. Even i had a video, but didn’t know where and how to post that. Anyways, a gud work by u also as i feel videos are always helpful in getting a practical understanding of the scenario.

i think it would hav been better if u had seen that other blog rather than simply putting the link in ur comment. It consists of several complex things which i didnt understand while i started working on workflows. the initial things given in it are not meant for the beginners who hav just started their experience with workflows. And when i went through that blog, i felt that it was more of a plagiarism than mine, as stated by you.My blog contains my work which i did during my learning of workflows. Even the pics in the blog are the screen shots of my own test workflow. So better chk out before putting up anything. Still , thanks for the link, it might help people like me to get a clear defination of PLAGIARISM.