Method Executes Fine in Foreground but not in Background

aditya rao aadityarao84 at gmail.com
Tue Mar 16 00:49:08 EDT 2010


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.htm


More information about the SAP-WUG mailing list