WF ProgramExists

Sample, Rick Rick.Sample at graybar.com
Thu Oct 14 08:12:25 EDT 2010


Sorry, dumb question. I know a flag gets set somewhere, because of the option

to fail the role if FM failed. "Terminate if Rule Resolution has no Result".



Most WFs we have a 'Fail Back' option. If role fails to find next agent in approval,

send back to last agent with a changed TEXT to inform user what to do next.

User can manually forward,  whatever...



What appears to be a better option is to get last agent and compare to the current agent.

The event AFT_REXEC "after rule executed", looks like it is what I want.



Will forward findings if anyone cares...



Thanks,

Rick


From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf Of Steffen Schloenvoigt
Sent: Thursday, October 14, 2010 4:58 AM
To: SAP Workflow Users' Group
Subject: Re: WF ProgramExists

Hmm no, but you could try to use FM 'SAP_WAPI_WORKITEM_RECIPIENTS' and check if the result is empty...

Best regards,
Steffen Schlönvoigt
2010/10/13 Sample, Rick <Rick.Sample at graybar.com<mailto:Rick.Sample at graybar.com>>
Update,
I figured out how to update the WI_TEXT with some code in CL_SWL_ADM_COMMAND-WITEXT_CHANGE.

Now, I would like to change this WI_TEXT on failure of the role res. Example, if
role res fails, set the WI_TEXT to "Error, bla bla bla you received this because could not find next agent... "
Right now, I have to execute the role res in a background task just to figure out if next agent is found, set the message if not,
etc. Then, execute the Decision task (which executes the role res again) and send to last agent.

Question: Is there a flag in Work Item container that is set if role fails?



From: Sample, Rick
Sent: Wednesday, October 13, 2010 8:53 AM
To: SAP Workflow Users' Group
Subject: WF ProgramExists


Hi all,



I have a need for a WF "Program Exit" to dynamically change the Task Text at runtime.



Currently, if I need to change a task text at runtime, I create a container element and

place it in the WI_TEXT. I then have a background task determine what the task text should be and

pass it in before the Decision step is executed. Kludgy, but it works and fairly simple to understand.



Now, I want to dynamically change this value using a Program Exit.



So I added the SAP standard CL_SWF_TST_PE_GETDESCRIPTION class to a new task and

it gets the Desc text and sets a container. Fine.

Next, I modified this class to just get/set a Work Item container. This also works fine.



Now, I tried to get this to change the Task Text with this new container element but no luck.

This changes the container element, but does not change the Work Item text.



Anyone use these WF program exits?

Any thoughts, examples, assistance is greatly appreciated.





==================================

METHOD change_cont_element.



  DATA:

   container TYPE REF TO if_swf_cnt_container,

   lh_wihandle TYPE REF TO if_swf_run_wim_internal,

   l_exception TYPE REF TO cx_swf_cnt_container,

   l_wiid TYPE sww_wiid.



  BREAK-POINT ID zexits.



  l_wiid = me->m_ctx->get_workitem_id( ).



  TRY.

      lh_wihandle = cl_swf_run_wim_factory=>find_by_wiid( l_wiid ).

      container = lh_wihandle->get_wi_container( ).

    CATCH cx_swf_run_wim.

  ENDTRY.



  TRY.

      CALL METHOD container->element_get

        EXPORTING

          name = 'ZWI_TEXT'.



      CALL METHOD container->element_set

        EXPORTING

          name             = 'ZWI_TEXT'

          value            = 'New_Text'

        IMPORTING

          exception_return = l_exception.



    CATCH cx_swf_tst_introspection_error.

    CATCH cx_swf_cnt_container.

  ENDTRY.



ENDMETHOD.




Rick Sample | SAP Workflow Analyst/Developer
11885 Lackland Road | Maryland Heights, MO 63146 | Office (314) 573-5822 | Mobile (314) 952-2273 | rick.sample at graybar.com<mailto:rick.sample at graybar.com>
www.graybar.com<http://www.graybar.com/> - Works to Your Advantage

[cid:image001.gif at 01CB6B6F.23AE04A0]<http://www.graybar.com/>




_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu<mailto:SAP-WUG at mit.edu>
http://mailman.mit.edu/mailman/listinfo/sap-wug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20101014/42ca09be/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 1548 bytes
Desc: image001.gif
Url : http://mailman.mit.edu/pipermail/sap-wug/attachments/20101014/42ca09be/attachment.gif


More information about the SAP-WUG mailing list