Workflow FAQ - Design and Development
Post on 28-Apr-2015
Embed Size (px)
Workflow FAQ - Design and DevelopmentSolving development challenges presented by our beloved business people
Design & Development How can I send an e-mail from my workflow? Why should I use start conditions instead of check functions? I need to write custom reports for workflow, where do I start? Why should I use events instead of starting workflows directly from ABAP? How do I send workflow notifications to my email? Where can I find examples of workflow techniques? We have started using LIV, why does the "Payment Release" workflow not start anymore? How can I use ABAP OO Classes in Workflow? How can I use "advance in dialog" with asynchronous tasks? Why should I not assign org units to steps in the workflow builder? I developed my workflows locally but want to transport them, how do I achieve this? How to find the correct evaluation path, create your own, or how to display reports regarding relations? Is there a list of SDN articles about workflow techniques available? How do I find a SAP standard event to trigger my workflow? How can I control substitution programatically? What are deadlines - and why are there four of them? Are there recommendations on the size of data that can be in the workflow container?
Answers Design & Development How can I send an e-mail from my workflow?This depends on your version. For all releases, make sure you create a foreground step and have the "Advance with dialog" flag set on the previous step if you want the sender to be properly identified. R/3 4.6 and above: Use the "Send mail" step type. In essence this is a front-end to the process from previous releases. R/3 3.0: Create an activity step and use object type SelfItem with method SendTaskDescription. The message subject is the work item text, and the message contents is the task description. You must pass the receiver addresses to the method. back to top
Why should I use start conditions instead of check functions?They handle currencies for you. They can be understood and maintained by people who don't know much about workflow. They can be enabled and disabled easily. back to top
I need to write custom reports for workflow, where do I start?Have a look for SAP_WAPI* function modules. Especially in later releases, there are more and more which are intended for customer use in manipulating workflows and reporting. Try to avoid direct access to tables and other internal info, as things DO change through the releases. back to top
Why should I use events instead of starting workflows directly from ABAP?Events are far more flexible than hardcoded routines to start a WF. They can stop workflows as well as start them, they can start multiple workflows. Most importantly, if things go wrong, events can be redelivered via the event queue (4.6 onwards). back to top
How do I send workflow notifications to my email?Up to release 6.20, have a look at the well-documented report RSWUWFML2. Release 6.40 and above - transaction SWNADMIN / SWNCONFIG On EBP/SRM systems RSWUWFMLEC does the job. back to top
Where can I find examples of workflow techniques?
SWUI, SWUI_VERIFY, SWUI_BENCHMARK, SWUI_DEMO, SWUI_WFUNIT back to top
We have started using LIV, why does the "Payment Release" workflow not start anymore?The integration between LIV and FI does not include the payment release function. There is a separate and much better solution for blocking and releasing payments in Logistics Invoice Verification. Take a look at the customizing. Note: You should remove some FI authorizations to prevent people from removing the LIV payment block in FI directly. back to top
How can I use ABAP OO Classes in Workflow?Jocelyn Dart has written an excellent paper which you can download via the WUG archives over here Please note, the Mailman Archives mangle the filenames. You will need to rename the downloaded file, changing the ".obj" extension to ".pdf" and it should then open with Acrobat Reader. Additional Note: Also read the latest and greatest help - often things are explained there that work in the lower release but didn't make it to the documentation. ABAP OO in particular is completely absent from the 620 documentation. back to top
How can I use "advance in dialog" with asynchronous tasks?This is unfortunately not possible as the very nature of asynchronous tasks contradicts the idea of 'advance in dialog', also known as synchronous dialog chains. The two main reasons for using asynch tasks are either that the termination can happen outside of WF, or to ensure that all database updates are complete. Both of these imply that there is an action happening outside of workflow (database updates can happen outside the user session after the transaction is completed). Since these happen outside the current dialog session, one would have to 'continue' another user's session in the current dialog, which is not possible. How it works on a more technical level: Asynchronous tasks use terminating events which live in the instance linkage tables (tx SWEINST). You don't normally have to touch instance linkages, the WF system creates these as necessary, and deletes it when a task completes. The main difference between instance and type linkages is that instance linkages have a key and are specific to one instance (hence the name), they are only triggered for the object with the same key. Like any other event they are passed on to the event manager who triggers the receiver (the task completion in this case) via RFC (user WF-BATCH). This is why it is theoretically impossible to advance in dialog - because the task completion happens in a separate dialog under a different user, quite possibly on a different server. Workarounds can include secondary methods (though they have their own restrictions), or redesigning your flow so that it uses a synchronous task instead e.g. by using a wait for event in a separate branch or creating a synchronous task instead. back to top
Why should I not assign org units to steps in the workflow builder?Using org objects such as positions or org units in the WF builder is not a good idea in most cases. Aside from number range mismatches when you transport, if your department splits or changes you need a transport for what should be a simple maintenance task. There are a few ways around it. The simplest is to not assign any agents in the WF but to assign your recipients as possible agents of the task (which you can assign in each system, including PRD). If WF cannot determine actual (because you've left it blank), it will send the task to all possibles. Just be very careful not to declare them as general tasks because it will then go to ALL people in the system. Alternatively create a simple responsibility rule with a dummy responsibility and use that in your WF. If you're feeling adventurous you could even design a 'meta-rule' with multiple responsibilities for different tasks/steps. This way you can maintain multiple steps' agents in one rule. back to top
I developed my workflows locally but want to transport them, how do I achieve this?Normally custom development of objects is done with objects that belong to a transportable package. Local development belongs to package $TMP. There's a simple way to change the package of any object using the following method. Go to transaction SE03, then choose Change Object Directory Entries.
You then have to choose which kind of workflow related object you want to change. Type SOBJ for changing business objects, PDWS for changing workflow templates and PDTS for standard tasks, or just use DEVC with value $TMP for changing any kind of local object. In the next screen, find the object and double click it to change the package. back to top
How to find the correct evaluation path, create your own, or how to display reports regarding relations?OM(Organizational management) relations are stored in table HRP1001. But it is inadvisable to find information that way. The reason being, SAP has numerous, better ways of retrieving that kind of data, by using evaluation paths. Evaluation paths are displayed and maintained in transaction OOAW. You can display relation information using transaction PPSS, this one even has a very handy search help for finding a correct evaluation path. And you can use report RHINFT00 to display printable lists of relations. back to top
Is there a list of SDN articles about workflow techniques available?Yes - here it is. Please don't hesitate to update this list as you discover new articles (and earn yourself some points): (last update: 23.June 2008) 1. a. b. c. d. e. f. g. 2. 3. 4. 5. 6. 7. 8. 9. Jocelyn Dart'S ABAP OO Series: Why use ABAP OO with Workflow? Getting started with ABAP OO for Workflow ... using the IF_WORKFLOW interface Using ABAP OO with Workflow Tasks Raising ABAP OO events for Workflow Using ABAP OO attributes in Workflows and Tasks Using functional methods in workflows and tasks Referencing BOR objects in ABAP OO classes Using SAP NetWeaver Business Intelligence for SAP Business Workflow Analysis Agent determination in workflow using custom table Building robust applications through Sub-Workflows Create new UI's for existing workflow tasks with ABAP Web Dynpro and Universal Worklist How to get Work items @ your Outlook Inbox Think outside the box - enhance processes with Universal Worklist Action Handlers Filtering the work items in SAP Business Workplace workflow inbox New workflow features in NetWeaver '04 - local workflows
10. Business Process Expertise and Workflow Engineering - Distinction and Overlap 11. Understanding how UWL gets work items from backend systems 12. Launching WebDynpro from Universal Worklist 13. How-to on Event creation & BOR ready reckoner 14. Just released: E-mail notifications for workflow 15. Dataflow in SAP workflow 16. How to Structure Difficult-to-Automate Business Processes 17. Creating a local workflow 18.  back to top
How do I find a SAP standard event to trigger my workflow?Switch on the event trace (txn SWELS), perform the action you are interested in, and check the event log afterwards using txn SWEL. back to top
How can I control substitution programatically?
Use BAdI WF_SUBSTITUTE. It is an advance development requiring a minimum support package level. See Note 977069 for further info. back to top
What are deadlines - and why are there four of them?There are four different deadlines available, one of which is for delaying a work item, while the others are for ensuring progress. Reading the online documentation is recommended. Requested Start is used to delay a work item. The effect on a background work item is that the execution will not take place until the deadline has been reached, while the effect on a foreground work item is that the agents will not receive it until the deadline has been reached. Latest Start, Requested End, and Latest End deadlines can really be used as you please, and the use will of course vary with the business scenario - but here follows one suggestion:
Latest End: use it when you want to escalate a work item, i.e. send it to a different agent if the work item has not been completed within the deadline. Latest Start and Requested End: use them to remind people about the work item that is waiting to be handled. Last, but not least, don't use a deadline unless there is a real need for it. Unless the business process has defined deadlines, there shouldn't be a need for deadlines in the technical solution either. back to top
Are there recommendations on the size of data that can be in the workflow container?In general, you should have small amounts of data in the workflow container. For example, use references and keys when possible. You should not pass over large data objects (e.g. wide and long tables), at least not throughout the workflow as import/export at every step.