Essential SAP Tutorial SAP ABAP Tips:Debugging a Background Task in SAP Business Workflow By Vadzim Khlystun 1 Copyrighted 2012 by LeverX, Inc.
Tutorial Goal Sometimes while testing SAP Workflow you need to debug ABAP code in a method used in on of the background tasks. Just setting a break-point in this method won’t work since background task is executed in another context in background. Fortunately, there is a workaround exits which can be used to debug this scenario. Be careful when using this technique because it based on causing an infinite loop in ABAP stack and can hang up SAP system if used improperly. 2 Copyrighted 2012 by LeverX, Inc.
Step 1 Add following code at the DATA lv_exit. beginning of DO. the method you want to IF lv_exit = X. debug and set EXIT. a break-point at the first line. ENDIF. ENDDO. 3 Copyrighted 2012 by LeverX, Inc.
Step 2 Run/trigger the workflow you want to debug. Run transaction SM50. Select process generated by your workflow (which most likely has username WF_BATCH) 4 Copyrighted 2012 by LeverX, Inc.
Step 3 In menu select Administration - > Program - > Debugging A new session with active debugger will pop up. After finishing debugging, change value of variable lv_exit to something else or end the process by selecting ‘Cancel’ button in Administration menu.21 July 2012 5 Copyrighted 2011 by LeverX, Inc.
Conclusion Described technique is a powerful tool which is very useful when testing SAP workflow. Use it responsibly to not cause outages in SAP system. 6 Copyrighted 2012 by LeverX, Inc.
Contact InformationPlease contact us for more information about our services or solutions available. LeverX, Inc. 800 West El Camino Real, Suite 180 Mountain View, CA 94040 USA Tel: (650) 625 – 8347 Web Site: www.LeverX.com 7 Copyrighted 2012 by LeverX, Inc.