sap_wapi_start_workflow

Breslavets, Sergey Sergey.Breslavets at anheuser-busch.com
Tue Feb 11 11:41:37 EST 2003


HI Sunni,
glad it worked out for you.
 
 
to work around your another issue try to call the transaction, which is
implemented in the WF step that you want to start immediately. Make the
corresponding task asynchronous and have the transaction raise terminating
events... the scenario will work like this:
1. you raise an event or start wf directly - workflow is started and the first
dialog workitem is created in the agent's inboxes.
2. you call the transaction which is implemented in the task's method (or you
just call the method) immediately after that - it'll pops up on the user screen
as if the workitem starts executing.
3. if user backs off the transaction, he still have the workitem in his inbox
(it's asynchronous)
4. if user completes the transaction, it'll raise the terminating event which
will complete the corresponding workitem and move the workflow to the next step.
 
 
OR,
you can move this part of the process into a separate application (transaction
of FM call) which you would call instead of SAP_WAPI_START_WORKFLOW. Depending
on the user input, this application can then trigger remaining processing via
event or direct WF start...
 
 
OR (i wouldn't recommend using it though),
instead of WAPI call you can try to use SWW_WI_START directly with the flag
'Call In Background' unchecked (WAPI function makes a background call - that's
why you don't see a thing).. It worked for me, but only if the first step in
your workflow is the Dialog.
If you going to try SWW_WI_START remember to use SWCONT type container
(SAP_WAPI_START_WORKFLOW uses SWR_CONT) and macros swc_set_... to populate it.
 
 
 
good luck,
Serge
 
P.S.
 
 
 
-----Original Message-----
From: Sunni sunni [mailto:sunnilondon at hotmail.com]
Sent: Tuesday, February 11, 2003 5:59 AM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: sap_wapi_start_workflow
 
 
Thanks ever so much for your help, the WAPI now starts the workflow ok.
Unfortunately, like the swe_event_create function module, when I start the
workflow using this WAPI, it still does not start the first step of the
workflow immediately (advance with dialog not working though checked on the
first step).  I thought an advantage of using the start workflow WAPI was to
enable this functionality (as stated in the book).
Could it be I've missed something?  When you start the workflow from the
generic object services, it does start immediately, any ideas why its not
doing this for me i.e. I see the first item in my inbox though it should pop
up as I am the initiator.
 
Kind Regards
Sunni
 
 
 
 
 
>From: "Breslavets, Sergey" <Sergey.Breslavets at anheuser-busch.com>
>Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
>To: SAP-WUG at MITVMA.MIT.EDU
>Subject: Re: sap_wapi_start_workflow
>Date: Mon, 10 Feb 2003 18:07:25 -0600
>
>Sunni,
>
>review your workflow container import elements to figure out what are
>the import parameters - You may also want to check the triggering event
>binding..
>
>When you figure out which parameters you need to pass, put them into WF
>container and call FM - check sample code below.
>
>Regards,
>Serge
>
>------------------------------------------------------------------------
>--------------------
>REPORT Z_WAPI_WF_START.
>include <cntain>.
>
>data: z_bus2080 type swc_object.
>
>data: begin of bus2080_key,
>       id like viqmel-qmnum,
>       end of bus2080_key.
>
>data: wf_cont type SWR_CONT occurs 0 with header line.
>
>parameters: qmnum like viqmel-qmnum.
>
>bus2080_key-id = qmnum.
>
>swc_create_object z_bus2080 'BUS2080' bus2080_key.
>
>** Populate first container element - object type BUS2080
>clear wf_cont.
>move: 'BUS2080' to wf_cont-element,
>       z_bus2080 to wf_cont-value.
>append wf_cont.
>
>** Populate second container element - char variable USERNAME
>clear wf_cont.
>move: 'USERNAME' to wf_cont-element,
>       sy-uname to wf_cont-value.
>append wf_cont.
>
>
>** Call WAPI function
>CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
>   EXPORTING
>     TASK                  = 'WS94600159'  "<-- Your task ID
>*   LANGUAGE              = SY-LANGU
>* IMPORTING
>*   RETURN_CODE           =
>*   WORKITEM_ID           =
>  TABLES
>    INPUT_CONTAINER       = wf_cont
>*   MESSAGE_LINES         =
>*   MESSAGE_STRUCT        =
>..
>------------------------------------------------------------------------
>--------------------
>
>
>
>
>
>-----Original Message-----
>From: Sunni sunni [mailto:sunnilondon at hotmail.com]
>Sent: Monday, February 10, 2003 12:21 PM
>To: SAP-WUG at MITVMA.MIT.EDU
>Subject: Re: sap_wapi_start_workflow
>
>
>Hi
>
>Still not sure exactly how to populate the container manually using
>swc_set_element and pass it to the table parameter.  The object type is
>zbus2080.
>
>I've tried every permutation I can think of, but to no avail, only to
>hit
>short dumps& errors.  Do you have any sample code or example?
>
>Many thanks
>Sunni
>
>
>
>
> >From: "Breslavets, Sergey" <Sergey.Breslavets at anheuser-busch.com>
> >Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
> >To: SAP-WUG at MITVMA.MIT.EDU
> >Subject: Re: sap_wapi_start_workflow
> >Date: Mon, 10 Feb 2003 11:12:17 -0600
> >
> >Hi Sunni,
> >
> >use swc_ macros to populate the container (swc_set_element and
> >swc_set_table).
> >Macro definitions are in <CNTN01>.
> >
> >Regards,
> >Sergey
> >
> >P.S. your guess is right: when you start your workflow via event, the
>event
> >object key and additional values are passed to the workflow container
>via
> >the
> >event parameters (as you specified in the event binding definition).
> >When you start workflow directly using SAP_WAPI_START_WORKFLOW, you
>need to
> >populate the container manually and pass it as the table parameter in
>the
> >FM
> >call.
> >
> >
> >
> >-----Original Message-----
> >From: Sunni sunni [mailto:sunnilondon at hotmail.com]
> >Sent: Monday, February 10, 2003 10:49 AM
> >To: SAP-WUG at MITVMA.MIT.EDU
> >Subject: sap_wapi_start_workflow
> >
> >
> >Hi Workflow experts,
> >
> >I'm trying to start a workflow explicitly using the WAPI
> >SAP_WAPI_START_WORKFLOW.  I was able to start it with an event
> >swe_event_create easily enough, but this did not support synchronous
>dialog
> >chain (advance with dialogue), hence I'm trying out the WAPI.
> >I'm confused with what parameters to send it in my program.
> >
> >'Task' is ok, I pass it the Workflow template number. I don't know how
>to
> >get it to pick up the object type (BUS2080) and object key (from object
> >instance).  I think I'm suppose to use the input container, but all
>this
> >contains is two string variables, element and value??? I don't know how
> >these value pairs work.  I've done the courses and read the book, no
> >details
> >to be found on how to make this work.
> >
> >CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
> >          EXPORTING
> >               TASK            = TASK
> >*            LANGUAGE        = SY-LANGU
> >          IMPORTING
> >               RETURN_CODE     = RETURN_CODE
> >               WORKITEM_ID     = WORKITEM_ID
> >          TABLES
> >               INPUT_CONTAINER = INPUT_CONTAINER
> >               MESSAGE_LINES   = MESSAGE_LINES
> >          EXCEPTIONS
> >               OTHERS          = 0.
> >
> >I would appreciate if anyone has used this before and can give me a
>little
> >guidance.  I'm starting a workflow from a bespoke button on a screen,
>and I
> >need the first step to show up immediately.
> >
> >Any ideas?
> >
> >Kind regards
> >Sunni Marcus
> >
> >
> >
> >
> >
> >_________________________________________________________________
> >Surf together with new Shared Browsing
> >http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID=74&DI=10
>59
>
>
>_________________________________________________________________
>Express yourself with cool emoticons http://messenger.msn.co.uk
 
 
_________________________________________________________________
Chat online in real time with MSN Messenger http://messenger.msn.co.uk
 


More information about the SAP-WUG mailing list