Workflow debug is not easy. Breakpoints do not work. There is only one effective way to debug Workflow.

You will need access to transaction SM50 – Work Process Overview.

You will need authorization to “Debug Process”.

You will need authorisation to “Change values during debug”.

Once you have checked you have all the authorisations, you have to create a FM or Method to wait.

The best practice is to create the following “Workflow debug” Table for control.

This way you can have a number of “breakpoints” and you can activate and deactivate them.

EVENT_NAME     Event name

ACTIV                  Event activ or not

WAIT_TIME          Time to wait in seconds

Your FM or Methode should be called from the BOR or Class method.

For example

CALL METHOD zcl_workflow_help=>debug_wait( x_event = ‘FIND_CUSTOMER’ ).

The Method can be for example:

DATA:

  lv_wait_until TYPE tims,

  ls_workflow_debug TYPE zworkflow_debug.

SELECT SINGLE * FROM zworkflow_debug INTO ls_workflow_debug

  WHERE event_name = x_event.

IF ls_workflow_debug IS NOT INITIAL.

  lv_wait_until = sy-uzeit + ls_workflow_debug-wait_time.

  DO.

    GET TIME.

    IF ls_workflow_debug-activ IS INITIAL OR lv_wait_time LE sy-uzeit.

      EXIT.

    ENDIF.

  ENDDO.

ENDIF.

In the table Workflow Debug you can set debug ON and OFF.

Once you have set it ON you need to run your workflow.

The workflow will wait for as many seconds as you have set.

During this time you need to start transaction SM50.

You find the waiting workflow task.

You debug the program.

In debug mode you set “Activ” off.

Than your program continues and you can debug it.

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Jonathan Bourne

    You could also use the existing SAP function modules to perform the same activity as are used in HCM Processes & Forms.

    Call function K_PLAN_WAIT_FOR_DEBUGGING in your bespoke code. Parameter ID_DEBUG_ID and ID_DEBUG_LEVEL can be set as you wish, for example, debug ID “ZTEST” and Debug Level “WF_TASK_1”.

    Then use function module K_PLAN_WAIT_FOR_DEBUGGING_CTRL to activate or deactivate the loop functionality specifying the debug ID and level specified in the bespoke code and the username (typically WF-BATCH or leave blank for all users). Set parameter ID_INSERT to “X” to activate the debugging or blank to deactivate. The current state of any active debugging can be viewed in table T811FLAGS.

    When the workflow runs the background step will enter a loop for 15 minutes after which processing will continue. During this time you can debug the process using transaction SM50.

    Regards,

    JB

    (0) 
    1. Medoyi Christudasan

      hi jonathan bourne,

               first of all thanks for the method your specified

      I have tried it out what I want to ask is ‘is it possible to see the value of workflow containers in the debugging mode as the way you specified’

      please help me I can’t see the values of workflow container.

      Regards

      Medoyi C

      (0) 
  2. Jerry Wang

    Hi József,

    thank you very much for your share! I like it. However, I guess this approach does not work if you want to debug a standard workflow whose code is not allowed to change, right?

    Best regards,

    Jerry

    (0) 
    1. József Dörnyei Post author

      Hi Jerry,

      You need to change the SAP standard code in order to debug SAP standard Workflows. There is no other way. You need to unlock it with an access key what the basis can provide.

      Cheers,

      József

      (0) 
  3. Fouad Sadik

    Hello József,

    Rather than creating your own Z code to debug this, you can follow the instructions in NOTE 1782731 to debug the standard workflows. Same steps work for Z workflows.

    This will enable you to debug background LUW processes and investigate any issues even with the standard code.

    Regards,

    Fouad.

    (0) 
    1. S D

      Hi Sadik,

      can you please explain how to debuf RFC LUW in SM58 is not clear to me.I will be thankful for explaining this step in detail.When i executed SM58 EDIT-LUW DEBUG, control didint stopped on break-point in my code.

      (0) 

Leave a Reply