Method Executes Fine in Foreground but not in Background

Ali Husain mr_mago40 at hotmail.com
Tue Mar 16 07:22:59 EDT 2010



Hey Andy,

Yeah you are right. I could either maintain the device type for user WF-BATCH or use the code which i have pasted earlier.

Thanks.
Ali

> From: sap-wug-request at mit.edu
> Subject: SAP-WUG Digest, Vol 64, Issue 35
> To: sap-wug at mit.edu
> Date: Tue, 16 Mar 2010 05:34:43 -0400
> 
> Send SAP-WUG mailing list submissions to
> 	sap-wug at mit.edu
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://mailman.mit.edu/mailman/listinfo/sap-wug
> or, via email, send a message with subject or body 'help' to
> 	sap-wug-request at mit.edu
> 
> You can reach the person managing the list at
> 	sap-wug-owner at mit.edu
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of SAP-WUG digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: Method Executes Fine in Foreground but not in Background
>       (Andy Curtis)
>    2. Re: Method Executes Fine in Foreground but not in Background
>       (Ali Husain)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Tue, 16 Mar 2010 08:59:35 +0000
> From: Andy Curtis <abcurtis at gmail.com>
> Subject: Re: Method Executes Fine in Foreground but not in Background
> To: sap-wug at mit.edu
> Message-ID:
> 	<14f090f01003160159h69c30484k8cc82b024f773b47 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> I think your problem is related to the Smartform.  I think your WF-BATCH
> userid does not have an Output Device assigned in SU01.
> 
> 
> 
> 
> > ---------- Forwarded message ----------
> > From: Ravi Dixit <dolbydix at gmail.com>
> > To: sap-wug at mit.edu
> > Date: Tue, 16 Mar 2010 11:50:56 +1100
> > Subject: Re: Method Executes Fine in Foreground but not in Background
> > Check SM58 for WF-BATCH.
> >
> >>
> >> Message: 4
> >> Date: Tue, 16 Mar 2010 09:02:14 +1000
> >> From: Rick Bakker <rbakker at gmail.com>
> >> Subject: Re: Method Executes Fine in Foreground but not in Background
> >> To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
> >> Message-ID:
> >>        <7a3a922f1003151602t503fa666j98ebb1c72e1e8a13 at mail.gmail.com>
> >> Content-Type: text/plain; charset=ISO-8859-1
> >>
> >> Hello Ali,
> >>
> >> Try using ST01 (system trace) to see if it shows any problems.
> >>
> >> I assume it's being run as WF-BATCH? You could try debugging it by
> >> setting an external breakpoint in your method and setting up your user
> >> to debug WF-BATCH's sessions.
> >>
> >> regards
> >> Rick Bakker
> >> Hanabi Technology
> >>
> >>
> >>
> >> On Tue, Mar 16, 2010 at 5:01 AM, Dave Weston <Dave.Weston at clockwork.ca>
> >> wrote:
> >> > Check transaction ST22 for any ABAP dumps to see if that is the problem.
> >> >
> >> > ________________________________
> >> >
> >> > From: sap-wug-bounces at mit.edu on behalf of Ali Husain
> >> > Sent: Mon 3/15/2010 2:32 PM
> >> > To: SAP WUG
> >> > Subject: Method Executes Fine in Foreground but not in Background
> >> >
> >> >
> >> >
> >> > Hey Guys,
> >> >
> >> > Sorry if i'm asking too many questions but I have a deadline in 2 days
> >> which i'm trying to beat so I guess i'll turn to you for help :)
> >> >
> >> > I'm facing a weird problem in which i'm calling a method in a background
> >> task and this method is calling a program via SUBMIT. The program calls a
> >> smartform and collect the data needed to be sent as an e-mail with the
> >> smartform as PDF attachment.
> >> > The reason why it's weird is because:
> >> > - When i run the method directly via the business object it executes
> >> fine and sends the email with no problem
> >> > - If i execute the method in foreground it also works fine with no
> >> problem
> >> > - If I attach the method to a previous task to be executed after the
> >> work item is executed it also works fine. However, with this option i had a
> >> problem which is for that task i have the confirm completion of the task
> >> dialog enabled. So whenever i cancel of the dialog to keep the work item in
> >> my inbox, the method gets executed again which i don't want. I want it to be
> >> executed only if the user confirms the completion of the dialog.
> >> >
> >> > So i decided to use a background task but when it gets executed, it is
> >> stuck in process and never completes the workflow. The method is not even
> >> executed and the mail is not sent in this case. It worked with all the
> >> previous mentioned cases except when i put it as a background which tells me
> >> something wrong with the bg job maybe. Other BG jobs are working fine and i
> >> checked the SWU3 with no problem. I also tried it in a different client in
> >> the same system and same problem happens.
> >> >
> >> > The method uses SUBMIT AND RETURN and i'm not binding anything except
> >> for the whole business object (tried both dialog is not enabled for the
> >> method and also enabled and task in BG). In the program that i'm calling i'm
> >> using the following FMs:
> >> > 'SSF_FUNCTION_MODULE_NAME'
> >> > v_form_name (smartform)
> >> > 'CONVERT_OTF'
> >> > 'SO_NEW_DOCUMENT_ATT_SEND_API1'
> >> >
> >> > Nothing wrong with the program as it executes fine on its own and also
> >> when i execute the method directly via the business object. So What is
> >> causing the background job to be stuck?
> >> >
> >> > Thanks a lot for the help.
> >> > Ali
> >> >
> >> >
> >> > ________________________________
> >> >
> >> > Hotmail: Trusted email with Microsoft's powerful SPAM protection. Sign
> >> up now. <http://clk.atdmt.com/GBL/go/210850552/direct/01/>
> >> >
> >> > _______________________________________________
> >> > SAP-WUG mailing list
> >> > 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/20100316/5d6af2fc/attachment-0001.htm
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 16 Mar 2010 09:34:39 +0000
> From: Ali Husain <mr_mago40 at hotmail.com>
> Subject: Re: Method Executes Fine in Foreground but not in Background
> To: SAP WUG <sap-wug at mit.edu>
> Message-ID: <BAY130-W20572B098B89BB054A80C48F2D0 at phx.gbl>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> 
> 
> Hey guys,
> 
> With the help of a colleague in our organization, we find out the solution to the problem. The following needs to be added before calling the Smartform FM:
> 
> 
> 
> * To get the device type
> details.
> 
>   wl_language =
> sy-langu.
> 
>  
> 
>   CALL FUNCTION
> 'SSF_GET_DEVICE_TYPE'
> 
>     EXPORTING
> 
>      
> i_language    = wl_language
> 
>      
> i_application = 'SAPDEFAULT'
> 
>    
> IMPORTING
> 
>      
> e_devtype     = wf_devtype.
> 
>  
> 
>  
> 
> w_ctrlop-getotf = 'X'.
> 
> w_ctrlop-no_dialog = 'X'.
> 
> w_compop-tdnoprev = 'X'.
> 
> w_compop-tdprinter =
> wf_devtype.
> 
> w_compop-tddest = 'LOCAL'.
> 
> 
> Thanks,
> Ali Husain
> 
> 
> > From: sap-wug-request at mit.edu
> > Subject: SAP-WUG Digest, Vol 64, Issue 34
> > To: sap-wug at mit.edu
> > Date: Tue, 16 Mar 2010 04:15:05 -0400
> > 
> > Send SAP-WUG mailing list submissions to
> > 	sap-wug at mit.edu
> > 
> > To subscribe or unsubscribe via the World Wide Web, visit
> > 	http://mailman.mit.edu/mailman/listinfo/sap-wug
> > or, via email, send a message with subject or body 'help' to
> > 	sap-wug-request at mit.edu
> > 
> > You can reach the person managing the list at
> > 	sap-wug-owner at mit.edu
> > 
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of SAP-WUG digest..."
> > 
> > 
> > Today's Topics:
> > 
> >    1. Re: Method Executes Fine in Foreground but not in Background
> >       (Ravi Dixit)
> >    2. Re: Workitems being created under different usernames
> >       (Rick Bakker)
> >    3. Re: Method Executes Fine in Foreground but not in Background
> >       (aditya rao)
> >    4. RE: Method Executes Fine in Foreground but not in Background
> >       (Ali Husain)
> > 
> > 
> > ----------------------------------------------------------------------
> > 
> > Message: 1
> > Date: Tue, 16 Mar 2010 11:50:56 +1100
> > From: Ravi Dixit <dolbydix at gmail.com>
> > Subject: Re: Method Executes Fine in Foreground but not in Background
> > To: sap-wug at mit.edu
> > Message-ID:
> > 	<eb76006c1003151750pde3d2b8hcd40781130316d55 at mail.gmail.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> > 
> > Check SM58 for WF-BATCH.
> > 
> > >
> > > Message: 4
> > > Date: Tue, 16 Mar 2010 09:02:14 +1000
> > > From: Rick Bakker <rbakker at gmail.com>
> > > Subject: Re: Method Executes Fine in Foreground but not in Background
> > > To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
> > > Message-ID:
> > >        <7a3a922f1003151602t503fa666j98ebb1c72e1e8a13 at mail.gmail.com>
> > > Content-Type: text/plain; charset=ISO-8859-1
> > >
> > > Hello Ali,
> > >
> > > Try using ST01 (system trace) to see if it shows any problems.
> > >
> > > I assume it's being run as WF-BATCH? You could try debugging it by
> > > setting an external breakpoint in your method and setting up your user
> > > to debug WF-BATCH's sessions.
> > >
> > > regards
> > > Rick Bakker
> > > Hanabi Technology
> > >
> > >
> > >
> > > On Tue, Mar 16, 2010 at 5:01 AM, Dave Weston <Dave.Weston at clockwork.ca>
> > > wrote:
> > > > Check transaction ST22 for any ABAP dumps to see if that is the problem.
> > > >
> > > > ________________________________
> > > >
> > > > From: sap-wug-bounces at mit.edu on behalf of Ali Husain
> > > > Sent: Mon 3/15/2010 2:32 PM
> > > > To: SAP WUG
> > > > Subject: Method Executes Fine in Foreground but not in Background
> > > >
> > > >
> > > >
> > > > Hey Guys,
> > > >
> > > > Sorry if i'm asking too many questions but I have a deadline in 2 days
> > > which i'm trying to beat so I guess i'll turn to you for help :)
> > > >
> > > > I'm facing a weird problem in which i'm calling a method in a background
> > > task and this method is calling a program via SUBMIT. The program calls a
> > > smartform and collect the data needed to be sent as an e-mail with the
> > > smartform as PDF attachment.
> > > > The reason why it's weird is because:
> > > > - When i run the method directly via the business object it executes fine
> > > and sends the email with no problem
> > > > - If i execute the method in foreground it also works fine with no
> > > problem
> > > > - If I attach the method to a previous task to be executed after the work
> > > item is executed it also works fine. However, with this option i had a
> > > problem which is for that task i have the confirm completion of the task
> > > dialog enabled. So whenever i cancel of the dialog to keep the work item in
> > > my inbox, the method gets executed again which i don't want. I want it to be
> > > executed only if the user confirms the completion of the dialog.
> > > >
> > > > So i decided to use a background task but when it gets executed, it is
> > > stuck in process and never completes the workflow. The method is not even
> > > executed and the mail is not sent in this case. It worked with all the
> > > previous mentioned cases except when i put it as a background which tells me
> > > something wrong with the bg job maybe. Other BG jobs are working fine and i
> > > checked the SWU3 with no problem. I also tried it in a different client in
> > > the same system and same problem happens.
> > > >
> > > > The method uses SUBMIT AND RETURN and i'm not binding anything except for
> > > the whole business object (tried both dialog is not enabled for the method
> > > and also enabled and task in BG). In the program that i'm calling i'm using
> > > the following FMs:
> > > > 'SSF_FUNCTION_MODULE_NAME'
> > > > v_form_name (smartform)
> > > > 'CONVERT_OTF'
> > > > 'SO_NEW_DOCUMENT_ATT_SEND_API1'
> > > >
> > > > Nothing wrong with the program as it executes fine on its own and also
> > > when i execute the method directly via the business object. So What is
> > > causing the background job to be stuck?
> > > >
> > > > Thanks a lot for the help.
> > > > Ali
> > > >
> > > >
> > > > ________________________________
> > > >
> > > > Hotmail: Trusted email with Microsoft's powerful SPAM protection. Sign up
> > > now. <http://clk.atdmt.com/GBL/go/210850552/direct/01/>
> > > >
> > > > _______________________________________________
> > > > 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
> > >
> > >
> > > End of SAP-WUG Digest, Vol 64, Issue 33
> > > ***************************************
> > >
> > 
> > 
> > 
> > -- 
> > Best Regards
> > Ravi Dixit
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20100316/62506b3d/attachment-0001.htm
> > 
> > ------------------------------
> > 
> > Message: 2
> > Date: Tue, 16 Mar 2010 13:32:23 +1000
> > From: Rick Bakker <rbakker at gmail.com>
> > Subject: Re: Workitems being created under different usernames
> > To: "SAP Workflow Users' Group" <sap-wug at MIT.EDU>
> > Message-ID:
> > 	<7a3a922f1003152032rf588974uc30dcda9131925e6 at mail.gmail.com>
> > Content-Type: text/plain; charset=ISO-8859-1
> > 
> > Hi Mike,
> > 
> > I made sure Advance with Dialog was turned off both for the step in
> > question and the preceding step. I also turned off Advance with Dialog
> > at the workflow header. And I looked at 'User context' in the classic
> > view. It still says the step is being created by the actual agent of
> > the previous step.
> > 
> > I then changed the agent determination to a test fm which does nothing
> > but check SY-UNAME and determine the agent based on that. Again, the
> > result was as expected - the preceding actual agent is executing the
> > rule. It could be that SAP is overwriting SY-UNAME but I did notice
> > before that the authorization problems that certain users were having
> > with the AC rule disappeared when authorizations were added, and
> > reappeared when they were taken away again.
> > 
> > So I conclude that the rule is run by the preceding actual agent, even
> > without advance with dialog.
> > 
> > cheers
> > Rick Bakker
> > Hanabi Technology
> > 
> > On Tue, Mar 16, 2010 at 12:20 AM, Mike Pokraka
> > <wug at workflowconnections.com> wrote:
> > > Just to state the obvious: did you switch it off for the previous step?
> > > Failing that, try disabling it at the workflow header just to test.
> > > I vaguely remember having problems in this area before - but that was some
> > > time ago.
> > >
> > > Another thing: Don't take the log at face value. It will show you the user
> > > under which it pretends to execute, even though the actual session may
> > > differ. Look at the technical log and switch to the old-style technical
> > > log & expand the steps. Then scroll all the way across to the right and
> > > the column 'User context' will show you the real user.
> > >
> > > To further confuse, some bits are workflow aware and will perform auth
> > > checks according to the current workflow agent, whereas others will use
> > > SY-UNAME, which may be different. (But don't always trust SY-UNAME either,
> > > because I've seen SAP code occasionally overwrite SY-UNAME in order to
> > > impersonate dialog users in a bacground process).
> > >
> > >
> > >
> > > On Mon, March 15, 2010 10:59 am, Rick Bakker wrote:
> > >> Thanks Ramki and Mike, I admit I didn't think of that. But, it doesn't
> > >> work!
> > >> Workitems are still created by the actual agent of the previous
> > >> workitem, even after SWU_OBUF.
> > >>
> > >> On Mon, Mar 15, 2010 at 8:40 PM, Mike Pokraka
> > >> <wug at workflowconnections.com> wrote:
> > >>> Rick,
> > >>>
> > >>> Creating the next work item within the current user's context
> > >>> facilitates
> > >>> advance in dialog. I think switching that off for the step involved
> > >>> should
> > >>> do the job.
> > >>>
> > >>> Cheers,
> > >>> Mike
> > >>>
> > >>>
> > >>> On Mon, March 15, 2010 5:49 am, Rick Bakker wrote:
> > >>>> Dear WUGgers,
> > >>>>
> > >>>> A custom-made workflow was sometimes failing to find an agent for a
> > >>>> Decision step via an AC rule when testing.
> > >>>>
> > >>>> Eventually the cause was tracked down and it became 100% reproducible.
> > >>>> It was only when certain users had executed the previous step, and an
> > >>>> attribute had been changed in the underlying object during the
> > >>>> workflow. It turned out to be an authorization problem.
> > >>>>
> > >>>> I have always viewed workflow logs with concern when I see which
> > >>>> usernames some of the steps or workitems have been created by. They
> > >>>> could be any old agent, usually the actual agent of the preceding
> > >>>> step. But, this was the first time I had seen it cause a problem.
> > >>>>
> > >>>> So what do I do now? Try to find every authorization that could
> > >>>> possibly be needed in every situation with this workflow (and all
> > >>>> other workflows) and request they be given to all possible users, or
> > >>>> do I insert a dummy background step after each dialog step
> > >>>> in order to pass control back to WF-BATCH? I tried the latter. It's
> > >>>> simple, quick, effective and ugly.
> > >>>>
> > >>>> Has anybody else encountered this problem?
> > >>>>
> > >>>> By the way, I tried putting in a 1-minute wait step after the step
> > >>>> where the underlying ?object gets changed, it didn't make any
> > >>>> difference. In any case, there could be other situations ?in which
> > >>>> agents don't have sufficient privileges to do whatever a step needs to
> > >>>> be created properly.
> > >>>>
> > >>>> We're on ECC 6.0.
> > >>>>
> > >>>> regards
> > >>>> Rick Bakker
> > >>>> Hanabi Technology
> > >>>> _______________________________________________
> > >>>> 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
> > >>>
> > >>
> > >> _______________________________________________
> > >> 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
> > >
> > 
> > 
> > 
> > ------------------------------
> > 
> > Message: 3
> > Date: Tue, 16 Mar 2010 10:19:08 +0530
> > From: aditya rao <aadityarao84 at gmail.com>
> > Subject: Re: Method Executes Fine in Foreground but not in Background
> > To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
> > Message-ID:
> > 	<e979b9761003152149m3d5ebac6vb15748b4c9dc1c87 at mail.gmail.com>
> > Content-Type: text/plain; charset="windows-1252"
> > 
> > Hi,
> > 
> > Have you tried to debug the background method. you can do it as follows:
> > 
> > put an infinite loop in your method
> > eg:
> > 
> > data : l_flag type char1 value 'X'.
> > do.
> > if l_flag ne 'X'.
> > exit.
> > endif.
> > enddo.
> > 
> > then goto sm50
> > select your program
> > goto program/session-->Program-->debugging.
> > 
> > this way you can debug your method in background.
> > 
> > 
> > 
> > On Tue, Mar 16, 2010 at 12:02 AM, Ali Husain <mr_mago40 at hotmail.com> wrote:
> > 
> > >
> > > Hey Guys,
> > >
> > > Sorry if i'm asking too many questions but I have a deadline in 2 days
> > > which i'm trying to beat so I guess i'll turn to you for help :)
> > >
> > > I'm facing a weird problem in which i'm calling a method in a background
> > > task and this method is calling a program via SUBMIT. The program calls a
> > > smartform and collect the data needed to be sent as an e-mail with the
> > > smartform as PDF attachment.
> > > The reason why it's weird is because:
> > > - When i run the method directly via the business object it executes fine
> > > and sends the email with no problem
> > > - If i execute the method in foreground it also works fine with no problem
> > > - If I attach the method to a previous task to be executed after the work
> > > item is executed it also works fine. However, with this option i had a
> > > problem which is for that task i have the confirm completion of the task
> > > dialog enabled. So whenever i cancel of the dialog to keep the work item in
> > > my inbox, the method gets executed again which i don't want. I want it to be
> > > executed only if the user confirms the completion of the dialog.
> > >
> > > So i decided to use a background task but when it gets executed, it is
> > > stuck in process and never completes the workflow. The method is not even
> > > executed and the mail is not sent in this case. It worked with all the
> > > previous mentioned cases except when i put it as a background which tells me
> > > something wrong with the bg job maybe. Other BG jobs are working fine and i
> > > checked the SWU3 with no problem. I also tried it in a different client in
> > > the same system and same problem happens.
> > >
> > > The method uses SUBMIT AND RETURN and i'm not binding anything except for
> > > the whole business object (tried both dialog is not enabled for the method
> > > and also enabled and task in BG). In the program that i'm calling i'm using
> > > the following FMs:
> > > 'SSF_FUNCTION_MODULE_NAME'
> > > v_form_name (smartform)
> > > 'CONVERT_OTF'
> > > 'SO_NEW_DOCUMENT_ATT_SEND_API1'
> > >
> > > Nothing wrong with the program as it executes fine on its own and also when
> > > i execute the method directly via the business object. So What is causing
> > > the background job to be stuck?
> > >
> > > Thanks a lot for the help.
> > > Ali
> > >
> > > ------------------------------
> > > Hotmail: Trusted email with Microsoft?s powerful SPAM protection. Sign up
> > > now. <http://clk.atdmt.com/GBL/go/210850552/direct/01/>
> > >
> > > _______________________________________________
> > > SAP-WUG mailing list
> > > 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/20100316/cb44a1c7/attachment-0001.htm
> > 
> > ------------------------------
> > 
> > Message: 4
> > Date: Tue, 16 Mar 2010 08:15:01 +0000
> > From: Ali Husain <mr_mago40 at hotmail.com>
> > Subject: RE: Method Executes Fine in Foreground but not in Background
> > To: SAP WUG <sap-wug at mit.edu>
> > Message-ID: <BAY130-W30B29421154C8B45FDADC8F2D0 at phx.gbl>
> > Content-Type: text/plain; charset="iso-8859-1"
> > 
> > 
> > 
> > Hey Guys,
> > 
> > There are no short dumps in ST22 and ST01 is not showing anything.
> > 
> > I found out what the problem is by commenting the code in the program piece by piece but i'm not sure why it is happening. It is the FM that calls the smartform. When i put a session break-point it does not trigger the debugger so i couldn't check which exception is being triggered. It works in the foreground but that FM is hanging when in background mode for some reason. So nothing wrong with the BG settings as it is working in other cases. It is only the case when i call the smartform in the background.
> > I'll paste in the code for that FM and see if you guys can figure out what's missing:
> > 
> > 
> > 
> > w_ctrlop-getotf = 'X'.
> > 
> > w_ctrlop-no_dialog = 'X'.
> > 
> > w_compop-tdnoprev = 'X'.
> > 
> > 
> > 
> > CALL FUNCTION v_form_name
> > 
> >   EXPORTING
> > 
> > *   ARCHIVE_INDEX              =
> > 
> > *   ARCHIVE_INDEX_TAB          =
> > 
> > *   ARCHIVE_PARAMETERS         =
> > 
> >     control_parameters         = w_ctrlop
> > 
> > *   MAIL_APPL_OBJ              =
> > 
> > *   MAIL_RECIPIENT             =
> > 
> > *   MAIL_SENDER                =
> > 
> >     output_options             = w_compop
> > 
> >     user_settings              = 'X'
> > 
> >     w_emp                      = p_pernr
> > 
> >  IMPORTING
> > 
> > *   DOCUMENT_OUTPUT_INFO       =
> > 
> >     job_output_info            =  w_return
> > 
> > *   JOB_OUTPUT_OPTIONS         =
> > 
> >   TABLES
> > 
> >     itab_prom                  = gt_prom
> > 
> >  EXCEPTIONS
> > 
> >    formatting_error           = 1
> > 
> >    internal_error             = 2
> > 
> >    send_error                 = 3
> > 
> >    user_canceled              = 4
> > 
> >    OTHERS                     = 5.
> > 
> > 
> > Thanks a lot for the help.
> > Ali
> > 
> > 
> > > From: sap-wug-request at mit.edu
> > > Subject: SAP-WUG Digest, Vol 64, Issue 33
> > > To: sap-wug at mit.edu
> > > Date: Mon, 15 Mar 2010 19:02:36 -0400
> > > 
> > > Send SAP-WUG mailing list submissions to
> > > 	sap-wug at mit.edu
> > > 
> > > To subscribe or unsubscribe via the World Wide Web, visit
> > > 	http://mailman.mit.edu/mailman/listinfo/sap-wug
> > > or, via email, send a message with subject or body 'help' to
> > > 	sap-wug-request at mit.edu
> > > 
> > > You can reach the person managing the list at
> > > 	sap-wug-owner at mit.edu
> > > 
> > > When replying, please edit your Subject line so it is more specific
> > > than "Re: Contents of SAP-WUG digest..."
> > > 
> > > 
> > > Today's Topics:
> > > 
> > >    1. Method Executes Fine in Foreground but not in Background
> > >       (Ali Husain)
> > >    2. RE: Method Executes Fine in Foreground but not in Background
> > >       (Dave Weston)
> > >    3. Re: Workitems being created under different usernames
> > >       (Rick Bakker)
> > >    4. Re: Method Executes Fine in Foreground but not in Background
> > >       (Rick Bakker)
> > > 
> > > 
> > > ----------------------------------------------------------------------
> > > 
> > > Message: 1
> > > Date: Mon, 15 Mar 2010 18:32:20 +0000
> > > From: Ali Husain <mr_mago40 at hotmail.com>
> > > Subject: Method Executes Fine in Foreground but not in Background
> > > To: SAP WUG <sap-wug at mit.edu>
> > > Message-ID: <BAY130-W1399B515746D4AC2676F908F2E0 at phx.gbl>
> > > Content-Type: text/plain; charset="windows-1252"
> > > 
> > > 
> > > 
> > > Hey Guys,
> > > 
> > > Sorry if i'm asking too many questions but I have a deadline in 2 days which i'm trying to beat so I guess i'll turn to you for help :)
> > > 
> > > I'm facing a weird problem in which i'm calling a method in a background task and this method is calling a program via SUBMIT. The program calls a smartform and collect the data needed to be sent as an e-mail with the smartform as PDF attachment. 
> > > The reason why it's weird is because:
> > > - When i run the method directly via the business object it executes fine and sends the email with no problem
> > > - If i execute the method in foreground it also works fine with no problem
> > > - If I attach the method to a previous task to be executed after the work item is executed it also works fine. However, with this option i had a problem which is for that task i have the confirm completion of the task dialog enabled. So whenever i cancel of the dialog to keep the work item in my inbox, the method gets executed again which i don't want. I want it to be executed only if the user confirms the completion of the dialog.
> > > 
> > > So i decided to use a background task but when it gets executed, it is stuck in process and never completes the workflow. The method is not even executed and the mail is not sent in this case. It worked with all the previous mentioned cases except when i put it as a background which tells me something wrong with the bg job maybe. Other BG jobs are working fine and i checked the SWU3 with no problem. I also tried it in a different client in the same system and same problem happens.
> > > 
> > > The method uses SUBMIT AND RETURN and i'm not binding anything except for the whole business object (tried both dialog is not enabled for the method and also enabled and task in BG). In the program that i'm calling i'm using the following FMs:
> > > 
> > > 
> > > 'SSF_FUNCTION_MODULE_NAME'
> > > 
> > > 
> > > 
> > > v_form_name
> > > (smartform)
> > > 
> > > 
> > > 'CONVERT_OTF'
> > > 
> > > 
> > > 'SO_NEW_DOCUMENT_ATT_SEND_API1'
> > > 
> > > 
> > > 
> > > 
> > > Nothing wrong with the program as it executes fine on its own and also when i execute the method directly via the business object. So What is causing the background job to be stuck?
> > > 
> > > Thanks a lot for the help.
> > > Ali
> > >  		 	   		  
> > > _________________________________________________________________
> > > Hotmail: Trusted email with Microsoft?s powerful SPAM protection.
> > > http://clk.atdmt.com/GBL/go/210850552/direct/01/
> > > -------------- next part --------------
> > > An HTML attachment was scrubbed...
> > > URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20100315/5868d2c2/attachment-0001.htm
> > > 
> > > ------------------------------
> > > 
> > > Message: 2
> > > Date: Mon, 15 Mar 2010 15:01:58 -0400
> > > From: "Dave Weston" <Dave.Weston at clockwork.ca>
> > > Subject: RE: Method Executes Fine in Foreground but not in Background
> > > To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
> > > Message-ID:
> > > 	<2B5DBC67B5DB224690E6C31597BD8C53E040BB at clkex02.clockwork.ca>
> > > Content-Type: text/plain; charset="iso-8859-1"
> > > 
> > > Check transaction ST22 for any ABAP dumps to see if that is the problem.
> > > 
> > > ________________________________
> > > 
> > > From: sap-wug-bounces at mit.edu on behalf of Ali Husain
> > > Sent: Mon 3/15/2010 2:32 PM
> > > To: SAP WUG
> > > Subject: Method Executes Fine in Foreground but not in Background
> > > 
> > > 
> > > 
> > > Hey Guys,
> > > 
> > > Sorry if i'm asking too many questions but I have a deadline in 2 days which i'm trying to beat so I guess i'll turn to you for help :)
> > > 
> > > I'm facing a weird problem in which i'm calling a method in a background task and this method is calling a program via SUBMIT. The program calls a smartform and collect the data needed to be sent as an e-mail with the smartform as PDF attachment. 
> > > The reason why it's weird is because:
> > > - When i run the method directly via the business object it executes fine and sends the email with no problem
> > > - If i execute the method in foreground it also works fine with no problem
> > > - If I attach the method to a previous task to be executed after the work item is executed it also works fine. However, with this option i had a problem which is for that task i have the confirm completion of the task dialog enabled. So whenever i cancel of the dialog to keep the work item in my inbox, the method gets executed again which i don't want. I want it to be executed only if the user confirms the completion of the dialog.
> > > 
> > > So i decided to use a background task but when it gets executed, it is stuck in process and never completes the workflow. The method is not even executed and the mail is not sent in this case. It worked with all the previous mentioned cases except when i put it as a background which tells me something wrong with the bg job maybe. Other BG jobs are working fine and i checked the SWU3 with no problem. I also tried it in a different client in the same system and same problem happens.
> > > 
> > > The method uses SUBMIT AND RETURN and i'm not binding anything except for the whole business object (tried both dialog is not enabled for the method and also enabled and task in BG). In the program that i'm calling i'm using the following FMs:
> > > 'SSF_FUNCTION_MODULE_NAME' 
> > > v_form_name (smartform)
> > > 'CONVERT_OTF'
> > > 'SO_NEW_DOCUMENT_ATT_SEND_API1'
> > > 
> > > Nothing wrong with the program as it executes fine on its own and also when i execute the method directly via the business object. So What is causing the background job to be stuck?
> > > 
> > > Thanks a lot for the help.
> > > Ali
> > > 
> > > 
> > > ________________________________
> > > 
> > > Hotmail: Trusted email with Microsoft's powerful SPAM protection. Sign up now. <http://clk.atdmt.com/GBL/go/210850552/direct/01/>  
> > > -------------- next part --------------
> > > A non-text attachment was scrubbed...
> > > Name: not available
> > > Type: application/ms-tnef
> > > Size: 5261 bytes
> > > Desc: not available
> > > Url : http://mailman.mit.edu/pipermail/sap-wug/attachments/20100315/7e0007f1/attachment-0001.bin
> > > 
> > > ------------------------------
> > > 
> > > Message: 3
> > > Date: Tue, 16 Mar 2010 08:55:07 +1000
> > > From: Rick Bakker <rbakker at gmail.com>
> > > Subject: Re: Workitems being created under different usernames
> > > To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
> > > Message-ID:
> > > 	<7a3a922f1003151555q3f24724er9f7d178804586946 at mail.gmail.com>
> > > Content-Type: text/plain; charset=ISO-8859-1
> > > 
> > > Hi Florin,
> > > 
> > > Thanks for your thoughts!
> > > 
> > > > Solution 1) - Add the missing authorizations
> > > 
> > > It certainly is possible, but quite a pain and not really something
> > > I'd want to do
> > > as a matter of course for every workflow. You'd also have to make sure
> > > that any future
> > > users get the same authorizations, something I don't have much control
> > > over. Making sure
> > > everything is run as WF-BATCH completely circumvents these problems,
> > > as far as I can see.
> > > 
> > > >When using rule resolution, I personally tend to omit additional authorization checks, to avoid these symptoms.
> > > 
> > > I didn't add any additional authorization checks, it's standard SAP.
> > > 
> > > > Solution 2) - Enforce WF-BATCH
> > > 
> > > I'm using WFTS method EMPTY_BACKGROUND which is definitely a
> > > background step and is therefore
> > > always run as WF-BATCH. Best of all, it doesn't involve an actual
> > > wait. Unless someone tells
> > > me otherwise, I'm assuming this is guaranteed to switch control back
> > > to WF-BATCH.
> > > 
> > > >Solution 3) - Recode rule resolution
> > > >Change the rule resolution to avoid authorization checks
> > > 
> > > Not possible in this case. I have to access the object and SAP
> > > determines it has to be via the buffer and that's when I get problems.
> > > 
> > > >Solution 4) - Flag Asynchronous rule resolution
> > > Interesting, I'll try it out.
> > > 
> > > cheers
> > > Rick Bakker
> > > Hanabi Technology
> > > 
> > > 
> > > On Mon, Mar 15, 2010 at 11:23 PM, Florin Wach <florin.wach at gmx.net> wrote:
> > > > Hello Rick,
> > > >
> > > > I have observed the same behaviour: The next work item is created by the previously acting user: The role-resolution is executed (usually synchronously) and the work item is also being created under that user id.
> > > >
> > > > Where the second step (work item creation) is not authority checked, the rule resolution might be, e.g. when reading object attributes such as LFA1 etc.
> > > >
> > > > Solution 1) - Add the missing authorizations
> > > >
> > > > And - believe it or not - we tracked each needed authorization object required to execute the workflow and put that into a role, which is assigned to each involved user.
> > > > When using rule resolution, I personally tend to omit additional authorization checks, to avoid these symptoms.
> > > >
> > > > Solution 2) - Enforce WF-BATCH
> > > >
> > > > If you want to enforce the WF-BATCH-User, you'll need to throw a /real/ background step in between. A wait step will not be sufficient, which is executed by the current user. Deflag the "Dialog" check box, and if it's still a problem, mark the task as asynchronous and send the terminating event within the object method's coding (however, this should not be neccessary).
> > > >
> > > > Solution 3) - Recode rule resolution
> > > >
> > > > Change the rule resolution to avoid authorization checks
> > > >
> > > > Solution 4) - Flag Asynchronous rule resolution
> > > >
> > > > I havend worked with it yet, but under version ECC 6.00 there's a flag at the workflow definition step that the rule is to be executed asynchronously. This created an interal RFC call and the result of the rule is then put back into the workitem, which then will continue. I suspect that the user WF-BATCH is also used for that internal tRFC call.
> > > >
> > > >
> > > > Best wishes,
> > > > Florin
> > > >
> > > >
> > > >
> > > > -------- Original-Nachricht --------
> > > >> Datum: Mon, 15 Mar 2010 21:41:06 +1000
> > > >> Von: Rick Bakker <rbakker at gmail.com>
> > > >> An: "SAP Workflow Users\' Group" <sap-wug at mit.edu>
> > > >> Betreff: Re: Workitems being created under different usernames
> > > >
> > > >> Interesting.... Could there be a config setting which controls this
> > > >> behaviour?
> > > >>
> > > >> On Mon, Mar 15, 2010 at 9:09 PM, JANSSENS Koenraad
> > > >> <Koenraad.JANSSENS at swift.com> wrote:
> > > >> > Binding? ?Config?
> > > >> >
> > > >> >>-----Original Message-----
> > > >> >>From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
> > > >> Of Rick Bakker
> > > >> >>Sent: Monday, March 15, 2010 11:59 AM
> > > >> >>To: SAP Workflow Users' Group
> > > >> >>Subject: Re: Workitems being created under different usernames
> > > >> >>
> > > >> >>Thanks Ramki and Mike, I admit I didn't think of that. But, it doesn't
> > > >> work!
> > > >> >>Workitems are still created by the actual agent of the previous
> > > >> >>workitem, even after SWU_OBUF.
> > > >> >>
> > > >> >>On Mon, Mar 15, 2010 at 8:40 PM, Mike Pokraka
> > > >> >><wug at workflowconnections.com> wrote:
> > > >> >>> Rick,
> > > >> >>>
> > > >> >>> Creating the next work item within the current user's context
> > > >> facilitates
> > > >> >>> advance in dialog. I think switching that off for the step involved
> > > >> should
> > > >> >>> do the job.
> > > >> >>>
> > > >> >>> Cheers,
> > > >> >>> Mike
> > > >> >>>
> > > >> >>>
> > > >> >>> On Mon, March 15, 2010 5:49 am, Rick Bakker wrote:
> > > >> >>>> Dear WUGgers,
> > > >> >>>>
> > > >> >>>> A custom-made workflow was sometimes failing to find an agent for a
> > > >> >>>> Decision step via an AC rule when testing.
> > > >> >>>>
> > > >> >>>> Eventually the cause was tracked down and it became 100%
> > > >> reproducible.
> > > >> >>>> It was only when certain users had executed the previous step, and an
> > > >> >>>> attribute had been changed in the underlying object during the
> > > >> >>>> workflow. It turned out to be an authorization problem.
> > > >> >>>>
> > > >> >>>> I have always viewed workflow logs with concern when I see which
> > > >> >>>> usernames some of the steps or workitems have been created by. They
> > > >> >>>> could be any old agent, usually the actual agent of the preceding
> > > >> >>>> step. But, this was the first time I had seen it cause a problem.
> > > >> >>>>
> > > >> >>>> So what do I do now? Try to find every authorization that could
> > > >> >>>> possibly be needed in every situation with this workflow (and all
> > > >> >>>> other workflows) and request they be given to all possible users, or
> > > >> >>>> do I insert a dummy background step after each dialog step
> > > >> >>>> in order to pass control back to WF-BATCH? I tried the latter. It's
> > > >> >>>> simple, quick, effective and ugly.
> > > >> >>>>
> > > >> >>>> Has anybody else encountered this problem?
> > > >> >>>>
> > > >> >>>> By the way, I tried putting in a 1-minute wait step after the step
> > > >> >>>> where the underlying ?object gets changed, it didn't make any
> > > >> >>>> difference. In any case, there could be other situations ?in which
> > > >> >>>> agents don't have sufficient privileges to do whatever a step needs
> > > >> to
> > > >> >>>> be created properly.
> > > >> >>>>
> > > >> >>>> We're on ECC 6.0.
> > > >> >>>>
> > > >> >>>> regards
> > > >> >>>> Rick Bakker
> > > >> >>>> Hanabi Technology
> > > >> >>>> _______________________________________________
> > > >> >>>> 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
> > > >> >>>
> > > >> >>
> > > >> >>_______________________________________________
> > > >> >>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
> > > >> >
> > > >>
> > > >> _______________________________________________
> > > >> 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
> > > >
> > > 
> > > 
> > > 
> > > ------------------------------
> > > 
> > > Message: 4
> > > Date: Tue, 16 Mar 2010 09:02:14 +1000
> > > From: Rick Bakker <rbakker at gmail.com>
> > > Subject: Re: Method Executes Fine in Foreground but not in Background
> > > To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
> > > Message-ID:
> > > 	<7a3a922f1003151602t503fa666j98ebb1c72e1e8a13 at mail.gmail.com>
> > > Content-Type: text/plain; charset=ISO-8859-1
> > > 
> > > Hello Ali,
> > > 
> > > Try using ST01 (system trace) to see if it shows any problems.
> > > 
> > > I assume it's being run as WF-BATCH? You could try debugging it by
> > > setting an external breakpoint in your method and setting up your user
> > > to debug WF-BATCH's sessions.
> > > 
> > > regards
> > > Rick Bakker
> > > Hanabi Technology
> > > 
> > > 
> > > 
> > > On Tue, Mar 16, 2010 at 5:01 AM, Dave Weston <Dave.Weston at clockwork.ca> wrote:
> > > > Check transaction ST22 for any ABAP dumps to see if that is the problem.
> > > >
> > > > ________________________________
> > > >
> > > > From: sap-wug-bounces at mit.edu on behalf of Ali Husain
> > > > Sent: Mon 3/15/2010 2:32 PM
> > > > To: SAP WUG
> > > > Subject: Method Executes Fine in Foreground but not in Background
> > > >
> > > >
> > > >
> > > > Hey Guys,
> > > >
> > > > Sorry if i'm asking too many questions but I have a deadline in 2 days which i'm trying to beat so I guess i'll turn to you for help :)
> > > >
> > > > I'm facing a weird problem in which i'm calling a method in a background task and this method is calling a program via SUBMIT. The program calls a smartform and collect the data needed to be sent as an e-mail with the smartform as PDF attachment.
> > > > The reason why it's weird is because:
> > > > - When i run the method directly via the business object it executes fine and sends the email with no problem
> > > > - If i execute the method in foreground it also works fine with no problem
> > > > - If I attach the method to a previous task to be executed after the work item is executed it also works fine. However, with this option i had a problem which is for that task i have the confirm completion of the task dialog enabled. So whenever i cancel of the dialog to keep the work item in my inbox, the method gets executed again which i don't want. I want it to be executed only if the user confirms the completion of the dialog.
> > > >
> > > > So i decided to use a background task but when it gets executed, it is stuck in process and never completes the workflow. The method is not even executed and the mail is not sent in this case. It worked with all the previous mentioned cases except when i put it as a background which tells me something wrong with the bg job maybe. Other BG jobs are working fine and i checked the SWU3 with no problem. I also tried it in a different client in the same system and same problem happens.
> > > >
> > > > The method uses SUBMIT AND RETURN and i'm not binding anything except for the whole business object (tried both dialog is not enabled for the method and also enabled and task in BG). In the program that i'm calling i'm using the following FMs:
> > > > 'SSF_FUNCTION_MODULE_NAME'
> > > > v_form_name (smartform)
> > > > 'CONVERT_OTF'
> > > > 'SO_NEW_DOCUMENT_ATT_SEND_API1'
> > > >
> > > > Nothing wrong with the program as it executes fine on its own and also when i execute the method directly via the business object. So What is causing the background job to be stuck?
> > > >
> > > > Thanks a lot for the help.
> > > > Ali
> > > >
> > > >
> > > > ________________________________
> > > >
> > > > Hotmail: Trusted email with Microsoft's powerful SPAM protection. Sign up now. <http://clk.atdmt.com/GBL/go/210850552/direct/01/>
> > > >
> > > > _______________________________________________
> > > > 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
> > > 
> > > 
> > > End of SAP-WUG Digest, Vol 64, Issue 33
> > > ***************************************
> >  		 	   		  
> > _________________________________________________________________
> > Hotmail: Trusted email with powerful SPAM protection.
> > http://clk.atdmt.com/GBL/go/210850553/direct/01/
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20100316/0af5c284/attachment.htm
> > 
> > ------------------------------
> > 
> > _______________________________________________
> > SAP-WUG mailing list
> > SAP-WUG at mit.edu
> > http://mailman.mit.edu/mailman/listinfo/sap-wug
> > 
> > 
> > End of SAP-WUG Digest, Vol 64, Issue 34
> > ***************************************
>  		 	   		  
> _________________________________________________________________
> The New Busy is not the old busy. Search, chat and e-mail from your inbox.
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_3
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20100316/076f8188/attachment.htm
> 
> ------------------------------
> 
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
> 
> 
> End of SAP-WUG Digest, Vol 64, Issue 35
> ***************************************
 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/210850552/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20100316/2b5249b6/attachment.htm


More information about the SAP-WUG mailing list