work flow

162

Upload: xabier-etxebarria

Post on 03-Dec-2014

364 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Work Flow
Page 2: Work Flow

1. Introducción

http://www.saptechnical.com/Tutorials/Workflow/WorkflowTutorialOne/WorkFlowTutorial4.htm

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

A Workflow Instance, which is often simply referred to as the workflow, is a single workflow run. For example, the processing of a single purchase requisition for computers.

The Tasks are the steps in the process, which have to be performed either by people or automatically by the software. For example, to check for the availability of the spare computers in the company.

A Work item is the task instance that is performed as a single workflow step. For example, check that there are no spare computers available in the company.

Agents are the people who process the tasks (via the work items). For example, requisitioner and a member of the purchasing department.

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

The central tool for creating, displaying and processing a workflow is the workflow builder (Transaction SWDD). Within the workflow builder you can create all components of a workflow, including all the containers you need for getting the data from one step to another. 

Generally, most of the workflows are started by an event (for example, when a material is created or when a new purchase requisition arrives). You define which data from this event needs to be passed to the workflow via binding.

However you can also start any workflow directly. Let us create a simple workflow and start the workflow directly, using the testing tools. 

Page 3: Work Flow

2. Ejemplo Básico

Call transaction SWDD. When the workflow builder is called for the first time, a newly created initial workflow definition appears or else last created workflow appears. In such cases you can opt to create a new workflow by pressing “Create New Workflow”(ctrl + shft + F5). The following screen appears.

The initial workflow screen has the following parts:

a. The start of the workflow definition, indicated by .

b. The end of the workflow definition, indicated by . c. The area in which you insert the new workflow definition is indicated by

.

      Now select the undefined step and select Create step or double click the undefined step. Now among the different steps chose the User Decision by double clicking on it.

Page 4: Work Flow

Now enter the title for the user decision “ Please make a decision”. Also enter the decision texts as Approve and Reject. On pressing enter, the outcome values default to the Decision texts but you can specify your own names, if desired. Now we need to select the agent. Agent is the person to whom the work item needs to be sent.. Since this is just a beginning, we would hardcode the user name. Select the User from the drop down list and enter the user name to whom the work item needs to be sent. In general, this type of agent assignment is not done. Agents are generally assigned using the expression, agent assignment rule or organization object (job, position etc.).

Page 5: Work Flow

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.

 

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

Page 6: Work Flow

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

Do not change the recipients. Our mail is intended for the persons who triggered this workflow. &_WF_INITIATOR& contains the value who executed the workflow. Since this is a test object, we are using &_WF_INITIATOR&. But we wouldn’t be using this variable in real time scenarios. We would discuss about this in the coming documents.

Now select Transfer and to graphic button.

A popup appears requesting for the abbreviation and the name for this task. Enter the same and press enter.

Now enter the package as local object and press enter. 

Follow the steps 5 through 9 for the step “Reject”. The following screen appears:

Page 7: Work Flow

 

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

To execute the workflow, activate it by choosing the activate button.

Test the workflow by choosing Test. The following screen appears. 

Page 8: Work Flow

Now choose Execute to start the workflow.

Now the recipient would receive a work item in his SAP® inbox (Transaction SBWP).

Now execute the work item by pressing “Execute”. The following screen appears:

Page 9: Work Flow

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.

Page 10: Work Flow

3. Including custom text in the step "User Decision"

Whenever we create a step “User Decision” (For creation of User Decision step, click here) and provide with our own options like approve or reject, the work item would appear as follows:

As marked in green in the above screenshot, the description available in the work item is a default one provided by SAP. In case we need to add our own text, do the following:

1. Identify the task being used in the step “User Decision”.

In the step “User Decision”, click on the tab “Control”:

Page 11: Work Flow

In the tab “Control”, the standard task that is being used is displayed. In this case, the standard task that is being used is “TS00008267”.

2. Go to transaction PFTC_COP to copy the standard task. Select “Standard task” in the task type and enter the task number (without the prefix “TS”) in the “Task”.

Click on “Copy task”.

Page 12: Work Flow

3. Enter the abbreviation and the name as required.

Click on “Copy Task”.

4. Enter the package name as required.

5. A new task would be created. Please note the task number that is created now.

6. To change the task description, you can use the transaction PFTC.

7. Now go back to workflow definition, transaction SWDD.

8. Click on “User decision” and then click on the tab “Control”.

9. Here replace the standard task number with the custom task created above.

10. Do the agent assignment and generate the same.

It is always advisable not to change any of the standard texts. The change would reflect in all the workflow definitions the task is being used.

Page 13: Work Flow

4. Creating a Container element

By Suresh Kumar Parvathaneni

This document details about creation of a container element in workflow and using it in the step "Mail".

Pre-requisites:

It is assumed that the reader of this Tutorial is aware of creating a workflow definition with the step “Mail”. If not, please go through the document on creating the same available, by clicking here. 

Steps:

1. Create a workflow definition using the transaction SWDD.

2. Let’s create a container element for Carrier id. Click on the “Workflow Container” on the left side of the screen (as shown in the screenshot below):

Page 14: Work Flow

3. Now double-click on “Double-Click to Create”

4. Enter the details pertaining to CARRID here.

Page 15: Work Flow

5. Click on tab “Properties” and select “Import”.

6. Click on “Confirm (Enter)”.

7. Now the element created could be seen on the left side, below the “Workflow Container”.

Page 16: Work Flow

1.      Create a “Mail” step by double-clicking on “Undefined” step in the workflow.

 

2.      Enter the recipient details in the “Recipients” box.

3.      In the subject line, enter “Carrid value entered is:” and click on “Insert Expression”.

 

4.      Select the element “Carrid” from the list.

Page 17: Work Flow

 

 

5.      Similarly enter the content in the “Body” area.

 

6.      Save and activate the application. 

Testing the Workflow application: 

7.      Test the workflow by clicking F8.

Page 18: Work Flow

 

8.      Enter the value of the Carrid as shown above and press execute.

9.      A mail would be sent to the recipient mentioned earlier with the carrid value entered.

Page 19: Work Flow

5. Condition Step

By Suresh Kumar Parvathaneni

Agenda:

This document details about the steps “Condition”.

Pre-requisites: It is assumed that the reader of this document has a preliminary understanding of workflow and has worked with the container elements earlier. If not, please go through the first two Tutorials of workflow available in this site. (More details)

Procedure:

1. Create a new workflow definition.

2. Create a container element, CARRID (as demonstrated in tutorial 2).

3. Now click on undefined step and create the step “Condition”.

4. Enter the step name of your choice.

Page 20: Work Flow

5. We would have the following condition here:

If carrid = ‘AA’.

Do this.

Else.

Do this.

Click on “Click here to create a new condition”. Following screen appears.

Double click on “Carrid”. Next click on “=” and enter the value “AA” in the constant field and press ENTER.

Page 21: Work Flow

Enter the outcome names of your choice as shown above.

Click on “Transfer and go to graphic”.

Page 22: Work Flow

As shown above, there are two branches here. One navigates to true, if CARRID = ‘AA’ else the control takes the branch “False”.

Test the above scenario by inserting mail steps in the above 2 branches and by passing different CARRID values.

Page 23: Work Flow

6. Condition Step (Multiple)

By Suresh Kumar Parvathaneni

Agenda:

This document details about the steps “Multiple Condition”.

Pre-requisites: It is assumed that the reader of this document has a preliminary understanding of workflow and has worked with the container elements earlier. If not, please go through the first two Tutorials of workflow available in this site. (More details)

Procedure:

1. Create a new workflow definition.

2. Create a container element, CARRID (as demonstrated in tutorial 2).

3. Now click on undefined step and create the step “Multiple Condition”.

4. Enter the step name of your choice.

5. We would have the following condition here:

If carrid = ‘AA’.

Do this.

Elseif carrid = ‘AH’

DO this.

Elseif carrid = ‘SQ’

Page 24: Work Flow

Do this.

Else.

Do this.

Select the “CARRID” using the F4 help for the comparison basis field.

Enter the values of the carrid under the Comparison values with the corresponding outcome name (of your choice)

Double click on “Carrid”. Next click on “=” and enter the value “AA” in the constant field and press ENTER.

Click on “Transfer and go to graphic”.

Page 25: Work Flow

As observed above, there are different branches for each value of CARRID mentioned above.

Test the above scenario by inserting mail steps in all the branches and by passing different CARRID values.

Page 26: Work Flow

7. Using "Container Operation" step

By Suresh Kumar Parvathaneni

Agenda: Usage of step “Container Operation”.

Pre-requisites: It is assumed that the reader of this tutorial has worked in the concepts that are dealt in earlier tutorials. (click here for more details)

Scenario: In this tutorial, we would deal about how to work with the step “Container Operation” with an example of calculating the available seats by subtracting occupied seats from the maximum seats at the workflow level.

Procedure:

1. Create a new workflow definition using the transaction SWDD.

2. Create two container elements MaxSeats, Occ_Seats with the “import” property set. You can use the reference fields sflight-seatsmax, sflight-seatsocc for this.

Page 27: Work Flow

3. Create another container element AvailableSeats without setting either import or export property as this is calculated within the workflow and used within the workflow. You might use any of the above reference fields as data types.

4. Define a new step “Container Operation” in the workflow definition by double-clicking on the “Undefined step”.

Page 28: Work Flow

5. In this step, we would calculate the available seats from the max seats and seats occupied.

I would recommend entering all the container elements from the F4 help instead of typing them manually.

6. Return to the main screen.

7. Create a mail step after this to send the available seats information.

Page 29: Work Flow

8. Test the above functionality by passing some values to the maximum and the seats occupied.

9. Result would be as follows:

Page 30: Work Flow

8. Using the step "Form" in workflow

By Saumik Bhattacharya, Capgemini

Form is an important step type of workflow builder. We can use forms to enter data for processing in Business Workflow, or to display and edit data.

Using the Forms step type we can generate a form from the workflow system with a structure that is saved in workflow container. This form can be used for displaying and editing the form data. It can also contain additional control elements that can be used, for example, for the approval of form content.

 First of all we are creating a workflow container element in transaction code SWDD. You can use a form to display or edit data of a container element of the workflow container that refers to a structure.

The element should be of type reference to an ABAP dictionary.

Then we will insert the forms in workflow:

Page 31: Work Flow

Here we have to insert form type and action. Action can be of four types:

For it you have to create a form so that you can attach it to the workflow. Click on create button:

Page 32: Work Flow

 Here we are creating the form named Material info using the workflow container element Y_form_makt.

Now according to our requirement we are just using the material number & material description in the form layout.

For e.g. we are using the material number as input value and description field as output only.

We have also implemented the required changes in the flow logic of that form.

Page 33: Work Flow

Finally we had attach two mail on approve and on reject.

After completing this, we will execute this workflow and will get the form:

Page 34: Work Flow

We will go for approve this form and we will get description

And here is the approved mail:

Page 35: Work Flow

9. Using the step "Form" in workflow

By Sai Kumar B, Enteg Infotech

In the need of input from the user other than mere clicking of accept and reject actions, we can use the Form Step in workflow. The form step presents the user a form (User interface) thus by enabling the workflow developer to capture the required input from the user. The form used here is just like classic Dynpro screen, which can be designed in Screen Painter (SE51).

To Begin with lets start with Workflow builder, SWDD. In this tutorial I was just showing how to include a form step inside a workflow.

1. Right click on the activity and select create.

2. Select the form step type.

Page 36: Work Flow

3. In the next screen provide Step Name and agent assignment 4. Select the form type and action 5. Then click on Create (Before clicking on Create make sure that you have declared a

structure in container which can be used as the structure for the form / Screen you are going to include.

6. If you have not created the structure, you can do so by double clicking the container.

Page 37: Work Flow

7. Then give name for the container element and type of the element, and if you are using this structure for changing of some values be sure to check export and import check boxes in properties tab.

8. Coming back to the form step click on the create button.

Page 38: Work Flow

9. This will start a wizard, Click on continue

10. Give your form a name and select the structure for which you are building the form . 11. And click on continue.

Page 39: Work Flow

12. Then click on complete

Page 40: Work Flow

13. Save the object

14. Now you can change the form as per your need. You can use the form as it is, as the logic will be handled automatically. The changes that were made in the form at runtime will directly reflected in the container element. If you need more complex logic you can modify the form as per your requirements by clicking on change button.

15. This will open the form in screen painter to modify the form, make necessary changes in layout.

Page 41: Work Flow

16. If you need to change the flow logic you can go there by clicking on flow logic, where you can change the flow logic.

17. If you want to control the data in PBO and PAI level you can double click the module to be navigated to the function modules generated by sap system. Even though SAP recommends not to change the modules you can change them with due caution to meet your requirements.

Page 42: Work Flow
Page 43: Work Flow

Finally activate everything and test.

Page 44: Work Flow

10. Triggering Events Programmatically

By Suresh Kumar Parvathaneni

Purpose: This document details the procedure in triggering the business object events programmatically. 

Pre-requisites: It is assumed that the reader of this document is aware of the business object concepts and good in ABAP. 

Procedure:

In this document, we would take an example of the business object BUS1001006 (Material) and the event CREATED. In general, this event is triggered whenever a material is created using a standard procedure like MM01 or any others. Now we would trigger this event from our own programs. 

Following are the screenshots of the business object BUS1001006 and the event CREATED. Go to transaction SWO1 for more information of the business object. 

Double-clicking on the key field parameter gives you technical information of the field.

Page 45: Work Flow

 

In order to trigger an event programmatically, we would use the function module SWE_EVENT_CREATE. 

Following is the sample code to trigger the events programmatically: 

 REPORT ZDEMO_TRIGGER_EVENT.

DATA: KEY LIKE SWEINSTCOU-OBJKEY.

KEY = '1163'. “ Material Number (hard-coded)

CALL FUNCTION 'SWE_EVENT_CREATE'EXPORTINGobjtype = 'BUS1001006'objkey = KEYevent = 'CREATED'* CREATOR = ' '* TAKE_WORKITEM_REQUESTER = ' '* START_WITH_DELAY = ' '* START_RECFB_SYNCHRON = ' '* NO_COMMIT_FOR_QUEUE = ' '* DEBUG_FLAG = ' '* NO_LOGGING = ' '* IDENT =* IMPORTING* EVENT_ID =* TABLES* EVENT_CONTAINER =EXCEPTIONSOBJTYPE_NOT_FOUND = 1OTHERS = 2.IF sy-subrc <> 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ELSE.WRITE 'Event Triggered'.ENDIF.

COMMIT WORK. 

In order to test whether the event is getting triggered or not, we can make use of Event Trace. Switch on the event trace using the transaction SWELS. 

Page 46: Work Flow

 

Press ‘Switch On”. 

Now execute the program developed earlier. Now switch-off the event trace using the same transaction SWELS. 

Now go to transaction SWEL. Here you can list out the events triggered in the particular period of time. Here is the event-trace list:

 

Page 47: Work Flow

11. Deadline Monitoring in SAP Workflow (Working with Latest end)

By Suresh Kumar Parvathaneni

A major advantage of workflow is the ability to monitor the workflow steps according to a predefined schedule. Following are different deadlines that can be monitored against each workflow step:

Requested Start Latest Start Requested End Latest End

In this example, we will define a deadline to the User Decision example created earlier (click here). Following is the screenshot of the application developed using the User Decision example:

We would extend this example to the deadline monitoring.

In the User Decision step, click on the “latest end” tab.

Page 48: Work Flow

By default, No deadline monitoring is active (as seen in the above screenshot).

Choose the “Work Item Creation” from the list box.

After selecting “Work Item Creation”, chose an offset of 5 minutes. This means that the work item must be executed within 5 minutes of the creation, if not this would trigger.

Page 49: Work Flow

Enter recipient details to whom the message to be escalated, if the work item is not executed with in 5 minutes after work item creation.

Save and activate the workflow definition.

Testing the workflow application:

Execute your workflow. Check for the work item in the SAP Inbox. This time do NOT execute the work item. Wait for the deadline to be triggered. After that, a deadline message is delivered to the

recipient mentioned in the “Latest End” tab. See the screenshot below.

Page 50: Work Flow

Don’t worry if the deadline message doesn’t appear immediately after 5 minutes. This depends on various factors including how the deadline monitoring program is scheduled and also on the availability of the background processors.

Use SWWA to check how the deadline monitoring program is scheduled in program.

For example, assume that our work item has been created at 09:10 hrs and the deadline message is expected to trigger at 09:15 hrs. From the above screenshot, it is understood that the background program is scheduled to execute for every 3 minutes. Assume that the last run of the program is at 09:14hrs and the next run is expected at 09:17hrs. So even our deadline expires at 09:15, the deadline message would appear only at 09:17hrs after execution of the background program.

Some more points

In our above example, we have used the deadline on the “Work Item” creation time. i.e., 5 minutes after creation time, the deadline message would be sent. Now we would check the other option “Expression”. Here we can mention the date and time, when the deadline message should appear irrespective of the work item creation date/time.

As seen in the above screenshot, we can provide the target date and time by which the task should be finished. Container elements could be used in this case. Please refer to our example on creation of container elements (click here).

Page 51: Work Flow

12. Personal Substitute in Workflow

By Suresh Kumar Parvathaneni

Requirement: Need to have at least one substitute who can act upon work items in your absence.

Important: The appointed substitute would be able to see all your work items. A substitute cannot be assigned for only particular area of organization or any other item. So need to ensure that the substitute have the necessary authorizations to act upon the work items.

Procedure:

1. Go to SAP Business Work Place (TCode: SBWP)

2. Now from the menu bar, select Settings à Workflow settings à Maintain Substitute

Page 52: Work Flow

3. Highlight/Select the name on the window, in this case SAPDEV02 and click on “Create Substitute”.

4. List of users available in the system are displayed.

5. Select the required substitute user name. Following screen appears.

Page 53: Work Flow

Validity field describes about the period in which the setting would be active. Note that the dates on the screen would range from the current date to 31st Dec 9999.

Regarding the checkbox “Substitution active”, it is advised to leave this checkbox unchecked for system performance reasons. A check in this box indicates that the substitution is “permanent” and if left unchecked it is treated as “as-needed”. A permanent substitute will automatically receive the primary users work items in their own box. In the case of “as-needed”, substitute must manually adopt the work items from the primary user’s inbox.

6. Save the entries

7. Click Enter to leave the screen.

Page 54: Work Flow

13. Adopting a Substitute in Workflow

By Suresh Kumar Parvathaneni

If you have been designated as an “as-needed” substitute, you must manually adopt the substitution. If you are designated as a “permanent” substitute, the work items would automatically appear in the inbox.

Before adopting a substitution, there are 19 work items in the inbox. See the screenshot below:

To adopt a substitution, select Settings à Workflow settings à adopt substitution.

Page 55: Work Flow

Select the corresponding User-id (if you have been assigned as a substitute for multiple people, then this option would allow you to select the user name of whom you would to check the work items)

The corresponding user’s work items would appear in our inbox now.

You can end the substitution, by selecting settings à Workflow settings à End substitution.

Note: Substitutes can only adopt work items that are directly routed to the person for whom they are a substitute. If you are a substitute for a user (SAPDEV02) who has been made a substitute for another user (SAPDEV01), you will only see work items for user SAPDEV02 and not of the user SAPDEV01.

Page 56: Work Flow

14. Notification of Work Items via e-Mail

By Suresh Kumar Parvathaneni

SAP provides us with a facility of notifying the user via the email address of your choice when there are any pending work items in the SAP Inbox.. 

1.      Go to Transaction SO13.

2.      Click on Automatic Forwarding tab.

Page 57: Work Flow

3.      Click on Create icon .

4.      Enter the details in the above screen.

5.      Click ENTER to complete the entries.

6.      Now the notification would be received at the provided email address if there are any pending work items in the inbox.

Page 58: Work Flow

15. Filtering the Work Items in the SAP Inbox using BADI

This document details about the procedure in filtering some of the work items from the SAP inbox using a BADi. 

Following is the screenshot of the SAP inbox, before implementing BADi: 

 

The BADi that is used in filtering the work items is WF_BWP_SELECT_FILTER. To implement the BADi, go to transaction SE18. From the menu, select Implementation à Create. (See the screenshot below) 

Enter the implementation name and press ENTER 

Page 59: Work Flow

 

Enter any meaningful short text for the implementation and click on the tab “Interface”

The implementing class, ZCL_IM_BWP_SELECT_FILTER, is automatically proposed. Double click on the implementing class name. 

Page 60: Work Flow

 

You are now navigated to the class builder. Now double-click on the method name shown on the screen (see the snapshot below)

Now let us filter out the work items belonging to the task TS2000066. See the code below: 

Page 61: Work Flow

 

Activate the method and also the implementation. In the state of active, you wouldn’t be able to make any changes. To make any changes, we need to deactivate it and then make the changes.

Now check the inbox and would notice that the work items related to that task are no more appearing. 

Page 62: Work Flow

 

To notice the differences, try activating and deactivating the BADi implementation.

Page 63: Work Flow

16. Triggering workflow to send an email whenever a material is created

By Chandrasekhar V, EDS

This example focuses on triggering a workflow whenever a material is created using MM01. 

TCode SWDD(Workflow builder) -> Click on “Create” button

 

Drag and drop the “User decision” step. Enter the following details

Page 64: Work Flow

Select the agents “Workflow initiator (expression)” and click on “Transfer and to graphic” (tick mark button).

Following screen appears.

Drag and drop “Activity” step into branch YES,

Create new task click on the “Display task” -> Create task

Page 65: Work Flow

Enter the “work item text” in the same screen as follows:

Page 66: Work Flow

To get “&_WI_OBJECT_ID.MATERIAL&” in above screen, click “insert variable” icon (above that yellow icon).

Save in local package.

Go to “Additional data” menu “Agent assignments” -> “Maintain”. 

 

Select it and click on “Attributes” from application toolbar and select “General task” radio button, click “Transfer”

Click on back 2 times.

Page 67: Work Flow

Click on “continue”.

Select “Workflow initiator” as Agents and click on “Transfer and to graphic” button

To create the workflow container

Page 68: Work Flow

Select “workflow container” and double click on “BUS1001006” in the list displayed.

Page 69: Work Flow

Click on properties tab and select the import check box and click on ok

Again open user decision, which was already created, and make changes as bellow

In Parameter1 click F4 and select Material number as bellow

Click on “transfer and to graphic”

Right click on branch “No” to send a mail

Page 70: Work Flow

Double click on “send mail”.

Enter the following details as in the below screen

Click on “Transfer and to graphic”

Page 71: Work Flow

Save in a local package

Click on the “Basic data(ctrl+F8)” from application toolbar and select “Start events” tab

Enter the details as in bellow screen

Page 72: Work Flow

Click on “Binding” 

Click on ok

Save and come back to graphic, the following screen will appear

 

Page 73: Work Flow

Save, activate and execute.

Go to TCode “MM01” to create the material 

Enter the details in MM01 and click on “Select view” -> “Basic data1”

Enter the details in Second screen as below: 

Save and come back.

Page 74: Work Flow

Check your inbox by using TCode SBWP. 

Double click on “Work item executable”

Click yes or no and check your inbox again .

Page 75: Work Flow

17. Defining Custom Rules for use in SAP Workflow

By Raghava Vakada, Mouri Tech Solutions 

“I would like to explain about creating custom rules in SAP Workflow. The rules can be created or changed using the standard SAP transaction PFAC. Once the rules are created you can call these rules in any workflow via the rule container”.

In this article I am creating a rule, which will find the users based on Position id. I have created a custom function module ZWF_FIND_USERS which will return me back a position under Asset Analyst (HRP1001-SOBID). The custom function created should have the same interface as that of the SAP standard function module RH_GET_ACTORS. The following table parameters have to exist in the custom function module.

“ACTOR_TAB STRUCTURE SWHACTOR”

“AC_CONTAINER STRUCTURE SWCONT”  

Following is the function module code:  

FUNCTION ZWF_FIND_USERS.*"-----------------------------------------------------------*"*"Local Interface:*" TABLES*" ACTOR_TAB STRUCTURE SWHACTOR*" AC_CONTAINER STRUCTURE SWCONT*" EXCEPTIONS*" NOAGENT_FOUND*"----------------------------------------------------------- INCLUDE <CNTN01>. DATA : POSITION_ID LIKE ZBUSAREA-OBJID, LT_HOLDERS TYPE STANDARD TABLE OF SWHACTOR, LWA_HOLDERS TYPE SWHACTOR, LWA_USERS TYPE STANDARD TABLE OF HRP1001, WA_USERS TYPE HRP1001, NUM_LINES TYPE I.*Read values assigned to the rule criteria SWC_GET_ELEMENT AC_CONTAINER 'POSITION_ID' POSITION_ID. SELECT * FROM HRP1001 INTO table LWA_USERS WHERE OBJID = POSITION_ID. IF NOT LWA_USERS IS INITIAL. REFRESH LT_HOLDERS[]. loop at LWA_USERS into WA_USERS. Condense WA_USERS-SOBID. LWA_HOLDERS-OTYPE = 'US'. LWA_HOLDERS-OBJID = WA_USERS-SOBID. APPEND LWA_HOLDERS TO LT_HOLDERS. APPEND LINES OF LT_HOLDERS TO ACTOR_TAB. endloop. ENDIF. DESCRIBE TABLE ACTOR_TAB LINES NUM_LINES. IF NUM_LINES IS INITIAL. RAISE NOAGENT_FOUND. ENDIF.ENDFUNCTION.

Page 76: Work Flow

Creating a rule using the PFAC Transaction

Assign the function module ZWF_FIND_USERS in the "Rule Definition Tab" .

Go to the "Container Tab" and create a container element for the “Position id” which will be passed to the function module 

 Our rule is created now. You can test the rule within the PFAC transaction by clicking the "Simulation" button on the application toolbar. Now this rule is ready to be used in any workflow according to your requirement via the rule container of the workflow. 

Page 77: Work Flow

 Enter the Position Id, which is created in (PPOCW) 

 It displays Asset Analysts (users) in the “Rule resolution result”

 Now you can use this rule in any of your workflow definitions.

Page 78: Work Flow

18.Maintaining Translations for Work item texts and Outcome names

In this tutorial, we would look into a simple method of translating Work item texts and step names to the desired language. 

Let us open any existing workflow definition.

 

Check the same workflow definition by logging in German Language:

 

Page 79: Work Flow

You can observe that the text remains in the English language, whereas “Workflow Started” is translated as “Workflow gestartet” (As the SAP has already provided translation for this) 

Now to translate the text to German, Click on Extras -> Translation -> Translation (As shown in the screenshot below): 

Following pop-up appears: Select German from the list box. 

 

Now a screen with all the workflow steps and outcome names are displayed for maintaining the translation. 

Page 80: Work Flow

For our testing purposes, let us maintain the German text for the first two step types.

 

Save and activate. 

Now logon in German Language and check the workflow definition. You can observe that for the two step types, the text is available in German. 

Page 81: Work Flow

19. Raising exceptions in a method and handling the same in the workflow

By Suresh Kumar Parvathaneni

This document details the procedure in defining exceptions in a method and using the same in a workflow. 

Let us first look at raising exceptions in a method: 

Go to Business Object Builder (Transaction SWO1). 

Create a business object. 

 

Now create a method.

 

Now select the method you have created and click on button “Exceptions” available on the toolbar.

Page 82: Work Flow

Following screen appears:

 

Now click on Create. Following popup screen appears: 

 

Enter the information as shown above. The error type “Temporary error” is chosen in the case wherein the record is locked by somebody else or some required resource is not available. The error type “Application Error” is to be chosen when there is no authorization for the document you are processing. The error type “System error” is to be chosen if there are no values passed for the mandatory parameters. 

Click on continue.

Go back to the main screen.

Now in the method, provide the following code:

Page 83: Work Flow

 

Save the business object and release the same. 

 

Try executing the method by clicking on Test/Execute (F8). The exception would be raised as shown below: 

 

Capturing the exception raised by the method in the workflow: 

Go to Workflow Builder (TCode: SWO1). 

Create the step “Activity”

Page 84: Work Flow

 

Create a task and provide the following details in the new task: 

 

Save your entries and return to the previous screen. 

Page 85: Work Flow

 

Click on “Outcomes” tab. Here you can observe the exception you defined in your method:

 

As observed in the observe screen, the outcome is not active by default. If we do not handle the exception, the work item might go into the error status. Activate the outcome:

Save your entries and go back to the main screen of Workflow builder. Please ensure that you have done the agent assignment for this task. 

Page 86: Work Flow

 

You can now observe a new branch when the exception is raised. You can define your steps whenever the exception is raised. 

References:

http://help.sap.com/saphelp_nw04s/helpdata/en/c5/e4ad98453d11d189430000e829fbbd/frameset.htm

Page 87: Work Flow

20. ALE

By  Abhijit Daptary & Siddharth Samal, Capgemini India

Pre-requisites. 

It is assumed that the reader of this article has some knowledge in SAP workflow BOR objects and ALE Idoc process like process code, Partner Profile etc. 

Description 

Here, we will be discussing in details the Error handling of an Inbound Idoc through triggering an event, which in turn will be triggering a workflow attached to the workflow. 

Steps:-

1. Create custom BOR object with the events, Start and Stop event 2. Create a workflow for the error handling, like generating a notification whenever an

error occurred in the Inbound Idoc. 3. Creation of Function Module and attachment with the Process Code 4. Create the settings for the Inbound Process of the Idoc through the Process Code.

Creation of BOR objects. Go to the transaction SWO1. 

Enter a name for the Object type and click ‘CREATE’ button for creating the custom BOR object. 

Page 88: Work Flow

Enter the details required for creating the BOR objects... 

 

Create the Key fields and events of the BOR object.

For creating the Key fields place the cursor on the Key fields and Click on the Create Button

 

Page 89: Work Flow

Create events for triggering the workflow and stopping the workflow.

For creating the event place the cursor on the EVENTS and Click the create button like Key fields.

Create two events.

Enter the event name description etc and proceed further to create it. 

 

Similarly create another event for ending the Workflow in the similar manner like that created earlier. 

 

Now, Generate the BOR object through the generate button

Page 90: Work Flow

 

Release the EVENTS and subsequently release the BOR object. 

After the creation of BOR object

Create a workflow for the generation of notification whenever an error is reached in the Inbound Idoc.

Execute the transaction SWDD. 

Click on the CREATE button for creating the workflow for error handling.

Page 91: Work Flow

Choose the Step type to be inserted for the notification like here we are using Send Mail option for sending a mail to the user whenever any error occurred.

Activate the Workflow and test it whether it is working as per the requirement.

After the successful completion it is required to attach the workflow with the event.

Go to the Header section (Denoted by CAP).

 

Go to the Start Events TAB. 

Page 92: Work Flow

Enter the details of the event with which the workflow should be linked like the category, BOR object type and the event with which that should be linked.

Enter here the BOR object that has been created and give the name of event created for starting the workflow.

Click on the Binding Button for generating the binding between the event and the workflow.

 

 

Generate the binding and click OK button to save the binding.

Page 93: Work Flow

Click on Activate / deactivate button for activating the linkage.

Page 94: Work Flow

After the successful linkage the following sign will appear on the workflow..... 

This shows that the workflow has been linked to the event and it will be triggered whenever that particular event will be triggered. 

After the creation and successful linkage of workflow with the event it is required it is required to generate a function module and attached it to the process code. 

Go to SE37 transaction and copy a standard process code function module to a custom one. Do no delete any parameters from the function module as the SAP standard program itself is calling this. 

In that function module do the required validation and whenever the validation fails set a standard parameter ‘WORKFLOW_RESULT’ to 9999 from within the function module, otherwise normally proceed to set the status to 53.

Page 95: Work Flow

After the creation of function module it is required to attach it to the process code and corresponding attached to the message type at the Partner Profile stage.

The process code is being created through the transaction WE42

Go to the change mode and click the New Entries button for creating new process code. 

Enter the Process Code Name, description and choose the processing type as Processing by function module. Click on the extension button of Identification.

Page 96: Work Flow

The details for the of the Process Code after clicking the identification button will be  

Whenever idoc arrives into the Destination system then the standard SAP triggers the Process code attached to the Message type in the partner profile. The partner profile is being maintained in the transaction WE20. 

Page 97: Work Flow

Since, it is and inbound scenario so the message type and the corresponding process code will be maintained for the Inbound Parameters. 

Click on Create Inbound Parameters button for creating new Inbound Message type and the corresponding message type. 

Enter the process code for the corresponding message type. 

Page 98: Work Flow

Click SAVE button for saving the changes. 

Whenever the IDOC arrives into the target system, it checks the partner profile and finds the corresponding process code. The process code is being linked with the function module through which the IDOC is required to be

21. ABAP Classes in Workflow

By Anwesha Bhattacharya , Capgemini India

1. ABAP Classes and Business Workflow:

We can use ABAP classes in the definition and runtime components of SAP WebFlow Engine in the same way as object types defined in the Business object Repository (BOR).

Before proceeding further we need to know where to create and maintain ABAP Classes and ABAP Interfaces.

2. What is Class Builder and its purpose?

The Class Builder allows us to create and maintain global ABAP classes and interfaces. Both of these object types, like global data types, are defined in the ABAP Repository, thus composing a central class library. Together, they form a central class library and are visible throughout the system. We can display existing classes and interfaces in the class library using the Class Browser.

We can define local classes as well as global classes. They are defined locally in programs, function groups or as auxiliary classes of global classes of the class

Page 99: Work Flow

pools. Local classes are only visible within the defining module.

ABAP classes are processed using the Class Builder.

3. How to reach Class Builder?

To reach the initial screen of the Class Builder, choose Development à Class Builder from the initial screen of the ABAP Workbench or enter transaction code SE24.

4. How does it integrate?

The Class Builder allows us to create Web development objects within the ABAP Workbench. We can use the Class Browser to display and maintain existing global object types from the class library.

The diagram below illustrates the architecture of the Class Builder and the relationships between its components (including the Class Browser)

Page 100: Work Flow

From here, we can either display the contents of the class library or edit a class using the Class Editor. Once we have defined an object type, we can implement its methods. From the initial screen or the Class Editor, we can also access the Class Builder’s test environment. We can define the object types immediately after implementing the method in the ABAP Editor. It is also possible to access the test environment from the initial screen or Class Editor.

5. How to use the Class Builder?

Use the Class Builder to:

 Display an overview (in the Class Browser) of global object types and their relationships.

Maintain existing global classes or interfaces. Create new global classes and interfaces. Implement inheritance between global classes. Create compound interfaces. Create and specify the attributes, methods, and events of

global classes and interfaces. Define internal types in classes.

Page 101: Work Flow

Implement methods. Redefine methods. Maintain local auxiliary classes. Test classes or interfaces in a simulated runtime

environment. 

6. What are the constraints?

We cannot define object types on the basis of graphical object modeling.

7. Note before creating global classes and interfaces:

Global classes and interfaces that we create in the Class Builder are stored in the class library and administered by the R/3 Repository: they therefore have the same namespace as all other Repository objects. It is therefore necessary to have naming conventions for object types and their components and to use them uniformly within program development. 

8. Naming Conventions in ABAP Objects:

The following naming convention has been conceived for use within the SAP namespace. If we do not observe the naming conventions for object types (classes and interfaces), conflicts will occur when the system creates persistent classes, since it will be unable to generate the necessary co-classes.

9. Conventions for Object Types:

Class in the class library

CL_<class name>

 

Interfaces in the class library

IF_<interface name>

 

Local classes in programs(recommendation)

LCL_<class name>

 

Local interfaces in programs

(recommendation)

LIF_<interface name>

 

10. Conventions for Components:

Method name

<method name>

 

Events <event name>

 

Page 102: Work Flow

Local type definitions within a class

(recommendation)

TY_<type name>

 

Data definitions (variables) <variable name>

 

Data definitions (constants)

(recommendation)

CO_<constant name>

 

11. Local Conventions within Methods:

For parameters:

IMPORTING parameters

IM_<parameter name>

EXPORTING parameters EX_<parameter name>

CHANGING parameters CH_<parameter name>

RESULT RE_<result>

12. Using ABAP Classes in Workflow:

Within the SAP WebFlow Engine we can use ABAP classes that support the IF_WORKFLOW interface. Classes that have implemented the IF_WORKFLOW

interface are recognized as workflow-enabled in the Class Builder.

13. How to create ABAP Classes that support IF_WORKFLOW interface?

Go to transaction SE24 and create a customized class.

Page 103: Work Flow

Next the pop up appears where we need to mention the detail as follows:

Save it and the class is created.

Now the class is to implement IF_WORKFLOW interface. For this go to the

tab and declare the IF_WORKFLOW as the interface there and press Enter; two sub-interfaces appear: BI_OBJECT and BI_PERSISTENT. Save the Class.

Page 104: Work Flow

The ZCL_TEST class now contains the existing methods of IF_WORKFLOW interface.

14. Lights on Key Attributes and Attributes:

The key attributes are used to define the object key. There can also be other defined attributes other than key attributes. The SAP WebFlow Engine can access all public attributes of a class.

Key Attributes:

In the Class Builder there is an additional column Key Attributes on the

tab page as shown below:

Page 105: Work Flow

We need to check this box when we are defining any attribute as the Key Attribute.

All key fields must be character-type fields (elementary types: CHAR, NUMC) and have a defined length. The maximum length allowed for all key fields is 32 characters. The length of the key field for the persistent display is 32 characters.

In the case of persistent ABAP objects we can use the GUID, which is generated automatically by the object manager when an instance is created.

Attributes:

In addition to all the other data types that the Class Builder supports, we can also define attributes with reference to an object from the Business Object Repository (BOR). To do this, we have to use the structure SWOTOBJID as the data type. The BOR object is determined using the corresponding value.

To assign a BOR object instance to an attribute we need to use the corresponding BOR macros. Normally, this is implemented within the CONSTRUCTOR of a class.

To use the BOR macros in a class, two INCLUDES must be included.

Include <CNTN03>……………contains the local types Include <CNTN02>……………contains the BOR macros 

An example to show how to define Attributes and Key Attributes: 

Page 106: Work Flow

15.  Why IF_WORKFLOW Interface?

The IF_WORKFLOW interface is necessary when using an ABAP class within the SAP WebFlow Engine. The interface contains methods that allow the object to be used within the SAP WebFlow Engine.

The SAP WebFlow Engine handles all objects generically. Objects have to be saved in the event of a context change. Therefore, it is necessary to convert object references in such a way that they can be saved persistently. Conversely, we have to be able to generate the corresponding instance of an ABAP class from the persistently saved key.

There are also a number of SAP WebFlow Engine components, for example, the Workflow Log that can display objects. In this case the object has to provide corresponding functions.

The IF_WORKFLOW interface puts a logical parenthesis round the BI_PERSISTENT (instance management) and BI_OBJECT (object behavior) interfaces. The IF_WORKFLOW interface contains the following methods:

       BI_PERSISTENT~FIND_BY_LPOR

       BI_PERSISTENT~LPOR

       BI_PERSISTENT~REFRESH

       BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE

Page 107: Work Flow

       BI_OBJECT~EXECUTE_DEFAULT_METHOD

       BI_OBJECT~RELEASE 

A class that implements the IF_WORKFLOW interface can be used in any workflow. The class is automatically released for use in workflows when the interface is implemented. Therefore, we can only make compatible changes to a class after implementation (we cannot delete attributes, change types or delete methods). There is no where-used list to show which workflows the class is used in. 

Internal classes of an application should not implement the IF_WORKFLOW interface, since this could mean that each method of the class is used in the workflow. Therefore, we should encapsulate the workflow functions in another class that calls the selected methods of the internal class. 

Each method of the IF_WORKFLOW Interface as mentioned earlier has its distinct functionality, which is discussed below.

16.    BI_PERSISTENT~FIND_BY_LPOR Method:

If we want to convert a persistent saved display of an object into an instance of the corresponding ABAP class, SAP Webflow Engine calls the BI_PERSISTENT~FIND_BY_LPOR method.

Features:

The method parameter LPOR is the persistent object reference and is of SIBFLPOR structure type. A reference of BI_PERSISTENT type is returned.

 

The following table shows the components of the SIBFLPOR structure:

 

Field Description

CATID Describes the object type ( CL for ABAP classes)

TYPEID ABAP class name

INSTID Object key. The key is limited to 32 characters.

 

We can implement this method in several ways. In the case of persistent classes we can create the ABAP object instance using the generated classes. In the case of individual persistence management we have to implement the individual actions (such as creating an instance, performing an existence check, entering public attributes, and so on) manually within the class.

Page 108: Work Flow

 

Instance management takes place automatically in the case of persistent classes. In the case of individual persistence management we also have to carry out instance management by class. The SAP WebFlow Engine does not provide any instance management. We must therefore implement our own instance management in the case of individual persistence management.

 

The FIND_BY_LPOR method should always return the same instance if the following problems are to be avoided: 

Inconsistency in the data display

Instance data being overwritten by another instance

Locking conflicts

There is an implementation example in the CL_SWF_FORMABSENC demo class. 

Page 109: Work Flow

17.              BI_PERSISTENT~LPOR Method:

The BI_PERSISTENT~LPOR method is the counterpart to the BI_PERSISTENT~FIND_BY_LPOR method. It provides the persistent display for an existing instance of an ABAP object. 

Features: 

The method returns the persistent display of an object reference as a SIBFLPOR type structure as described earlier. 

There is a close relationship between the BI_PERSISTENT~FIND_BY_LPOR method and the BI_PERSISTENT~LPOR method. If we call the BI_PERSISTENT~FIND_BY_LPOR method first and then the BI_PERSISTENT~LPOR method, the BI_PERSISTENT~LPOR method must return the same value as was previously used to call the BI_PERSISTENT~FIND_BY_LPOR method. 

There are also several ways of implementing this method in this case. There is an implementation example in the CL_SWF_FORMABSENC demo class.

18.              BI_PERSISTENT~REFRESH Method:

Page 110: Work Flow

SAP WebFlow Engine calls the BI_PERSISTENT~REFRESH method when the system has to ensure that all values of an object are valid or that they agree exactly with the persistent display of the object. 

Features: 

The method implementation depends on the internal organization of the class. We can check the object instance data in the database, if necessary.

If we do not need the method in our class, then we need only to carry out a “dummy” implementation (without further coding) to avoid program errors when the system calls the method. 

There is an implementation example in the CL_SWF_FORMABSENC demo class.

19. BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE Method:

The BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE method returns the display name of the object.

Features:

We can display references to process objects or process step objects at different positions within the SAP WebFlow Engine (for example, in Business Workplace and in Workflow Log). The object key is normally displayed here. If, for example, we want to display a descriptive text instead, the BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE method has to return the corresponding value.

Page 111: Work Flow

If the method does not contain implementation or does not return a value, the object key is displayed.

If we do not need the method in our class, then we need only to carry out a “dummy” implementation (without further coding) to avoid program errors when the system calls the method.

There is an implementation example in the CL_SWF_FORMABSENC demo class.

20. BI_OBJECT~EXECUTE_DEFAULT_METHOD Method:

The BI_OBJECT~EXECUTE_DEFAULT_METHOD method is the standard method for the object. This method is executed when, for example, we call the object in Business Workplace.

Features:

We can display process objects or process step objects at different positions within the SAP WebFlow Engine (for example, in Business Workplace and in Workflow Log). The SAP WebFlow Engine calls the BI_OBJECT~EXECUTE_DEFAULT_METHOD method.

If we do not need the method in our class, then we need only to carry out a “dummy” implementation (without further coding) to avoid program errors when the system calls the method.

There is an implementation example in the CL_SWF_FORMABSENC demo class.

Page 112: Work Flow

21. BI_OBJECT~RELEASE Method:

The system indicates that the reference to the instance is no longer needed by using the BI_OBJECT~RELEASE method. This means we can delete the reference from instance management. Once the last reference has been deleted from instance management, the GARBAGE COLLECTOR can release the corresponding memory area.

Features:

If we do not need the method in our class, then we need only to carry out a “dummy” implementation (without further coding) to avoid program errors when the system calls the method.

There is an implementation example in the CL_SWF_FORMABSENC demo class.

Page 113: Work Flow

22. How to use ABAP Classes in Process Steps of Business Workflow?

In process steps we can use methods and attributes of ABAP classes in the same way as methods and attributes of Business Object Repository (BOR) objects. We can call these methods in the process context.

Features:

While using the ABAP Classes in the Process Steps the methods may contain dialogs, they can be synchronous or asynchronous; they may appear in the workflow log, and so on.

In general, we can use any method that is implemented as a public method. The method can be implemented in the class itself, in one of the super classes of the class, or by way of an interface.

The maximum permitted length for methods that are implemented by way of an interface, for example IF_WORKFLOW~FIND_BY_LPOR, is 30 characters. If the method name is too long, we can choose a shorter name for the method by defining an alias. If the method is implemented in the class or in a super class, the name of the method cannot be longer than 30 characters, so this limitation does not apply.

Parameters:

We can assign values from the workflow container to the method parameters. Conversely, export parameters can be entered as workflow container values. The

Page 114: Work Flow

following overview shows how the individual types can be used as parameters:

Simple types (string, integer, and so on)

Data Dictionary types (structures, tables, complex types)

References to objects from the Business Object Repository

References to ABAP classes (supporting the IF_WORKFLOW interface)

We can transfer method parameters that represent a persistent object (IF_WORKFLOW or BOR Object) in the following ways:

ABAP classes (with IF_WORKFLOW interface)

TYPE SIBFLPORB

Object is transferred using the persistent display

TYPE REF TO <Class name>

Object is transferred as object reference

BOR objects

TYPE SIBFLPORB

Object is transferred using the persistent display

TYPE SWOTOBJID

Object is transferred using the persistent display; this display is only valid for BOR objects

TYPE SWC_OBJECT

Object is transferred as object reference

Exceptions: 

The SAP WebFlow Engine can deal with exceptions that are triggered by the methods. It differentiates between application exceptions and temporary exceptions. The two exception categories are differentiated by the exception in the class hierarchy or by naming conventions. In the case of a temporary

Page 115: Work Flow

exception, the SAP WebFlow Engine attempts to execute the method again. In the case of a permanent error the status for the workflow is set to error.

Class-Based Exceptions: 

To create a temporary exception, we can use, for example, the CX_BO_TEMPORARY class or a corresponding subclass. It can be helpful to trigger an exception for dialog methods when the user cancels the dialog. Here, for example, we could trigger the CX_BO_ACTION_CANCELED exception (subclass of the CX_BO_TEMPORARY class).

Exceptions Not Based on Class: 

We can also trigger exceptions not based on class. The SAP WebFlow Engine can differentiate between the two exception categories (temporary and permanent) by the name. If the exception begins with TMP or TEMP, it is a temporary exception; otherwise it is a permanent exception.

Using Document Template in Workflow

By Madhavi

This tutorial details about the usage of the step “Document from Template” in workflow. 

Sometimes, it becomes a necessity to work with the documents (Word, Presentation, excel and others). Go to Transaction SWDD and create a new workflow definition. 

Before we go ahead and create a document template, we need to save the workflow definition. Save your workflow definition.  

Now select “Document templates” from the list as shown below (You can find this on the left side bottom of the screen)  

Page 116: Work Flow

 

Click on “Double-click to create”

 

Click on “Change document class” and then select “Document” from the list provided (see the screenshot below):

Page 117: Work Flow

The following screen appears:

Enter some text in the document: 

Page 118: Work Flow

 

Save your document. 

 

After saving, go back to the main screen. You can observe the document template you just created, as shown below:

 

Now in your workflow definition, create a new step “Document from Template”: 

Page 119: Work Flow

 

Enter the step name. 

In the section, Doc. Template(s), select the document we created earlier using the F4 help. Also enter the agent details.  

Page 120: Work Flow

 

Save your entries. 

The workflow definition would look like this:

 

Activate your workflow and execute the same. 

Your work item would look as follows:

Page 121: Work Flow

 

Execute the work item. The document would open as shown below: 

Modify the document and Save. 

 

Page 122: Work Flow

Your work item is executed.

Steps to transport the Agent assignment from one system to another

By Vijayendra Krishnamurthy Rao, Hewlett-Packard

Problem Statement:

I have developed a workflow that I want to transport to a production client. After much testing I changed the agent assignment to general task and then transported to QA but the agent assignment did not actually got transported.

How do I get my agent assignment into a transport so that I can move the agent assignment from one system to another system? 

Solution:  

Step 1: Go to transaction RE_RHMOVE30 

Step 2:

Select Plan version: 01

Select Object Type: TS

Select Object ID : your 8 digit task id number e.g. 99999999

Also,

Page 123: Work Flow

In the Transport section enter or create your change request

Select "Transport Objects" and

Deselect "Test" and "With Lock" 

Step 3: Execute and go to next screen. 

Page 124: Work Flow

Step 4:

On the next screen select the row with your task id Press "Add to Transport"

Then again select the row with your task id and press "Transport/Delete" this will bring up the prompt to create a customizing request as shown below. 

Remember: After clicking on “Add to Transport” you need to further click on “Transport/Delete” without doing this together you won’t see anything happening on your screen.

Step 5: Create the transport request to add the agent assignment in the transport by clicking on the create button.

Page 125: Work Flow

Step 6: Go to SE09 and release the transport and you now transport your change request as normal.

Page 126: Work Flow

Using Start Conditions in Workflow

By Geethanjali K, Kaavian Systems

Go to transaction SWDD and create a new workflow definition. Then choose basic data.

Page 127: Work Flow

Give the abbreviation and choose save. After that chose the tab ‘start events’. 

Enter the following values:

Category: ‘BO’ (Business Object)

Object type: BUS2032

Event: Created 

Activate the event linkage and choose the binding button. Following screen appears: 

Page 128: Work Flow

In the above screen, A denotes “Event linkage”, B denotes “Binding” and C for “Start Conditions” 

Click on Conditions button. Chose sales organization from the pop up screen as shown below. 

Page 129: Work Flow

And choose the operator as (=) equal to and choose the constant as 3000.

Page 130: Work Flow

Now the workflow would only execute when the sales organization is 3000. Using Check Function Module in SAP Workflow

By Geethanjali K, Kaavian Systems

Following is a custom function module created for our demo purpose, which will check the conditions before triggering the workflow. 

FUNCTION ZGEE_SALES_ORG.*"----------------------------------------------------------------*"*"Local Interface:*" IMPORTING*" VALUE(OBJTYPE) TYPE SWETYPECOU-OBJTYPE*" VALUE(OBJKEY) TYPE SWEINSTCOU-OBJKEY*" VALUE(EVENT) TYPE SWETYPECOU-EVENT*" VALUE(RECTYPE) TYPE SWETYPECOU-RECTYPE*" EXPORTING*" REFERENCE(RESULT) TYPE C*" TABLES*" EVENT_CONTAINER STRUCTURE SWCONT*" EXCEPTIONS*" NOT_TRIGGERED*"----------------------------------------------------------------TABLES: VBAK. DATA VKORG LIKE VBAK-VKORG. SELECT SINGLE VKORG INTO VKORG FROM VBAK WHERE VBELN = OBJKEY. IF VKORG = '3000'. RAISE NOT_TRIGGERED. ENDIF.ENDFUNCTION.

Now go to transaction SWE2 and insert your object type, event, and the receiver type. 

Page 131: Work Flow

  Double click on your entry, following screen appears: 

Page 132: Work Flow

Provide the name of the customized function module name created earlier in the check function module field. 

Now workflow is triggered only when the sales order is created with the sales organization 3000. Retrieving the Work item information for the deleted users

By Arghadip Kar, IBM India

The request can be that a particular User has been deleted from the SAP system as he is no more in the company and we need to retrieve the work item Ids that are present in the inbox. 

First approach check whether the user Id exist in system using SU01D.  

Page 133: Work Flow

 

The corresponding User-id does not exist in the system. 

We generally used to ask the Security Team to activate the user Id to retrieve the workitem id, which is a long process and may be misleading to other users, as the user will be activated for sometime. 

Now go to transaction SE16 and enter the table name as SWWORGTASK. Here you need to give the User Id along with the Object Type (US) in the field ORG_OBJ as shown in the screenshot. 

 

Page 134: Work Flow

 

Now as a monitoring tool we can also use transaction Code SWI2_ADM2 which retrieves the work item id assigned to deleted users. 

Page 135: Work Flow

Now by picking up the entire work item Id’s we can either re-execute the rule for the work item provided some rule is used as the agent assignment step or in the task level shown in the screenshots. 

Page 136: Work Flow

We can also use the work item Ids that are retrieved from SWI2_ADM2 transaction to track the users that are deleted and inform the concerned set of users. May be the user Id of a person has changed so we need to retrieve the work item id that was present in the previous user id to be forwarded to the new users id. 

 

Page 137: Work Flow

Trigger Workflow from Messages

By Suresh Kumar Parvathaneni 

This document details about the procedure in triggering the workflows from a message (For e.g., error or warning message). 

For our demo purpose, let us consider the transaction ME21 (Create Purchase Order). Without entering any values on the screen, press ENTER. You would get the error message “Enter Purchasing Org.” (as shown below)

 

Now double-click on the message, to get the long text and the message details. 

Page 138: Work Flow

 

Now click on the technical information. 

 

The above screenshot provides us with the message details (Message Class: ME) and Message Number 083. 

Now we need to create a workflow which needs to be triggered from this message. 

Go to transaction SWUY. Following wizard appears.

Page 139: Work Flow

Click on “Continue”.

Page 140: Work Flow

Enter the message details, as obtained earlier. Click on “Continue”.

Page 141: Work Flow

Click on “Complete” again. Pop-up screen regarding the package (Development class) appears. Assign the package, you would like to have. Press ENTER. You would be automatically navigated to the “Workflow Template” screen shown below:

Page 142: Work Flow

Enter the Work item text and click on “Workflow Builder”. We are now in the “Workflow Builder” screen.

Page 143: Work Flow

For our demo purpose, let’s create a simple email step in our workflow definition. (To know about how to include an email step in the Workflow definition, click here)

Page 144: Work Flow

Activate the Workflow definition.

Testing the application

Go to transaction ME21.

Without entering any values, press ENTER. The error message “Enter Purchasing Org.” appears. Double-click on the message and the long text appears. See the screenshot below.

As highlighted in the screenshot above, the button “Workflow” is now enabled (before attaching a workflow definition to this message, this button was disabled”. Click on the button “Workflow”. The workflow definition created earlier, in this

Page 145: Work Flow

case WS99900061, is now triggered. See the screenshot below.