48
2001 ASUG Fall Conference, New Orleans T esting and Debugging W orkflows Susan Keohan Massachusetts Institute of T echnology October 21, 2001 W orkflow/W ebFl ow Trac k ³Where making your work flow is our business´

Workflow DEBUG[1]

  • Upload
    kam3kan

  • View
    224

  • Download
    0

Embed Size (px)

Citation preview

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 1/48

2001 ASUG Fall Conference, New Orleans

Testing and Debugging Workflows

Susan KeohanMassachusetts Institute of TechnologyOctober 21, 2001

Workflow/WebFlow Track ³Where making your work flow is our business´

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 2/48

2001 ASUG Fall Conference, New Orleans

Testing and Debugging workflowcan be a very challenging task.

My goal here is to help you identify

the tools to complete that task.

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 3/48

2001 ASUG Fall Conference, New Orleans

Testing and Debugging Workflows

Business object builder - Attributes- Methods

Events ± Event linkage- Event test tools- Event check FMs, receiver type FMs

RolesWorkflow analysis ± Diagnostic tool

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 4/48

2001 ASUG Fall Conference, New Orleans

Debugging With BOB

Pick the attribute or method you need todebug, and push the

µProgram¶ button to get tothe ABAP code«

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 5/48

2001 ASUG Fall Conference, New Orleans

Debugging With BOB

Place the cursor on thecode you are interested

in, and set the

breakpoint

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 6/48

2001 ASUG Fall Conference, New Orleans

Debugging With BOB

Set the debugger

on and use thewrench

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 7/48

2001 ASUG Fall Conference, New Orleans

Debugging With BOB

Push µInstance¶

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 8/48

2001 ASUG Fall Conference, New Orleans

Debugging With BOB

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 9/48

2001 ASUG Fall Conference, New Orleans

Debugging With BOB

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 10/48

2001 ASUG Fall Conference, New Orleans

Debugging With BOB

Just push the µgo¶ iconfor the method you

need

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 11/48

2001 ASUG Fall Conference, New Orleans

Debugging With BOB

Don¶t forget to push theDebugging Button

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 12/48

2001 ASUG Fall Conference, New Orleans

Debugging With BOB

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 13/48

2001 ASUG Fall Conference, New Orleans

Debugging With BOB

Set a breakpoint in the code of attribute (or method), before things really get µinteresting¶

If you have calls to macros (swc_get_element, etc)you *may* need to set the values of the resultelements inside the debugger (for example, whengetting an element from the workflow container)

You can then step through debugging the attribute or

method as you would any other ABAP code

You probably want to step OVER the macro calls.They can be mildly disturbing, and it serves no

purpose to go there.

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 14/48

2001 ASUG Fall Conference, New Orleans

Debugging Events

Event linkage in the workflowEvent linkage (SWETYPV)Event creation (SWUE)Simulate event (SWU0)Check the event log (SWEL)RFC queue (SM58)

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 15/48

2001 ASUG Fall Conference, New Orleans

Event Linkage in the Workflow Definition

This is the event you wantthis workflow to start with

Always check your binding to

the event

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 16/48

2001 ASUG Fall Conference, New Orleans

Event Linkage With SWETYPV

The checkbox tells youthis event is linked to a

workflow, well, sort of«

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 17/48

2001 ASUG Fall Conference, New Orleans

Event Linkage With SWETYPV

Workflow Name

Note thatthis is

ACTIVE

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 18/48

2001 ASUG Fall Conference, New Orleans

Check FM or Receiver Type FM ?

A check function module can be used tosimply abend if the object does not meet thecriteria for your workflow (i.E.: It¶s not the

correct document type)A receiver type FM can be used todynamically determine which of a number

of workflows should be called based onobject attributes (much more efficient thanmany check FMs!)

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 19/48

2001 ASUG Fall Conference, New Orleans

Event Triggering With SWUE

Use this flag to startthe ABAP debugger

Fill in the Object Key of theobject you are working with

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 20/48

2001 ASUG Fall Conference, New Orleans

Event Triggering With SWUE

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 21/48

2001 ASUG Fall Conference, New Orleans

Event Triggering With SWUE

Set the breakpoint in your receiver FM first, then

when you check µTrigger FM synch¶, you will get

to your breakpoint

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 22/48

2001 ASUG Fall Conference, New Orleans

Event Simulation With SWU0

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 23/48

2001 ASUG Fall Conference, New Orleans

Event Simulation With SWU0

Check the statuses of theworkflows.

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 24/48

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 25/48

2001 ASUG Fall Conference, New Orleans

Errors in the Event Log (SWEL)

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 26/48

2001 ASUG Fall Conference, New Orleans

Errors in the Event Log (Drill Down)

Now, at least I knowwhere to begin

debugging again

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 27/48

2001 ASUG Fall Conference, New Orleans

SM58 (or Program RSARFCRD)

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 28/48

2001 ASUG Fall Conference, New Orleans

Errors in the RFC Queue

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 29/48

2001 ASUG Fall Conference, New Orleans

What Is the Event Passing ?

Specify your username

SpecifySWE_EVENT_

MAIL

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 30/48

2001 ASUG Fall Conference, New OrleansThe Event Manager Sends You SAPOffice

Mail«

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 31/48

2001 ASUG Fall Conference, New Orleans

What Is the Event Passing ?

These are thecontainer elements

passed by the event

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 32/48

2001 ASUG Fall Conference, New Orleans

Workflow Did Not Start

If the event was triggered, but the workflowstill did not start, it is likely the object doesnot yet exist in the database. In this case,

you may need to use other methods to getthe object information into your workflow(while the database commit gets

performed).Use the event simulation transaction(SWU0) to see which workflows are linkedto the event, and what their statuses are.

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 33/48

2001 ASUG Fall Conference, New Orleans

Role Resolution ± Who¶s Got the Workitem ?

Function Module to be

executed to determinewho the agent of this

workitem is

I like this, because I¶drather get an error, then

have the whole world getthe workitem!

This icon will simulate therole

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 34/48

2001 ASUG Fall Conference, New Orleans

Simulating the Role Resolution

Fill in your objectattributes (requiredimport parameters)

Then push thewrench to see if your role returns

any agents

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 35/48

2001 ASUG Fall Conference, New Orleans

Debugging the Role Resolution FM

Go to SE37 and enter your function modulenameChoose the wrench (µtest/execute¶) tool

On the next screen, push µdebugging¶You will be taken into the ABAP debugger Note: you will not have the µworkflowcontext¶

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 36/48

2001 ASUG Fall Conference, New Orleans

Debugging the Role Resolution FM

You will need to setthese values after

control returns fromthe macros

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 37/48

2001 ASUG Fall Conference, New Orleans

The Diagnostic Tool, SWUD

The current workflowto be analyzed

List of testoptions

Last 10workflows

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 38/48

2001 ASUG Fall Conference, New Orleans

Using the Diagnostic Tool, SWUD

The options from here are:Verify workflow customizing

Problem: task does not start

Problem: workflow is hanging

Test environment

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 39/48

2001 ASUG Fall Conference, New Orleans

Using the Diagnostic Tool, SWUD

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 40/48

2001 ASUG Fall Conference, New Orleans

SWUD- Consistency Check for Components

Evenexperienced

workflow

developersmake bindingerrors

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 41/48

2001 ASUG Fall Conference, New Orleans

The Container Monitor

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 42/48

2001 ASUG Fall Conference, New Orleans

The Workflow Trace

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 43/48

2001 ASUG Fall Conference, New Orleans

Workflow Trace

ll f l

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 44/48

2001 ASUG Fall Conference, New Orleans

Debugging Workflow (the Hard Way)Also Known As µIf All Else Fails¶

Sometimes, you still can¶t tell why aworkflow is/is not being triggeredOr, the workflow is triggered, but

immediately failsThere may be synchronizations problemswith the database, for one

Try inserting code into your check functionmodules, receiver type function modules,role resolutions, methods, etc

2001 ASUG F ll C f N O l

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 45/48

2001 ASUG Fall Conference, New Orleans

Utility Program ZWFLOG00

2001 ASUG F ll C f N O l

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 46/48

2001 ASUG Fall Conference, New Orleans

Definition of Table ZWFLOG

2001 ASUG F ll C f N O l

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 47/48

2001 ASUG Fall Conference, New Orleans

Summary

Read (and re-read!) OSS note 322526Use the diagnostic tools that SAP provides!Subscribe to SAP-WUG !http://www.sap.com/services/support/

2001 ASUG F ll C f N O l

8/4/2019 Workflow DEBUG[1]

http://slidepdf.com/reader/full/workflow-debug1 48/48

2001 ASUG Fall Conference, New Orleans

Any Questions ?