You are on page 1of 68
SAPTips: Workflow Troubleshooting and Debugging Document Prepared By Thomas Nittmann DATAXSTREAM SAPTips: Workflow Troubleshooting and Debugging Introduction 3 Primary Components 3 Base Line Configuration 3 Event Debugging. 12 Problem! Event Linkage: 14 Resolution to Problem 1 14 Problem 2 Event Parameters: 15 Resolution A to Problem 2: 15, Resolution B to Problem 2: 23 Additional Event Information: 27 Agent Resolution Debugging 32 Problem 3 Agent Resolution: 32 Resolution to Problem 3: 32 Workflow Task (Method) Debugging 46 Foreground (Dialog) Tasks. 46 Background (Synchronous) Tasks 51 ‘Summary of Trouble Shooting Transactions. 65 TRS ROOT DATTA me DATAXSTREAM 2 SAPTips: Workflow Troubleshooting and Debugging Introduction This article focuses on practical techniques used to assist in the debugging and resolving workflow issues during the development and production support phases of SAP implementations. The SAP Workflow application incorporates the use of several components, i.e. graphical editing tool (workflow builder). ‘some object orientated concepts (use of the Business Object Repository), ABAP, and a hookitrigger mechanism into one of the SAP application modules (Fl, CO, MM, etc). As business requirements are mapped into a workflow process definition and prototyping starts, debugging becomes an essential tool to expedite the implementation of workflow process. We will concentrate on using debugging techniques to resolve real world workflow implementation and production support issues. Before we begin let's list some preliminary assumptions and guidelines ‘© The workflow engine has been enabled ‘© We are working with SAP Release 46C. There are significant changes and enhancement in release 6.1/6.2 SAP workflow technology ‘©The user should be familiar with basic workflow configuration and development, e.g. the workflow type ‘TS'is a single step task and type ‘WS'is a mult-step task. Since workflow has many different elements, starting the debugger is not as straight forward as with a stand alone ABAP program. To illustrate the best way to step in and resolve issues by debugging we will start by looking at a COPY of the standard SAP workflow template for the overall release of MM purchase requisitions. The debugging principles applied may be used with any workflow templates (customer defined or standard). A custom workflow template (WS) is being used to illustrate the use of debugging concepts on background tasks. Anew custom single step task (TS) has been created for notifying the creator of the purchase requisition release and replaces the DIALOG FOREGROUND TASK that requests the creator manually confirm a work item. Primary Components Each workflow consists of several components that are best described by answering the following questions: ‘© When should the workflow start? The answer to this question assists in determining the EVENT TRIGGERING mechanism that starts the workflow, ‘+ What steps need to occur, i. what TASKS (transactions and/or background items need to be performed) need to occur? ‘* Who performs the tasks, ie, the AGENT RESOLUTION? ‘As we proceed we will review problem solving and debugging techniques used in each of the components, Base Line Configuration First, let's break down the CUSTOM release workflow into its primary multi-step and single-step tasks. Copyright® 2004 Dataksteam LT DATAXSTREAM 3 SAPTips: Workflow Troubleshooting and Debugging Custom Workflow Template W'S99500034 (zw{_req_tel) is the multi-step task for the overall purchase requisition and is a copy of the standard template WS20000077. It contains several single-step (TS) tasks Single-step task 520000159 (mm_teq_rel_c) is a DIALOG FOREGROUND task for the overall release of the workflow. Method BUS2705-SINGLERELEASE. Single-step task 520000163 (mm_req_res_c) is a DIALOG FOREGROUND task that requests the creator of the requisition confirm that the Requisition Release was Cancelled. Method BUS2105- INFORELEASERESET. Single-step task T$20000161 (mm_req_rej_c) is a DIALOG FOREGROUND task that requests the creator of the requisition confirm that the Requisition Release was refused. Method BUS2105-INFORELEASEREJECTED. Single-step task T'$99500020 (zmm_req_ok) is a CUSTOM BACKGROUND task that replaces the standard task TS20000162 (Requisition Released). The concept to have a background task isto eliminate the additional work that would be required by confirming a FOREGROUND DIALOG work item, ie. we only want to send a NOTIFICATION and not a WORK ITEM to the creator of the requisition. We enable a NOFTIFICATION with the CUSTOM BACKGROUND task and method ZBUS2105-ZNOTIF YREQRELEASE Next, review the requisition release Workflow Builder Process Flow: Note: to display the delivered SAP Workflow use transaction PFTC > Enter ‘Worltiow Template’ for Task Type > enter 20000077’ for task> click on display > click on workflow builder. Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging easton ») rae ))} enon isa sie Rese ee Det | ‘ysTeniettonowne Ts bora won - cy) equation Dy Raquiston >) 2Reauistion ris | completed The requisition overall release workflow is pre-delivered by SAP and even though we created a custom version of the workflow there is some baseline configuration required to activate it. Many (but not all) pre- defined workflows require some sort of IMG configuration. Let's quickly review the baseline configuration: Note: to find the on-line R/3 documentation for workflow navigate to: Basis Components > Business Management (BC-BMT) > SAP Business Worlflow (BC-BMT-WFM) > Reference Documentation > BC - Worlflow Scenarios in Applications (BC-BMT-WFM) > MM ~ Materials Management: Worlflow Scenarios 1. Use transaction OMEB to activate the Overall Release for the purchase requisition document type. Note: SAP initially delivered line item release strategies and latter enhanced the application with an overall release. The purchase req. application is built on one table (EBAN) and is NOT separated into header and line item tables like most other applications. Copyright® 2004 Dataksteam LT DATAXSTREAM 5 SAPTips: Workflow Troubleshooting and Debugging [Tune [Doc. type descript item..JNRintas— |Nomg.ed [Field cel, [cont.loverRe.. [varia EC Purch.requis. 828 opt ro NEB. o FO Framework requisn, oft lez FOF Osh IN Purchequis. Kamm —ff0_ fot (oe NOD o INV )icdel specification a pt lez Re O RV ut agmt reouisn opt lez re o 2. Classification (area menu transaction CLOO) is required to set-up class and characteristic values used to determine the release strategy. Create Characteristic Values (CTO1) Create Characteristic ae FRG_EQAN_GFURT 25.02. 2003 Basie data Addn data Bacle data Description ‘Total valuo of requisition for Chars aroup a statue Roloacod Author Format Value assignment Dala ype Currency format © Singlewalue © munipie values No. orenate bs Decimalplaces 2 © interval vaues currency use. D7 Negative vale atiowou ( Rostnetario Template = O Enty requires Copyright® 2004 Dataksteam LT DATAXSTREAM 6 SAPTips: Workflow Troubleshooting and Debugging Create Characteristic eB FRG_EBAN_GFURT (25.02.2003 | Vali Basic deta Addl data Referance to table Weld Tablename —_CEBAN Field name oFuRT Decument Document I Document ype Document oat Version Procedure for value assignment User entryhanding Not ready for input Unformatted entry LL No cisplay LL Propose template TF Display aliowou values Create Characteristic a3 (sao) “enangenumner vz.0z.c0m3 | [vaiciy | values 7 adatientvatues (sinervaws creek —] Allowed Value: (char, salue Do = 1000,00 USD ie [el ole ic) Set-up an overall release class (CLO1), assign itto class type ‘032’, and Assign Characteristic Value to it Class Basic Data Copyright® 2004 Dataksteam LT DATAXSIREAM 7 SAPTips: Workflow Troubleshooting and Debugging Change Class: GB chang tenguage | fel Z[akola clasioe 92) eo Basic data Ban Deseription eauisiton Overall lease strategy =e staus Released a Class grou a Oraanizational area T Lorat class valk natn 25.62.2003 valid 31.12.9900) Seme elassifeation ‘Aushorzations © Do notchock Class matrtenanes Waring message Classification Check vith err Fine object ‘rinisiratve daa Assignments create by TNETTHANN croateon 25.62.2003 Changed by THCTTAANA Changed an 25 02 2003, Class Assignment to Characteristic Values Change Class: WF Be Change language | FFREEBAW ALL (25.62.2093) Char _Jcharscerstc feo [pata Jo. unt foro.areas JOIN Jo. -RG_EBAN _SFURT alvalue ofrequielon .URR, 16) 2/80 0) [Ei as) (Stale 3. Transaction OMGQ is required to activate the event trigger mechanism from the MM requisition application. Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging Release Group: Overview Change View "Release Groups": awa a Be ET es Te FFE EoMLALL— feqnrleace| | ol | Release code Change View "Release Codes": OH 4a Ro | fowloode_[worsow.|pesersion____| Overview Release Indicators: Change View " RFQ/ourchase orcer Release Strategy Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging Change View "Release Strategies": Overview Gl tevenies GI 2 8 (Gro[strat_[Descriation 61 [AF Releace/oD US fe] (1 [12 Intemet g (1 [IN [ntemet Tov ot RT Ret TrainngLosz0 cma 81 [TF Release/BoD GE (61 22 Rel. Training L520 Change View "Release Strategies": Details (ST SaPTips Werkiow Raleasa cones EX executive officer Foiease siatuses || Clessifcaton | | Rolasse simulation Copyright® 2004 Dataksteam LT DATAXSTREAM 10 SAPTips: Workflow Troubleshooting and Debugging Classification me View "Release Strategies" Object — Releasegrous 1 Rel. strategy ST SAPTips Worktow Class type 032 Release strategy Values ‘or Clase FRO_EBAN Al peci01 ST General | (Characteristic aescrition| [ Feta vaue orresuition O 000,008 ty I = Workflow Change View "Assignment of Role to Release Code": Overview Note: we are currently using the default agent resolution provided by SAP release strategy configuration (OMGQ). We will discuss the use of plant in the agent resolution process below. 4. Generate Class Statistics via transaction CLST (class type (032). This optimizes the SAP search process for all characteristics created fr the classification. 5. Any user that releases requisitions must be assigned 'M_EINK_FRGAL’ authorization (PFCG/SUO1) Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging Change role: Authorizations OO TB Mansity Release Coxe and Group Purchasins) Le eo Bb onslySetease Code aa Sraup (urehesing 2 feteate code . D werease group a ‘Prot name ESET 6. Lastly, make sure the event linkage is set-up via SWE2, New Entries: Details of Added Entries aaa ‘wssgspenss | Event Type Linkages Receiver FM pub_W1_CREATE_V1A_E¥ENT Bb Check function Receiver type FM Destination 7] Type linkage ective J Enable event queue Bchevier upen anor feedhack gyster preseting a Receiver sas No errors a Event Debugging There was a significant amount of work required to setup a very simple example of the release workflow for purchase requisitions; however, we are now ready to go! Workflows are primarily triggered based on Copyright® 2004 Dataksteam LT DATAXSTREAM 12 SAPTips: Workflow Troubleshooting and Debugging events generated by applications. Once the base line configuration is complete we would expect the purchase requisition application to trigger events that will start workflow when we create purchase requisitions that meet our criteria, e.g. any purchase requisition w/ document type 'NB’ and a total value over USD1000.00 (based on our OMGQ configuration). Let's create the requisition. The requisition release workflow uses trigger events coded in the original main MM purchasing program . Most often, issues arise with what the parameters that the developer expects to be passed into the workflow container from the event (ie. the eventiworkflow template binding condition). To expedite resolution to eventfworkflow binding issues we will review some helpful debugging and troubleshooting tips: Purchase requisition number 10008488 created Message no. 6 102 The total value of requisition 10008488" is USD12 600.00 so it requires the release strategy we set-up in OMGQ. Great, so we should have a workflow. Display: Purchase Requisition Statistics: for Item 00010 D) xs Creaionind, R Creted analy crested ty THITTHANU "Fined" ind. No. rasubmics. B Releaseins, 8 flocked Peau Rel. strataoy ST Total value 12.808,89 USD Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging Release wea wn ‘Release strategy ST Releases ta dale Final lease (7 Simulate welease | 28) Problem Event Linkage: \We go to transaction ‘SWI1’ and notice no workflows exist at al. Let's utilize some standard SAP utility transactions before we start going through the purchase requisition program in debug mode ‘a. turn on the event log with transaction SWELS b. re-create another purchase requisition by copying the one we just created display the event trace w/ transaction SWEL Display Event Trace | Eb) EB) (OF ete event trace | [Receverype _ ino..|ReceverFusacton 2502.2002 136841 TITIAN Teste OW 3500 2003 135642 TNITTWAN JEUS2I05 _ RELEASESTEPCREATED psoz2002 140845 _ Noravoweronioras [BUSPI05 — RELEASESTEPOREATED emma 192 TD) Woretewer enersa Hint: In former SAP releases a workflow development area menu was available to easily access the most common WF transactions. If you are more comfortable \W/the older area menu escape from the ‘Easy Menu’ by entering 7n’ in the transaction window and then enter transaction ‘SWLD' to get to the old area ‘menu Resolution to Problem 1: The event trace shows no event receiver was found. This error is typical ifthe event linkage is not set-up or not active in transaction SWE2. By reviewing SWE2 we notice that the type linkage was not set to active. To resolve the issue activate the event linkage and be sure to save the entries. To continue the exercise we can either create a new requisition to ensure workflow starts or manually start workflow for the existing requisitions. Tip: Ideally, in a production environment if workflow didn’t start when it shoukd have we would want to manually start it, You can manually create the workflow by either using transaction SWUE (create event) or SWUS (start worldiow). It's best to use transaction SWI and find a similar worktiow that has been generated to get the correct syntax and values for the container elements. Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging New Entries: Details of Added Entries gage BUS21.65 RELEASESTEPCREATED sae5Ran34 Event Typo Linkages Receiver FM SUW_NI_CREATE_VIA_EVENT Cheek function Reseiver ye FN Behavior upon error feedback System presetting Reveler status No errors & Other items to review if the issue was not resolved: ‘+ SWU3: Check the Workflow Engine ~ make sure all items are configured properly (all lights are green). ‘+ SWUB (patt of SWU3): Validate the Workflow RFC destination configured completely. Synchronize the passwords and test the RFC connection ‘+ SMS8: workflow is based on RFCs. tRFC errors are logged and can be reviewed using transaction SEB ‘+ SM21: Check the system log for workflow specific errors, ‘+ ST22: Check for workflow specific short dumps. Problem 2 Event Parameters: Often, customers identify additional event parameters that are requited in the workflow that are not being passed from the event trigger. In addition, you may expect values that you are not seeing in the workflow So you want to review the code to determine what parameters are actually getting passed from the application to the workflow. In this specific example SAP provided the ‘hooks’ (rigger mechanism) to start the workflow directly in the MM purchase requistion application. Workflow starts because we configured the OMGQ transaction to activate workflow — the MM purchase requisition program checks the OMGQ to determine if WF should be started. Several options exist to view the event parameters being passed Resolution A to Problem 2: Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging Debug the MM Purchase Requisition application and look for the Event Create function modules. Events are created using several possible function modules: SWE_EVENT_CREATE, SWE_EVENT_CREATE_IN_UPD_TASK, and SWE_EVENT_CREATE_FOR_UPDATE_TASK Before we begin with This approach it IS IMPORTANT TO NOTE that this particular application calls the workflow routines from a function module ‘in update task’, ie. we can not simply start debug and force a break- point at ‘SWE_EVENT_CREATE. This option is the most work intensive but we will review it to illustrate the process. We will proceed by using transaction MES! to create a new purchase requisition (w/ similar characteristics as before so the release strategy is evoked). Before saving the requisition we switch the debug mode on by entering ‘7h’ in the transaction window. 18) ©6@/ 088) 0005' HA) Create: Purchase Requisition: Item 00010 oo Ts Betti | a Ace sccato. eaten 10 femet—Aechsstat F ‘eoial 10 Moto of Plank 1006 [| Oy and date Guertly 1 Delvdata 0 68.12.1804 esusm tam FURR gm 907 -Req.cste 28.62 2003. Resins eT ear EEeeeN co. 12.10o< Rev. level Feed Valuation contol Val. ico 1.950,00 USD 1 wGR IR LJ Gren val Now, we can save the requisition and enter the primary MM program for purchase requisitions. Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging (\€@@/SH8/anah AA Gr ABAP_DEBUGGER A [fees | Tavie | seatpats | abrooris | calsbok | Cveiew | _ Setngs | > PROCESS AFTER INPUT FIELD EBAN-WAERS. "veuen DezinalsteTlen des Preises “498 FIELD EBAN-PREIS. "vegen DezinalsteTlen des Preises “453 HAIN 9664/6 FIELD: EBAN-PREIS, 9604/40 EBAN-BATOL, 20604 /KE Next, the fun part begins. Initially, | would suggest try setting a break-point at ‘SWE_EVENT_CREATE” and/or go to transaction SE38 or SEBO and enter program SAPMMO6B and search for ‘SWE_EVENT_CREATE’, ‘EVENT’, RELEASE’, and/or ‘Workflow’ to determine where the workflow event is triggered. Searching by function module breakpoint. Creatoideete Sane bs 6045 A @ ABAP_DEBUGGER aoo Dolata al snier2 ‘areakpont ai F) stetement shines Subroutra, shiters Peet Tunoton module Sy Bhi? . a ‘yster exception FIELD EBAN-WAERS. ‘vegen Dezinal stellen des Preise SWE_EVENT CREATE Copyright® 2004 Dataksteam LT DATAX! "7 SAPTips: Workflow Troubleshooting and Debugging By performing this once, we notice that the break point is not reached. Another purchase requisition must be created and we enter debug mode again by entering ‘/h’ in the transaction window. Hint: Most of the SAP code has it roots from the German language. The abbreviation ‘FRG’ seen throughout the code (and class system) is short for ‘Freigabe Strategie’ or Release Strategy’ To find out where workflow is triggered search the main program ‘SAPMMO6B' for the module that begins with FRG’ In debug mode we page down and review all the modules and pinpoint ‘MODULE FRGST’. Place a breakpoint here and then continue to the break-point and then step into the module. ABAP_DEBUGGER ‘The FRGST module is only used to determine the release strategy. Workflow is not started in this module ‘so we must continue. Note: the function modules ME_REL_STRATEGY_REQUISITION and ME_REL_GENERAL STRATEGY_EBAN used in module FRGST can be used to troubleshoot potential issues w/the release strategy determination for purchase requisitions. Page through the code and try to determine the where workflow is triggered. Let's search the primary purchase requisition program ‘SAPMMO6B' using search criteria ‘event’ Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging ABAP Editor: Display Mod. pool SAPMMC6B |e BD BB) Patem| | (Hf insert (iiemea + NoduTncol SAPHNOOB ‘Oln program: SAPHNOOB Copyright® 2004 Dataksteam LT 19 Global Search in Programs e9|22\a5\ a ose SAPTips: Workflow Troubleshooting and Debugging hmmressases_mc Css Fs a a A onosor ae suctes 87 4a 141+ Bente DILL FUNCTION “¥e_REL_STRATESY_AEONDSITION™ OTHERS FUNCTION HEELS EXPORTING 1 EB NEV ITER rae ob eau sinortsng oat = teasahe racess = 'ai¥e rant = “OUMUnBER tastes Te vpdke = al Le ae Page through the search criteria and try to select possible areas (and set break-points) where the event may be called. After a few attempts you should be able to determine function module ME_REL_EVENT_GENERAL_EBAN' calls the event trigger ‘SWE_EVENT_CREATE" Note: In this example, function module ‘ME_REL_EVENT_EBAN is used for individual line item release. We are using overall line item release, ie. we want approval based on the total value of all line tems. Notice that 'ME_REL_EVENT_GENERAL_EBAN' is called ‘IN UPDATE TASK. IN UPDATE TASK is used to bundle many databasé changes into a single logical unit of work. All function modules belonging Copyright® 2004 Dataksteam LT DATAXSTREAM 20 SAPTips: Workflow Troubleshooting and Debugging to the purchase requisition transaction are assigned an update key, when a commit work is performed; the update task reads the queue and processes all requests with the update key. We can set a break- point here but won't be able to debug unless we activate ‘UPDATE DEBUGGING’ ABAP_DEBUGGER FEED tchpoit SPHINN FinOeF 0. BUCHEN FORM BLUCHEN t.ebanold = yeton ese: xeban_wt-banfn = eban-banfn. Inooity yeban_vr 1reex 1 transporting aenra ca17 function '¥E_fEL_EVENT_GENERAL_EBAN ame ek exporting i_cal1_updkz = cat 1_updhz ivtban vutean 1trgea rest -troab) iernan = vfern tabtes: tcebaniney = xeten_ wt ~e tgeban_oid = yotsn_or. endit Since the ME_REL_EVENT_GENERAL_EBAN function module is being called ‘in update task’ we must activate update debugging Note: for documentation on UPDATE DEBUGGING see the R/3 online documentation: ABAP Run time Tools > Settings and Warnings (search for update debug) Settings > Update Mode... Use update debugging in debug mode. system senugoing EET imermory monitoring Display andhange al SES Table memory display orvoft ‘After the purchase requisition passes all pre-processing the update task function modules are executed Since we enabled ‘Update Debugging’ a new session will open with the ‘Update Task’ function modules. In the next print screen we finally get to the 'SWE_EVENT_CREATE' function module which is called from 'ME_REL_EVENT_GENERAL_EBAN’ Copyright® 2004 Dataksteam LT DATAXSTREAM 24 SAPTips: Workflow Troubleshooting and Debugging 5)08/66G@ 4h8 8000 Fhe ABAP_DEBUGGER AUR « > >a a SSouremadeof teers meee at [ol © Releacesteptrestes OBUTYPE = “BUS2105" EVENT = ‘RELEASESTEPCREATED" SWG_GONTATER BANF_CONTAINER Loop AT WFC WHERE DELKZ EO SPACE OR DeLKz EO *z SVo_CLEAR_CONTAINER BANF_CONTAINER ‘SWG_CREATE_CONTAINER BANF_CONTAINER SVo_SET_ELENENT GANF_GONTATHER ‘Releasetede' UFG-FREcO OBIKEY (10) = 9FC-BANEN © abjkey+19(5) = vte-batpe APPLICANT -OTYPE = *US* APPLIGANT-CBUID = WFC-ERNAN ENDLOUF cnemaie Ep STAND) Foe | 1 ANF BUFO FROCO cMnen GB oaraeossr a e0on0 ex (wT | [ 4) 89{0868513]09090 EX |TNITTHANN | opyight © 2008 DataXstream LLU DATAXSTREAM 2 SAPTips: Workflow Troubleshooting and Debugging AUF_CONTAINER [STANDARD | | B faessece Teamnée Toe 1K RELERSECODE jeoave8 1062 Ic tex At this point we see that that container element ‘RELEASECODE' with a value of 'EX' is being passed. Resolution B to Problem 2: Review the event binding in the work item. The debug option required significant work to determine exactly where the event was being triggered for the purchase requisition release strategy. Sometimes you don't need to find the exact portion of the code that calls the event and you simply want to review the event container parameters. To do so, use the work item display transaction SWI1 Note: since we are in a relatively technical mode as we analyze workflow issues itis recommended to switch your default workflow settings from a graphical view to a technical view. Go to the business workplace (transaction SBWP) > settings > workflow settings > personal settings > select ‘Technical View’ for ‘Work item display’ and ‘Workflow log’ ‘Work tern display O User view with Activex (32-Eif) ser view without ActiveX Workflow iog © User view with Activex (22-bit) ©. User view without Activex (C1 Display work item texts in logon language Eco ERMA aeCGeNTEIMI |¥| Double-clicking on an object displays the object in the same window (CJ Notips & tricks in workplace (No HTML in execution of decision tasks {br Donutvaucs | Copyright® 2004 Dataksteam LT DATAXSTREAM 23 SAPTips: Workflow Troubleshooting and Debugging Transaction SWI Selection Screen (Simply Execute). Consider entering datetime to reduce selection to specific workflow created for the application (purchase requisition) document. Also select ‘additional data’ to display the workflow number, agent, and other additional data Selection Report for Work Items oe D Selection using workilern properties Type Status Priority Task Task group Date created 27.92.2003 to Time ereated 9:25:55, fo 23:50:59 fe (lefele| Transaction SW Output. eoasia Display the workflow log for this item by clicking on the ‘Scroll’ icon (fourth icon from the left). Be sure to place the cursor on the item you want to display. We see that our workflow stil errored. The log shows you that the workflow (WS template) started but no single step tasks (TS) have been evoked, ie. we have an issue before we even gettto the first single step task. We will resolve the error in the next couple of sessions but first let's review the event parameters. Click on the WS container icon (displayed above) Copyright® 2004 Dataksteam LT DATAXSTREAM 24 SAPTips: Workflow Troubleshooting and Debugging Element name Value Ins. Purchase requisition 00 600 BUS2106 noton0e625 x Release code eX z Initator ofworkto USTMITTMANN, z a ¥ forkow 00 £00 FLOWITEM onon00547701 ¥ wy The container displays the event parameters passed the purchase requisition application to the workflow. Note: if you expect additional event parameters to be passed check the workflow definition via transaction PFTC (enter the workflow template > select ‘Triggering events’ tab> select binding defintion button) to make sure the binding has been set-up correctly. MOST OFTEN CUSTOM WORKFLOW EVENT PARAMETER BINDING ISSUES ARE A RESULT OF INCORRECT BINDING FROM THE EVENT TO THE WORKFLOW TASK. Workflow Template: Display DB covianer |W nates) B Basicdata | |Z Descristion ” 2) Triggering events SAPphone Standard events laincin... [object ype event ivame BUSOIO5 RELEASESTEPCREATED Purchaoe requisticn Release stes crea a ‘nang Betintors ee 1a Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging ‘Worklow container <- Eventcontainer Element [¢e[Eqression [Expression name WF Initiator € & EVI_OREATORS ‘Agent 2 PurchaseRequisition <= & EVT_OBJEOTE Purchase requisition ReleaseCode @ eRELEASECONER Release code ‘tek on wrktow container ful Clck on vent container to El to view allavaiable see alposaibie everts el rareneers defredtin availabe toe passed othe ‘werllow tonic, ‘worfow templet. YB | A) werktowconiainer| Erenteonainer|| 3% ees By clicking on the event container we see all element parameters the standard SAP purchase requisition application intended to pass to the workflow. After debugging the code where the event is triggered and reviewing the event container we see that it would be nearly impossible to add other event parameters to the workflow without modifying SAP source code OR perhaps looking for a user exit. Note: At this point, we have analyzed the triggering mechanism of the purchase requisition release workflow. Since the trigger mechanism, in this example, is provided by SAP in the primary purchase requisition application there is no ideal way to add additional event parameters. HOWEVER, THIS DOES NOT MEAN WE DO NOT HAVE OTHER OPTIONS. WE CAN CREATE ADDITIONAL {CUSTOM OBJECT ATTRIBUTES OR METHODS TO PULL DATA INTO THE WORKFLOW. Copyright® 2004 Dataksteam LT DATA % SAPTips: Workflow Troubleshooting and Debugging Release step created: Display Container [|B otervew Elenert wane tm. [an |_EVT_OBJECT Purchase recuisition I EW T_OBITYPE, Object type Wf EWT_NAME Event of an Object If |EWT_OBJREY Io jo |EWT_CREATOR Agent IJ jo |EWT_REGEIVER_ID Io jo |EWT_GREATION_DATE Date and time, curre IJ jo |EWT_GREATION_TIME Dat and time, curren IJ jo RoleasaCoda Release code [1 Additional Event Information: The initial part to any workflow is some sort of triggering mechanism (EVENT) to start the entire process in mation. “Several standard and custom event triggering options are available to start workflow: ‘© The application (original SAP code) triggers workflow based on configuration settings. This is how the purchase requisition release workflow that we have been reviewing is enabled. ‘+ Status Management, primarily used in the PP, PM, and SM modules, triggers the workflow based on either a SYSTEM status or USER status change. Why isn't status management available in other modules? Because the original developers of the other modules didn't incorporate status management into the applications ‘+ Acustom ABAP report (and/or function module) can be written that calls when of the standard workflow event creation function modules ‘+ Auser exit (and/or field exit) may be activated and coded to trigger workflow. ‘+ Astand alone ‘Start Transaction’ can be generated via a standard tool provided by SAP. To start workflow the end user executes the transaction, fill inthe selection screen, and executes to trigger the workflow. ‘+ Business Transaction Events (BTE's) are available for FI/CO, SD, MM and other modules. BTE's must be activated via configuration (linking the BTE w/the event function module) and/or development and are standard hooks into the application that SAP provides. When the event is triggered from the application a function module calls a BOR (Business Object Repository) event. SAP provides a function module for all BTE's that can be linked to an event. © Change documents. If a change document object is created for the application you can link any create/change/delete change document objects to a workflow event. ‘+ Message control (output determination) may be used in a similar fashion that print outs, faxes, etc are created. Message control is used in the MM and SD modules. Since message control is run inthe background itis often difficult to debug the event creation process. We sill show an example of message control in the PURCHASE ORDER APPLICATION because purchase Copyright® 2004 Dataksteam LT DATAXSTREAM 7 SAPTips: Workflow Troubleshooting and Debugging requisitions do NOT use message control. Here's a solution to assist in debugging message control (this works for fax, print, workflow and all output types available in message control) Note: Message Control, Output Determination, Output Control are different names that are generically called Condition Technique’, ie. don't let SAP confuse you - they all refer to the same process. a. Message control (aka output determination) uses function module RV_MESSAGES UPDATE’ to generate output IF the configuration is set-up properly, b. SET ABREAK POINT AT IF MSG_NO_UPDATE_TASK = SPACE.’ statement in the function module ‘RV_MESSAGE_UPDATE (\iné 95 in R/3 46C). Copyright® 2004 Dataksteam LT DATAXSTREAM 28 SAPTips: Workflow Troubleshooting and Debugging Function Builder: Display RV_MESSAGES_UPDATE (eee | (25m | (al Sls SO BW | GD) Pater || BR [of moet |(of Change Fv_WESEAGES_UPDATE prroutes Changing | Tabes | Exceptions source coge sell) (lcs) [BGs] flea) ENPTY_MAST_TABLE = 07 * check authority tor printed output * which 15 processed and printed immediately Voor st inact vhere nacha eq 1" and ysztp eq 4 and diane eq yee CALL FUNCTION RSPO_CHECK_DEVLCE_PERM{SS{0N" EXPORTING Dest = xnact-ldeot EXCEPTIONS OTHERS 1 If Sy-Subre <> 0 anact-dine = no nodify snast endit enatack | TF NSG_No_UPOATE_TABK = spAGE *YorkfTox-Fequeoter an die Yerbuchung dbergcben CALL FUNCTION “oUE REQUESTER TO UPDATE: EXCEPTIONS OTHERS = 4 IF NESSAGES_10 PROCESS EO ‘x CALL FUNCTION 'RV_NESSAGE UPDATE’ IW UPDATE TASK EXPORTING 1NS6_OBJKY = 36_oBJKY NS6_KAPPL = 36 KAPPL TABLES Ns6_JNAST = 24ST NSGOYNAST = YHAST EXCEPTINNS NO_UPDATE = 04 ENDIF ELSE CALL FUNCTION °RY_MESSAGE_UPDATE: EXPORTING NSH_OBIKY = nS6_0B.kY NSGOKAPPL = MSGlKAPPL THBLES NSG_ANAST = 3MAST NSGOYNAST = YMAST EXCEPTIONS NO_UPOATE = 07 Note: Several steps are required to set-up message control for workdiow. In this example Output Medium 9" (Events SAP Business Worlfiow) was set-up for output type ‘NEU’ (Purchase Orders) via transaction 'M/34’. Output type ‘9 is used to create an event; the other option isto set-up output medium 'T’ and trigger a task directly. Program ‘RVNSWED1’ and form routine ‘CREATE_EVENT is used to generate the event. Custom sub-type 2BUS2012 was created, Copyright® 2004 Dataksteam LT DATAXSTREAM 29 SAPTips: Workflow Troubleshooting and Debugging delegated to ZBUS2012, and custom event 'zMessageWFEvent’ was created. Template workflow (WS99500035) was created with a simple task (TS99500021) with a method that has ‘break- point’ in it. Lastly, a condition record (MNO4) was created for document type ‘NB’ to automatically {generate the workflow output when the purchase order is saved. ©. Determine the form routine used by message control to create the workflow event. Message Control (output determination) for purchase orders is set-up in the IMG under MM > Purchasing > Messages > Output Control. We simply need to review the message type 'NEU' for purchase order output to find the form driving program and form routine Display View "Processing routines": Overview (Bo Fam) Biaog Susie 2 CoupuTyses Caan erssoss Processing outnes Caparo: tnetone Ptocessing rounes [_Jasaum_[sronten, ower Ferwrouine Fam I nrseupit saprragh ENTRY MEU‘ WEOAUCIC I a saPRaSr ETRY MEU ——_AEDAUC [ [ DL SISTED E0I_PRODESEINE -Seeraemeuinee ieee a ane} Hint: SAP uses the condition technique for pricing, output, account determination, and many other functions. Each application has a diferent transaction to configure the condition technique. However, you can use transaction VKO1 to select any condition technique you would lke to maintain. 4. Seta breakpoint in the form routine ‘CREATE_EVENT’. ABAP Editor: Display Report RVNSWEO1 1 | RS La | | se | a | [Pome | A cH inser cf apiece cf Delete | as Cancel | Ferny eso) - Ig.SIREEN * das envensungaunspet rheohe Yerirbettungapregrann ‘at RAVEN FeRFOeN CHEAT e =n] ASUERCGT) 1510S SETURNCUDE ©. Goto the application that uses message control and create an application document, ¢.g transaction 'ME21’ for purchase orders (the purchase requisition application does NOT use message control). You need to make certain a condition record (MNNO4) is set-up to automatically propose the workflow output. Copyright® 2004 Dataksteam LT DATAXSTREAM 30 SAPTips: Workflow Troubleshooting and Debugging Create Purchase Order : Item Overview BES OUTO MOTs PET Bes AR EG {When you save the purchase order a debug session starts for function module RV_MESSAGES_UPDATE’ Note: The debug session will start only if message control automatically proposed output. If @ debug session did not open then manually add the out put type (Headers > Messages) and save. ABAP_DEBUGGER Di wvatengoint [_Tette | Breaiguints | wattponts | cals | ovewiew | Setings __| a ‘soucscodeot usin ml 189 [ha CALL FUNCTION" SPO_CHECR DEVICE PERMISSION xnast-dimne = 10. ocity xnast. endit endloop > @ IF Mse_No_UPDATE_Task = sPéce * Workflow-Requostor an die Vorbuchung akergobon CALL FUNCTION 'SWE_REQUESTER_TO_UPDATE” EXCEPTIONS OTHERS = 1 IF MESSAGES_T0_PROCESS EO ‘x CALL FUNCTION ‘RY MESSAGE UPDATE’ IN UPDATE TASk Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging 4g. Setvariable ‘MSG_NO_UPDATE_TASK’ =X’ and continue (be sure to change it by clicking on the pencil NS3_NO_UPDATE_TASK h. When you continue, SAP will break at the form routine for the creation of the event. ABAP_DEBUGGER Oren) REPORT RVNSWEB! TABLES: NAST FORM GREATE_EVENT FORN CREATE_EVENT STW RETURNCODE US_SOREEN * as anwendungsurspezifische Verarvel tungsprog-ann ist RSVENCOT PERFORM CREATE EVENT (RSWENGE1) USING RETURNCODE >@ US_SCREEN ENOFORM i. Later we will review how to continue debugging at the workflow task level Agent Resolution Debugging All workflow tasks that generate work items (foreground tasks) need to be assigned to an individual or group of agents. Problem 3 Agent Resolution: ‘Aworkflow work item is created but itis not assigned to an agent. Resolution to Problem 3: First, review the work item workflow log via transaction SWH (click on workflow log ‘Scroll Icon) Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging Work item selection Error ——[euicant —|esssntat_|strTpe Wanfov arp Furars Req Faleaz2). orton oa Wh Tact att) i eb DI a eaters Review the log and pinpoint where the error occurs. Double click where you see the first Message occurs’ Worktiow Log (View With Technical Details) Matton tnstance Ariipe"verttiow Eanpie PornarefenRe 336) St te APS Chora otstan (a aco. es Taapie Genes fen, Gem fortion wars 3 outta ne SP GE OMG 17 tet furcnee rereion #9008525 So ie Hoe aon cee erate) Fea RL 008 so so Click the long text The long text of the issues describes that an agent could not be determined. Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging [>| |8s|27[24) ||| [3 )|ea) Work item 547720: Agents of type A cannot be defined Meseace no. W040 Diagnosis “The ovens othe speciiod oe cou nat be determined forthe apecties were. “The towing agentes east ‘ACumrent agent of ork quoue wrkitem D Wark ier recipient far missed latest end EBeluded agent LL Pio tem recipiatifthe latest statis missed Nitessape recipient or completion ‘Work tem recipient requested end ic missed System Response “The action was teminated Procedure ‘check tna organzational assignment orthe underyng task It applicable, also check he ole entered there anc the function module implementing it “The excluded agents can only ba determined va the workfow defalion. Therefore check his dean, We need to review the standard SAP workflow agent resolutions before we continue. The first single step task (TS) step of the purchase requisition workflow (WS) release strategy is 000004" (TS20000158) Copyright® 2004 Dataksteam LT DATAXSTREAM 34 SAPTips: Workflow Troubleshooting and Debugging WorkHlow Builder» Display wt_req_rel [Active, Saved] Ose ae You can define agent resolution at the step (000004) level. Any agent resolution defined at this level will be superceded if agent resolution at the single step (TS) task level Bg] 12a ene 8950 Fe Workflow Builder - Display 'zW1_req_rel' [Active, Saved] Ose |a Latest quasi sta HS sere Latest end een (By 010028 Raauciion ioacerosee (Bhoso0s srequistorcessoe [ Ouzonst | otnaton rae ‘Gp |tsamai ow [$__Bining ests) etree farted (Wo soerssomen D9 terete emessin eceeeteeen ay tea © Tesconne Sirereardere ne Sete Zhinneshda Double click on task TS20000159 and select the ‘default role’ tab. A standard role (AC20000026) is defined, THIS IS USED TO DETERMINE THE AGENT FOR THE OVERALL RELEASE. HERE'S WHERE OUR PROBLEM OCCURS. WE NEED TO FIGURE OUT WHY AN ERROR IS OCCURING HERE Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging ‘Standard Task: Display 5G | cortaner| Re tous RReclartYoriissed atestend) | @0a60ace| i You can double click on the standard role (AC20000026) to launch the PFAC transaction and review the function module that determines the agent. Standard Role: Display 9 conarer & Role cefinition Basic data Abbr. Name MM_req_ tele Persan responsible for requien. release Role definition Type Funetion to be executed a Funetion madule Terminate itrole a ‘on has no rest Set a SOFT break-point in ME_REL_GET_RESPONSIBLE (use transaction SE37). Copyright® 2004 Dataksteam LT AASTREAM 36 SAPTips: Workflow Troubleshooting and Debugging @ 2]7H Cee SHB O55 oR Function Builder: Display ME_REL_GET_RESPONSIBLE 12a A 5M | tee | cP wr [af Cvnae tse Fel note deunertatn AE URTANGHSHOETURE SCOT ~agta, soar ieee joe ee-caret, hin calet fe Se eae. BIL Resection ike ronjecteanert “soos Now, we'll use the workflow test transaction SWUS to execute requisition release workflow WS99500034 ‘We will need the container elements so we should go to SWI1 (and then workflow log > container elements) first and displayed the errored workflow event parameters. Workflow Log (View With Technical Details) @) Agent EF Object EE orachic 9 G) Ootimize width 1 € PL BH 2 Choose i Seve | Activer( Workflow 2Vorkflow for overall release of rea Vorktlou instance SAPT1ps: Vorktiow Exanple (Purcnase Req. Release) Instance nunber sonacnsa77ia Btart date 27.02.2003 Started by We-percH stare tine a 3a Gurromt status View: Vorktiow chronicle error st {0 Mane number Task Resurt = oo Bf Se 547719 1 SAPTips: WorkTiow Evanple Gurchase Rey. Rev HorkTIou 205 Message UL O40 900 4 Massage L418 TopTTGH © ROOT DaaTSTea UL DATAXSTREAM 37 SAPTips: Workflow Troubleshooting and Debugging Doo 800 BUS2106 010008626 x USTNITTMANN 5 p00 800 FLOWITEN ono00054rr19 Go to SWUS and execute the workflow with the above container elements. Start Workflow (Test Environment) Refresh organizational environment {3 Worlflow loa sf Business Workplace ‘wseesoce34 (3) Runiime data C1 Inputdata set. Input data © Dealing data set Deadline dats enter the container elements [Elementname Walue Purchase requisition BUS2105 001 000852 Relegse cove x Be sure touse the pull down forthe Purchase reeustion’ sloment because tie defined ‘as an otiecttype Execute the test workflow. The debug point set-up in function module ME_REL_GET_RESPONSIBLE will be evoked and you can start debugging the issue Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging (666 CAR Raa Aa é ABAP_DEBUGGER IG) Bd 1D watenpoint Sounecoweet mis dal 155 [le DATA: BEGIN OF ekkakey, eheln LIKE ekko-ebeTn, FuID OF etkckey * Initialisieren der TabeT1e ACTOR_TAB > @ REFRESH actor_tab. CLEAR actor tab suc_got_elenent ac_container 'RaleaseCods' ratéb-fraab swc_cet_elenent e¢_container ‘requisition’ object, Run through the debugger and you will eventually get to a function module where SYST-SUBRC = 1 Copyright® 2004 Dataksteam LT DATAXSTREAM 39 SAPTips: Workflow Troubleshooting and Debugging 18° 668 She 805 84 ABAP_DEBUGGER SOM O weet ne ae ora. otype actor tab-otype ora onnie actor tab-ob170 tesk_otype task-otype “eek ahh ‘tack objid act_viia act_vi_ia act_plvar act_plvar act bonds earch ate act ends searchdete apres excluded agents = exclused. agents exceptions otnore 11 sy-subre > 0 errortob = actor_tad collect error_tab celete acto-_tab enc encicos aocerige table acter tab Tinas actor tines if actor_lines = 0 if exec_anforce is initial mmocsago 6313 (S¥) vith wt_objoct act task raising no_vsTid_sgent_setermined eres. message e213[S¥) vith wtobject act task raising no_vaTid_agent_determined 40 SAPTips: Workflow Troubleshooting and Debugging ‘The function module ‘RH_TASK_AGENT_CHECK ' determines if the task is assigned to a userid, It isn't so we receive the error. Let’s briefly discuss task ‘ATTRIBUTES. task w/ attribute ‘General task’ indicates any SAP user can execute the task. task w/ attribute ‘General forwarding allowed’ indicates that the original agent may forward the task to any user (even if they are note assigned to the task). © Atask w/ attribute ‘General forwarding not allowed’ indicates that the work item can only be forwarded to agents assigned to the task. To determine the task attributes go to transaction PFTC > enter the workflow template > go to display > select workflow builder > Task: Maintain a ‘Norktow tempte a ‘99500024 | Workflow Template: Display 2 [Es inital values GB Basic data Name Abbr. zwf_req_tl Name ‘2Norkflow for overall release of re, Work Hern text SAFTIps: Worknaw Example (Purchase Reg, Release) Release status Notdefned a PRR “— | (wine) Copyright® 2004 Dataksteam LT DATS At SAPTips: Workflow Troubleshooting and Debugging Navigate to the step in question (here step 000004") > double click on the step > Requisition >) release w step ste generated Double click on TS2000019 > Notifeaton | Latestone | Requested tar | Latoststa Task erall release of requisition Step name Overall release of requisition Expression z Excluded From the menu select Additional Data > Agent Assignment > Maintain > Standard task: Maintain Agent Assignment SS) attnbutes.. |) A) El org. assignment) @) Select the line item and then click attributes > Copyright® 2004 Dataksteam LT DATAXSTREAM 42 SAPTips: Workflow Troubleshooting and Debugging This is our issue. The task is not classified as general. Option one is to create an org. structure, assign a position, assign a user (or person), and then assign the task to the position. Or we can make the task ‘general so it can be executed by anybody (with the expectation that the OMGQ configuration role resolution will be used). Let's change the assignment to General Task’ and save. AHA AL @ Standard task: Maintain Agent Assignment DVECATINESISSSSUOTIFSGISHETORNNNNNN General tack = BE Re-execute the SWUS test transaction. We notice we no longer have an issue w/ RH_TASK_AGENT_CHECK Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging e) 2B COE SNR BGS BA@ ABAP_DEBUGGER GD waeroare [Tesi [enupant [watawon| cate owviw | sone) Mangogam BIN 4 (Souresodeot jtstiavot te te [wld FUNCTION Rt TORS Af ey-sutre > 0. error_tab = actor_tab eoTTect error tab) acicto setor_tas fendi endloop. describe table actor_tab Tines actor_tines 31 aotor tines = $f exec_entorce is initial nessage 6313(E¥) with vI_cotect act_task raising no_valid_agent_deternined else noscago 0313¢6¥) with vf_ovjoct act_tack raising vo_valid_agent_seternined 44 SAPTips: Workflow Troubleshooting and Debugging Create another purchase requisition from scratch and validate the workflow is correctly created (SWI). Work item selection at agean sev aie vasa By clicking on the agent icon you will notice that an agent is now correctly assigned and the workflow is no longer in error. Workflow Log (View With Technical Details) GH Aoont| EH object BB Graphic |G) Optmao wath | M4 4b) PL IER si Choco ei Savo Actvox Jerk#lon 2Vorkflow for overal? relesse of rea, Jerktlay snctance —§AeTi 98: Worktiow Exangle (Purenase Hog. ReT03c0) fnetanes nuber oooaserr27 tart date 27.92.2083 Started by Ue BATCH tart tine saat Current. status Tn process feu: Yorkriow chranicie S00 BS Be ure 4 SAPTIps: Vorktlow Example (Purchase Req. Rev’ WorkTiow © @e0 Tronas Wittmann (Sub) warktTaw created 27 2 2603 18:50:17 ©60. Thonas Wittmann SiM_FT_START 27 92. on 19:59:14 000 Thonas Wittnan York iten created after event 27.00. 2009 10:69:17 Purcha S000 EMBO srrze 4 Plosea roleace purchaso requtsttion e01S0034 00 HF-BarcH Disiog work Tien created 27.92.2603 18.50:17 Note: @ common migration issue specific to purchase requisition releases occurs when clients transition from individual line item release to overall release. If OMGQ workflow configuration is maintained at the plant level (based on single line item release) the workflow will error for overall release because there is NO PLANT AT THE HEADER LEVEL OF THE PURCHASE REQUISITION, ie. you must remove the plant from OMGQ > Workflow. By using the same debugging principles just described you would be able to determine the error. Copyright® 2004 Dataksteam LT DATAXSIREAM z SAPTips: Workflow Troubleshooting and Debugging 18 6@@ 855 8848 HA) Change View "Assignment of Role to Release Code": Overview D | Newertres || El B |_{cnfco. [bescriation [Pint [0.fauentiD_ | Workflow Task (Method) Debugging The code for a single step task (TS) is written in methods assigned to objects in the Business Object Repository (BOR). Itis often necessary to debug the method code to resolve workflow issues. Ideally, you want to start the debugger for the entire workflow but break at some point in the custom method code. Let's review the process for debugging BOTH foreground (dialog) and background (synchronous) single step tasks. Foreground (Dialog) Tasks ‘We will start by dissecting the first foreground task in the custom purchase requisition workflow WS99500034 we created. The first task is the overall release of the requisition (TS20000159). Use the workflow builder (transaction PFTC > enter ‘Workflow template’ for task type > enter task number ‘99500034’ for Name >select display > click on the ‘Workflow builder’ button) to call up the workflow and double click on the first task (step 000004) in the process flow diagram to launch the workflow template task detail screen The goals to set a break-point in the fist dialog task to aid in debugging any issues. Copyright® 2004 Dataksteam LT DATAXS 46 SAPTips: Workflow Troubleshooting and Debugging Next, double click on the task to launch the task details. Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging ‘Standard Task: Display eG) || eS Container | Ik inital values GB Basic ata Nara abr mmin_tec_tel_p Name vorall oloaso of raquisiion Wrorkitam tox Please reloase purchase requisiion & WL abject ja Numbare Roaloace ctatue Notdenned a ‘pject meron bjecttype merce E*] Execution TH Background processing SF etecutable as orn 1 Confian end of processing Double click on method 'SINGLERELEASE’ to launch the BOR definition of the method. Copyright® 2004 Dataksteam LT DATAXSIREAM @ SAPTips: Workflow Troubleshooting and Debugging PB BS © & BE Provan || Parameter || Eceptane ‘hyect tyne ZBUE2IO5 GAPTIp® Furchese Reoulsit10n imtarracos oy niotds Atietoutes fothuse Purchase CreateFrondata Create purchase recuisition Purchase Change Change purchase raquisition Purchase Getitens Read purchase requisition iter Purchase Get tensForRelease List purchase reguiertions avaiting release 2PurchaseRequisitian Delete 2PurchaseRequisitian GetDetat] 2PurchaseRequisitian fete] easelnfo 2PurchaseRequisitian Release Dolatefclose purchase rasunstticn Display purchase requisition deters Detailed release inroraation an purchase requisition Relatse purchase requnsition quisitions Prunerasekequtsitar evisteneeunece © tess ervatence 01 obye=t [—srurenaserequtsrtien. Display % — vispley oogert [——srurenasenenutsrzien.tnvofeteaseneset nro’ Release cancel ea [—ceurcnasenequt sition eart © pracess pircrase reainsytton [——srurenaseRenutsi tien. tntoneteasenesectes Into. ReTease revised [——srureraceRoqutet Lion. trvoRateasserectes tna. Release efYactad [— seurenacoRoastei tion. alot tyRouFet ease aMotitication oF Feewisttion Feleass Notice that object ‘ZBUS2105' was called. This is fine. Custom sub-type ‘ZBUS2105' was created and delegated to super type 'BUS2105'. Place the cursor on the method 2PurchaseRequisiton.SingleRelease' and then click the ‘Program’ button to launch the code for this method. We will set a soft break-point Pao SO % WS Mares Markline 235 begin methcd singlereleas= changing container 298 DATA 237 purchaserequisttion LIKE evan-tantn, 238 releasecode LIKE ra060-frgab. 239 DATA: cal1_updke, 240 auto 2M DATA: BEGIN OF bat OCCURS 10 242. INCLUDE STRUCTURE eban. 249 DATA: upek= 244 DATA: END OF oat 245 TABLES: rab 248 sic_get_slenont contziner "Raleasetads’ releasecode 247 ELEN RABBI! 249° SET PARAMETER 1 ‘BAP! FIELD raQab-bnfoo Copyright® 2004 Dataksteam LT DATAXSTREAM B SAPTips: Workflow Troubleshooting and Debugging \We cannot simply create a new purchase requisition (MES1) and expect the break point to hit because workflow is based on tRFC (transactional RFC) engine, ie. i's an asynchronous RFC (that ensures. unique execution). To test we will use the workflow test transaction 'SWUS' and a former purchase requisition (00100008529) that was already created and has a release strategy. Start Workflow (Test Environment) When we execute the data (after adding the input data) the method code is available for debugging Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging ABAP_DEBUGGER EID watenaint a DATA purchaserequisition LIKE eban-bantn, releasecode LIKE ra0sb-fraah DATA: ca1T_upokz, auta DATA EEGIN OF bat OCcURS 10 INCLUDE STRUCTURE eban DATA, updk2 DATA: END OF bat TABLES: nan euc_get_elenent container ‘ReleaseGode’ releasecode * SET PARAMETER [0 ‘BAN’ FIELD OBJECT-KEY-FURCHASEREQUISITION >} @LEAR rasb-bntpo GET PARAMETER ID "EAP" FIELD raQ6o-bnfpa * SET PARAMETER {D °BFG’ FIELD RELEASECODE * GALL TRANSACTION 'MESE" AND SKIP FIRST SCREEN *-- Aufruf Einzel freigabe > ; REFRESH hat CLEAR bat cal1_updkz auto = *x! ragsb-reTon = object -key-rumver Background (Synchronous) Tasks Special consideration is required for background tasks because any break-points in the code DO NOT cause the task to stop and wait for the user to debug. To illustrate the process of debugging we will use background task TS99500020 (2BUS2105-ZNOTIF YREGRELEASE) that sends a notfication (not a work item) to a recipient when the requisition is released has been added to the sample workflow template Hint: Several options are available for creating notifications via workdlow. The SAP delivered ‘SendMail task creating a custom method (as illustrated in this example with TS99500020/zmm_req_ok standard tas), or creating a simple method w/ begin_method and end_method (adding text fo task description and using report RSWUWFIML fo generate Copyright® 2004 Dataksteam LT DATAXSTREAM 51 SAPTips: Workflow Troubleshooting and Debugging notifications for the work item). To incorporate several different notifications into a workflow process itis sometimes simpler NOT to use the standard SAP ‘SendMail task and create your own method for the process, e.g. i's easier to dynamically create your agents for the notification from a custom method than using the standard ‘SendMaif. Copyright® 2004 Dataksteam LT DATAXSTREAM 52 SAPTips: Workflow Troubleshooting and Debugging — »)) racace Workta ie pe SD on crpctn equt mn eve Background Task TSS (Method ZBUS2105-ZNOTIFYRI Requistion release refused To debug, use the workflow builder (transaction PFTC > enter Workflow template’ for task type > enter task number ‘99500034" for Name >select display > click on the ‘Workflow builder’ button) to call up the Copyright® 2004 Dataksteam LT DATAXSTREAM 53 SAPTips: Workflow Troubleshooting and Debugging workflow and double click on the background task T'$99500020 (step 00031) in the process flow diagram to launch the workflow template task detail screen Worktlow Builder Display ‘zwt_req_rel'[Active, Saved} [Bl conor2 Roauctonwisasa can [Bl oonc25 Peauistorrisse et Next, double click on the task to launch the task details. Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging Standard Task: Display @ @ wasic data | |Z Description Alternative methods | 99) Thggering events 9) Name ‘Abbr. ZNM_REQ_OK Name Requisition Released - Sackground Workitem to Purchase requisition & Wi_Obje:t ld. Number@.releaced Release status Implemented ui Object method Object tae Method Double click on method ‘ZNOTIFYREQRELEASE to launch the BOR definition of the method and then place the cursor on the ‘ZNOTIFYREQRELEASE’ method, Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging Display Object Type ZBUS2105 gaaoae Parametere | Eveepions Ovfect type 28060105 aso Rouiet tion 2 Interfaces 2 Key fields i ketrshutes 1 Nethngs sPurchaseRequist tion. GrosteFrasbata © @ create purchase requisrtion [—zrurchasesequt sition. change © @ change purchase requnstzien [—zeurchasesequt sition. bet Ttens © @ feat uronace nesureteion ten [—trurehaseRoquts} Lion BeLTEeR®zorReTease —¥ @ List furnace rasulstttone.ava‘ting relasa [—srurchasosoautei tion. porate © @ Dototererase purchass requisition [srurchasosoautei tion. gotostart © © display purchase roguicition dotatte =PurchaseRequisi tion. GelFeTeaseInfo © © detailed release infornation on urchsse requisition sPurchaseRequisi tion, Re & @ feTosse purchase requisition sPurchaseRequisi tion, Ressthelea6@ ¥ @ Cancel release of purchase requisitions sPurchaseNequis' tian, SingleRelzsse we Individual release sPurchaseNequis!tvan.EsvstenceLheck Check evvatencs of object srurchaseRequis! tian. D1sp167 © oisplay aayect [rurchasesenutsition.tntoRelesseReset nto: Relesse canceties [zrurchasesequt sition. Eart races purchase requisition zPurchaseRequts| Lion. EnfoReTesseRejected v Iho. Relebse reruses ‘aati Info, Roteace etectae Make sure the cursor is on the ‘2NotifyReqRelease’ method and click program. Insert a soft break-point inthe code Copyright® 2004 Dataksteam LT DATAXSTREAM 56 SAPTips: Workflow Troubleshooting and Debugging 9S BO % AW @ Warkers Markiine 47 begin_nethod 2notifyreqrelesse changing container 8 49 50 5 52 cate: w_ourchase req nr 11ke etan-bantn 53. gwpurchase_req_nr = obj ect-key-nunber 5a 55 cata: gurcodo Tike eyct-cubre. “return code 58 57 58 cate 59 ytab_obicont Tike solist1 occurs 5 with header 11n2, “notit 60 ‘jtab_reclist Tike sonTrecit occurs § with header Tine, ‘receivers 6 resuTt tab Tike cukacter eccurs @ with header Tine 62 63 04 cate 85 as_doc_chng ‘ike sococengi1 86 87 68 69 70. itak_reclist-receiver = CBJEGT-LEBAN-ERNAN. “Greator cf flea 71 Tak_rectist-rec_type = “US 72 append 1tak_rectist 73 4 15 78 7 ema 89 0S da chne-obi nano = ‘SAPTing: Mork*1ou Dabuaeina’ Green arrow out back to the BOR definitions and (while in CHANGE mode) DOUBLE CLICK ON 2PurchaseRequisition.NotifyReqRelease' to pull up the method attributes. WE WANT TO SET THE DIALOG BUTTON SO WORKFLOW DOES NOT AUTOMATICALLY PROCESS THE TASK (LATER WE WILL CHANGE THIS BACK, ie. after any issues have been determined from the debug analysis) Copyright® 2004 DataTstream ILS DATAXSTREAM 57 SAPTips: Workflow Troubleshooting and Debugging ZNotfyRecRelease ‘implemented | ‘NolfyReleace | 2Nlolification of Requistion Raloase General Dialog Synchronous (C7 Resutt parameter (J Instance-independent Save, generate, and then green arrow back to the task description. You will notice that the attributes of the task have changed. The ‘Object method with dialog’ flag has been set Copyright® 2004 Dataksteam LT DATAXSIREAM w SAPTips: Workflow Troubleshooting and Debugging Standard Task: Display 8 | Conan an | B dasicdala | |Z Desitition | @® Aletnatve methods | 9) Triggering events Name ‘Abbr. ZMM_REO_OK Name Requisition Released- Background Work tem text Purchase requisition & WW1_Object_Id Number& released Release status Implemented u Objectmethed Objectiyne zoUS2I05zFurchaseReg Method NOT IFYRECRELEASE [DaNoinRelzase Green arrow twice back to the workflow builder and regenerate your workflow. Let's create a new purchase requisition (subject to the release strategy). Workflow will now stop at this task and we will be able to execute it from the work item overview. || [S[@)er |G] BJ Purchase requisition number 10008538 created Moscago no. 06 402 Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging Let's use a helpful tool from SAP called Generic Object Services (GOS — available from release 4.0 onwards) to identify the workflow for the requisition we just created. GOS is activated by the application transactions and enhances the SAP functionality by allowing you to send email, add comments, review workflow history, and many other functions. After the requisition is created display it using transaction MESS Note: as an altemative we can use SWI (work item overview to find the work iter) ie en TE a EE] Display: Purchase Requisition: item Overview BER GR DB ets | Tetoveriew (GB) RP Release stat DB Stokes [Ace saat) He Sertes “0000538 a (ia LocePH DT. 000 a ism [aster ‘Shor text (Shequestas Un Ce dle ia | Flie-1009 impor BOA ose pe Poe. 12. 1804 Use the menu and navigate to System > Services for Object, Create session Endessian User profile , Services , Ulttios ust Display: Purchase Requisitio ((Bi detaie| (Tex overview GBI A Material Short text L-1091 Impeller Type 5A, ‘own spool requests, Own jobs Shor message 09.12 ‘Anew window appears with services > click on the workflow overview to display all workflows assigned to the purchase requisition Copyright® 2004 Dataksteam LT DATAXSIREAM wo SAPTips: Workflow Troubleshooting and Debugging @ 18 €6@ 558 anaa et (=) Display: Purchase Requisition: Item Overview D Ted ovewiew | Gy |A7 Release stat | Statstcs —— — Dial |e] alae fi] em AWarTa uestea__ un cba 40 | FiiL-1001 Archived workdows apc [ppg ‘Start Workflow Data on lit 2) [aia [2i) B[ce/ es) a rkflows for object: 0010008538 isiauste¢ Current data for started workflow: SAPTips: Workflow Example (Purchase Req. Release) [Stops this process se for Step name, Status Result Time stamp Agent 25.02.2003 - Please lease purchase requisition OMI NN0E58 Ready 70.02. 2003- njoration [information objocts addrossod co far [+ Purchase requistion 0010008538 The workflow log appears. Since the background task we have created occurs after the first dialog (overall release) task we must first execute the overall release. Click on work item ID 547778 (overall release task) Copyright® 2004 Dataksteam LT DATAXS 61 SAPTips: Workflow Troubleshooting and Debugging Workflow Log (View With Technical Details) () Azent| EZ Object) BB Ovenhic || Onimize wisth 14 €|| b)|PI|EH $ Choose | BE Save | Acvax orkrtou 2korkT lou for averat! release of req. Work?lou instance S4PTips: Worktlaw Exanpl= (Purchase Req. Rel ease) Instance nunher fwsnanse7777 Start date 26.02.2003 Started by UF-paToH Sort tine. 12:36:00 Current status In process Vion: Vorkrion enremete a @0o i sarrrt 1 SAPTins: VorkfTow Exsnote (Purchases Req Ret Workfloy si ls cco if 547770 4 Please release ourchase requisition 00100004 By clicking overall release work item 547778, the work item execution window appears. Execute the work item. Note: if you cannot execute the work item from SWI then you are most likely not assigned as an agent to the task The easiest way to resolve is to change the task attribute to ‘General as described previously n this artile. Please release purchase requisition 0010008538 Omaaa WE nal) @ Loa) BB Graohie ale Please release purchase requisition 0010008538, Work item attributes Stan by Not danas End by Net dtned Fonte by Poy SMedire Seve changeel pioity status text Ready Craton date aman. 123820 Processed rom cuonam-cooo.c0 pen esusats a Description Attachments By executing the work item the task (method) calls transaction MESA to release the req. Click Release + save’ and release the requisition Copyright® 2004 Dataksteam LT DATAXS 62 SAPTips: Workflow Troubleshooting and Debugging [Bis] Release: Purchase Requisition: item Overview i (uP Release B datas 5 imen_[Avatera, inane (ayresuesies un obels dale_|PrMalgoup [pm Sune PR DT 0 Fltu-toat inoeler Tye 8 eee “pC (oc. 12. coeooris ne) tel ‘After the requisition is released you return to the work item > green arrow back to the workflow builder. You will notice that workflow now stopped on our background task (here it is work item 547779) BECAUSE WE SET IT TO A DIALOG TASK. Workflow Log (View With Technical Details) {i Avert EZ ovient [BB ovaonie ED octme wiam 14) 4 | b] [hI | 32 Choose |G Vorkttow Perio et ic VerktTow instance EAPTipas Vorkt ow Exanple (rurchace eg, ReTease) Tnstanee nuvber 90006847797 Stare date 28.12.2003. started by ve-barct Saree resco Teter eee coc View: Vorktlou chronicle 5 e280 Q@ Sarri? 1 SaeTips: Yorktloy Exanple (Purchase = 920 547778 4 Please release purchase requisitiot = eco Ha 547778 31 Purchase requisition 0010000520 re? We can click work item id 547779 to launch the work item execution screen, Copyright® 2004 Dataksteam LT SAPTips: Workflow Troubleshooting and Debugging lB 4) a B come | (@ resere | OF mar |B ton (BB oraonie Basie data | AciMes | Avllable objacts Purchase requisition 0010008538 released Work item attributes Stat by Dot dened En by Not dened Fonwandad by Prionty B Medium __ Seve changed priory Status text Ready Greston date 2p02.2003- 12630 Fiozessed fom co.00c00 03 0900, Open requests 0 Description Attacht SAPTie Workflow Evamle: Background Tas! for natfcation of murchase reouist'on release. This doze NOT raate a clog work ter, Execute the work item. You will now be able to debug the background method associated with the task Technically, we have made the method dialog to debug it. After you have finished debugging the method be sure to change the attributes back to background (switch off the dialog indicator in SWOt) and then regenerate the workflow via transaction PFTC. Copyright® 2004 Dataksteam LT DATA ue SAPTips: Workflow Troubleshooting and Debugging ABAP_DEBUGGER 4S 11D wactpoint 26082105 26082105 FORM ZNOTIFYREGRELEASE ” itab_reclist like sonlreci1 occurs 5 with header line, “receivers Pecult tab Tike euhacter occurs 0 with header Tine * structures data ge_doc_chng Tike codacchgi+ *** Reciever List Ttab_reclist-recetver = OBJEGT-LEBAN-ERNAN. “Greator oT Rey itab_reclist-rec_type = ‘Us" annend iteb_reclist *** Content of Notification * refresh itab that stores the notiticaiton text @ retresh itab_obj cont * AME of office notificaiton object 3s_dac_chrg-abj_nane = "SAPTips” Yarkfiow Debugging’ * SUBJECT of enail office notiticeiton clear gs_coc_chng-obj_descr gs_doc_chrg-obj_descr = ‘SAPTips: Purchase Req Released * TEXT of Not’ tieation Summary of Trouble Shooting Transactions Once you are able to initiate the debugging sessions all the standard ABAP debugging principles apply. Here's a review of some important transactions to assist in troubleshooting your workflows, # Transaction_| Description Notes i Swit ‘Workitem ovanview This is he most used transaction to display Copyright® 2004 Dataksteam LT DATAXSTREAM 65 SAPTips: Workflow Troubleshooting and Debugging workllows created in the SAP systems Use the technical workflow log to analyze single step tasks in a multi-step workflow Review the container element parameter values passed in to each task, change container element parameters to test different variations of the workflow, and determine who the work items are assigned to (agent resolution), [PRTC This is the general task mamntenance transaction used to develop mult- step and single step tasks. This is the entrance point to the workflow builder process diagram. Tatar versions of SAP use the following transactions: PFTC_CHG Change Tasks PFTC_COP Copy Tasks PFTC_DEL Delete Tasks PFTC_DIS Display Tasks PFTC_INS Create Tasks PFTC_STR Task Maintenance -> Be sure to request authorization to PFTC since it is less cumbersome to use than the individual transactions. In single-step tasks use the menu and go to ‘Additional Data’ > ‘Agent Assignment to check the task attributes. Remember General tasks can be executed by anybody. The area menu IMG for setting up the workflow engine Several steps are required to setup the engine. Errors usually occur w/the RFC destination (see transaction SWUB) below. Use the ‘Start verification workflow’ to validate the workflow engine is set-up correctly Warkllow RFC destination Synchronize the password and use the test button to make sure the RFC destination is working correctly. Often errors exist because someone changed the WF-BATCH user id password. 3. [Swat System Log T you cannot figure out why a particular workflow is NOT working always check the system log 6. [STZ Short Dump Log T you cannot figure out why a particular workflow is NOT working always check for short dumps. Copyright® 2004 Dataksteam LT DATAXSTREAM 66 SAPTips: Workflow Troubleshooting and Debugging 7] SWEZ Event Linkage Table T you are expecting workflows and not receiving any make sure the event is linked to a workflow receiver 8 | SWELS Tum onfoff the event race log This can help resolving event issues Validate, at minimum, that an event is being created and then check SWE2 for the event linkage. If no event is being created then there's most likely a problem with the activation of events in the application Configuration or other areas IMPORTANT: IN PRODUCTION YOU SHOULD TURN OFF THE EVENT LOG FOR DAILY USE AND ONLY TURN ON WHEN TROUBLESHOOTING. Ifthe log is on ithas a tendency to fil up the log tables and cause errars if the system is not properly maintained 3 | SWEL Display Event Trace Display any events you expectedto De triggered 70. | SWU_OBUF | Synchronize run time buffer ‘As of 5 SAP includes a task and org assignment buffer for increased performance. Any time org assignments to tasks have been made BE SURE TO SYNC THE BUFFERS. Otherwise, new agent assignment rules may not be taken into considerations, ie. you may have fixed an issue but the buffer is using the old datal TT | SWS The worktiow test Tool This ls very helpfulto start workflows for transactions where no workflows were created but were supposed to It's also a GREAT tool to start debugging tasks after you inserted a break-point Review other work items for similar tasks via transaction SWH (display the container elements) if you need help identifying values for the ‘input Data’ SWUE row event test Tool imnfar to the SWUS but this creates the event. Again, use SWI to identify container elements (event > ws) TZ. | SWE TREC butler errors Trany workllow engine Issues exist the workflow will log errors in the tRFC event tables. The use of SIM21, ST22, and SM5B are Copyright® 2004 Dataksteam LT DATAXSTREAM 67 SAPTips: Workflow Troubleshooting and Debugging essential in dentiying workflow issues: 73. | ScoT ‘SAP Connect Configuration ‘Any notifications (not work tems) wil be logged here. If there are issues with end users receiving notfications review SCOT Most often, the issue is that program RSCONNO is not running to send notification out to the SENDMAIL -or- exchange server, 72 | SW Old area menu Tor workflow Exit out of the easy menu (In), then enter development InSWLD to get to the old area’ menu 15 SWPC Restart workilows alter system crash 76 | SWA Execute work tem w/o agent check | This isa great transaction to bypass agant resolution issues and focus on other problems, TT [SWPR Restart workflow after error Copyright® 2004 Dataksteam LT DATAXSTREAM 68

You might also like