‎2007 Dec 26 6:00 AM
Hi Friends,
I have developed a report program.
I have also created a transaction code for executing it.
Now the user needs to execute this program as a background job.
I have tried with SM36 and SM37 transactions. Here, you need to set the variants and time for execution.
But the user has lots of selection criteria and setting the variants for this requirement is highly impossible.
Kindly let me know whether I can add any additional statements in the program so that the program executes as a background process when initiated th' the selection screen / transaction code.
Kindly provide your suggestions.
Thanks in advance.
‎2007 Dec 26 9:57 AM
hi karthik
PARAMETER : p_cmode LIKE ctu_params-dismode DEFAULT 'N'.
CALL TRANSACTION tcode USING bdcdata
MODE p_cmode
UPDATE 'L'
MESSAGES INTO messtab.
use this 1
its help u .
kk.
Edited by: kuamr kk on Dec 26, 2007 10:57 AM
‎2007 Dec 26 9:26 AM
Hi Friends,
Please help me with your suggestions. I need to satisfy this requirement as it is of high priority.
Thanks in advance.
Edited by: karthik raja spic on Dec 26, 2007 3:07 PM
Edited by: karthik raja spic on Dec 26, 2007 3:08 PM
‎2007 Dec 26 9:38 AM
Hi
Please check FMs RSVARIANT they can be used to create variants dynamically. - RS_CREATE_VARIANT, RS_VARIANT_CONTENTS etc
Check FMs JOB_OPEN, JOB_SUBMIT, JOB_CLOSE
Hope these will help you arrive at a solution
Regards,
Arun
‎2007 Dec 26 9:57 AM
hi karthik
PARAMETER : p_cmode LIKE ctu_params-dismode DEFAULT 'N'.
CALL TRANSACTION tcode USING bdcdata
MODE p_cmode
UPDATE 'L'
MESSAGES INTO messtab.
use this 1
its help u .
kk.
Edited by: kuamr kk on Dec 26, 2007 10:57 AM
‎2007 Dec 26 12:00 PM
try to set SYST-BINPT ='X' which will force program to be run in background only.
anya
‎2007 Dec 26 12:05 PM
Try the FMs BP_JOB_CREATE.
Read the other FMs like BP_JOB_*.
Regards,
Ravi
‎2007 Dec 26 1:37 PM
Hi Karthik,
Looks like a wrapper ABAP program is required to meet your requirement. This program can be called in the background and in turn can submit the report program that you have created to achieve the actual functionality.
In this wrapper program, you need to create a dynamic variant using FMs (search RSVARIANT in SE37). Here you can populate the fields of the selection screen based on any complex criteria as you mentioned using ABAP statements. The dynamic variant is similar to the variants created on the selection screen.
Once you have the variant (dynamic) ready you can create a background job and submit it within this wrapper program, for which you again have to use the FMs (search createjob*, and go to the function group).
You have to release the submitted job and you can get the status of the job while it is running using the standard FMs provided for this.
Finally, you can create a spool list for the wrapper program that can detail the status of the submitted job.
It is a good idea to delete the dynamic variant once it ahs been used because if required again, it can be created again. If the dynamic variant is created daily or several times a day, it is definitely good to delete it after the use. The right place to do deletion is at the end of the wrapper program after confirming that the job submitted has completed. Or as an alternate strategy, all variants prior to a week can be deleted when the wrapper program runs today (we are using this strategy).
I have used this successfully.
Hope this helps.
Thanks
Sanjeev
‎2007 Dec 30 2:04 PM
Hi Friends,
Thanks for all your ideas. All your ideas worked well.
Also, there is one more way for solving this problem.
Give the input for selection screen.
Press F9.
Press Immediate tab.
Mark Immediate execution check box.
Press Check and Save buttons.
Again you will come to the selection screen.
Press F8 now.
The process executes in background and there is no need to set up a periodic job.
But all your answers were very helpful
Thank you all once again.