WF ProgramExists

Sample, Rick Rick.Sample at graybar.com
Thu Oct 14 11:26:55 EDT 2010


Mike,

That is sort of what I have right now. Pre/Post BG steps on these approval tasks. 
I have a wee bit of time to play around with these WF Program Exits and 
determine if I have valid use 'without' over engineering my WF. 
It looks doable and some simple container ops seem to work... mostly anyway. 

I am hacking some of the class files in the SWF_TST package. First try was the WF Trace. 
That did not work. Won't turn on via the class file. Annoying, but got the container ops 
code and kicking around.

You use this functionality? 

I plan to spend a day or two more and see what I can get out of these class files. 

As always, thanks for the feedback.
Rick

> -----Original Message-----
> From: sap-wug-bounces at mit.edu [mailto:sap-wug-
> bounces at mit.edu] On Behalf Of Mike Pokraka
> Sent: Thursday, October 14, 2010 8:03 AM
> To: SAP Workflow Users' Group
> Subject: RE: WF ProgramExists
> 
> Rick,
> 
> Just a general comment which may not apply, but I find
> that I tend to do role resolution separately more often
> than not as it avoids most of these conundrums.
> To accomplish your scenario I'd use two conditional texts in
> my work item and pass in a flag to display one or the other.
> It may be possible to catch the forwarding action via a work
> item exit (not sure & no time to look into it) and change
> the flag in the container - the new text would be displayed
> automatically for the new user.
> 
> Cheers,
> Mike
> 
> On Thu, October 14, 2010 1:12 pm, Sample, Rick wrote:
> > 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.c
> om>>
> > 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.grayb
> ar.com/>
> >
> >
> >
> >
> > _______________________________________________
> > SAP-WUG mailing list
> > SAP-WUG at mit.edu<mailto:SAP-WUG at mit.edu>
> > http://mailman.mit.edu/mailman/listinfo/sap-wug
> >
> > _______________________________________________
> > SAP-WUG mailing list
> > SAP-WUG at mit.edu
> > http://mailman.mit.edu/mailman/listinfo/sap-wug
> >
> 
> 
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug




More information about the SAP-WUG mailing list