cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Debugging a Method of Class in Class Based Workflow

0 Kudos

Hello Experts,

I am new to classes and objects and also to class based workflow. Before this I have created workflows only using BOR.

I have a requirement of adding one more level in standard leave request workflow.

For that I made a copy of standard workflow template and also created a subclass of ZCL_PT_REQ_WF_ATTRIBS called ZCL_PT_REQ_WF_ATTRIBS_COPY (since ZCL_PT_REQ_WF_ATTRIBS was already created and used by other workflow templates and not allowing me to add my method).

Then I added my method in ZCL_PT_REQ_WF_ATTRIBS_COPY called REVERT_REQUEST_STATUS.

When I executed my workflow the method went into error raising exeption CX_SY_REF_IS_INITIA.

I tried to debug my method by adding an infinite do...enddo loop in my code, also tried function module K_PLAN_WAIT_FOR_DEBUGGING and K_PLAN_WAIT_FOR_DEBUGGING_CTRL, also tried following the instruction in SAP note 1782731 but with any of these methods I am unable to see my class method in SM50.

I checked SCN for similar threads but couldn't get the solution.

I checked WF-BATCH authorizations which seems to be correct since I am able to debug methods of BOR by creating infinite loop in my BOR method.

I certainly don't know where I am going wrong and why I am not able to see my class method in SM50.

Experts Please help.

Regards,

Shraddha.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Shraddha,

Could you please execute the method directly from SE24 as method CREATED declared as STATIC & check whether coming in SM50 or not.As per your screenshots DO-ENDO should display in SM50 from workflow execution.

Regards,

Shailesh

0 Kudos

Hi Shailesh,

I already tried that and after executing the method from se24 I can see the method in SM50 but when executed from workflow I can't see it.

former_member201570
Active Participant
0 Kudos
0 Kudos

Hi Shamsu,

I referred the thread already and followed the same steps, but my problem is that I am not able to debug my class method. I cannot see my method in SM50 and I don't know the reason for that. Could you please suggest why am I not able to see my class method in SM50?

Sandra_Rossi
Active Contributor
0 Kudos

If you have several application servers, use SM66 instead of SM50. Make sure that the method you want to debug is triggered by forcing it to short dump (MESSAGE 'test' TYPE 'X'), then if it dumps, replace the MESSAGE line with endless loop DO ... ENDDO. I never saw an issue with that endless loop, the workprocess could be seen with SM50/SM66.

former_member201570
Active Participant
0 Kudos

Hi ,

Please check WF Batch should have sap_all and sap_new in SU01 in profile tab.


Regards,

Shamsu

0 Kudos

But the problem is- the step in which the endless loop is defined is not hanging, it gets executed.

I have resolved my error of class instantiation, but still couldn't debug the method.

Leave request workflow is triggered via SAP_WAPI_START_WORKFLOW from a BADI  PT_GEN_REQ and not with the help of triggering event, could that be the problem?

0 Kudos

As I told in my post already WF-BATCH have all authorization and also I am able to debug BOR methods but not my class method.

Sandra_Rossi
Active Contributor
0 Kudos

If you have an endless loop, the process will automatically hang. So, you have done something wrong. There cannot be a different explanation. Or is there a bug in the kernel/ABAP loop statement? (joking)

0 Kudos

well i inserted the below loop in my code.

data: a type c value 'A',

        b type c value 'B'.

do.

     if a = b.

          exit.

     endif.

enddo.

Sandra_Rossi
Active Contributor
0 Kudos

Your code is all right. No reason to not loop endless. I don't understand what happens. Use message 'test' type 'X' to make sure your code is reached. If there's no short dump then it means your code is not reached.

PS: do. enddo. is sufficient (because at runtime you may jump after the enddo via the debug menu "jump to statement").

0 Kudos

There is no short dump in the code its running perfectly now. My code is reached because the values are getting reflected in container, but i don't know that why my method is not there in SM50 for debugging.

Former Member
0 Kudos

Hi Shraddha,

Request you to check whether you selected Background processing option in Standard Task.

As you shared, you copied standard workflow , then u must have container element of TYPE REF to CL_PT_REQ_WF_ATTRIBS or your Zclass.

If your method declared as instance method then above container must have instantiated.

Please check this & this may help out to debug your method by adding DO-ENDDO.

Before this first try to debug method from SE24 by adding DO-ENDDO , if its working from SE24 then it should work with workflow.

Regards,

Shailesh

0 Kudos

Hi Shailesh,

I did marked the task as background. Please Find Below the screen-shots.

Sandra_Rossi
Active Contributor
0 Kudos

Just a guess: you must implement the method IF_WORKFLOW~FIND_BY_LPOR, to return an instance of your class. Refer to the numerous threads in SCN, and in the SAP library.

0 Kudos

Thanks for your reply sandra.

I already have implemented IF_WORKFLOW~FIND_BY_LPOR.

Well my concern is not why my class is not instantiating but it is why am i not able to see it in SM50 for debugging inspite of adding an infinite loop in the class method.