‎2005 Nov 09 6:37 PM
Hi,
I'm running an ABAP report in which I call a function module in several different tasks. This function module is eventually submitting RSNAST00 for generating the outputs. I want to capture the messages for the log like they appear in the job log if RSNAST00 is scheduled in the background job using SM36.
Since I'm using SUBMIT and RETURN, it runs in a new internal session. Also I do not get back anything in the EXPORTING LIST TO MEMORY.
Is there any way to capture the system messages that have been generated during that RSNAST00 run.
Thanks in anticipation,
Satya
‎2005 Nov 09 6:46 PM
Do you need these messages right away, or do you really want to see them in a job log like in SM37. Reason why I ask, is you can create a background job on the fly and submit it, then the error jog would be visible from SM37. So do you need the error log coming back to you at runtime?
Example for submitting job in background.
report zrich_0001 .
data: l_valid,
ls_params like pri_params,
l_jobcount like tbtcjob-jobcount,
l_jobname like tbtcjob-jobname.
start-of-selection.
* Get Print Parameters
call function 'GET_PRINT_PARAMETERS'
exporting
no_dialog = 'X'
importing
valid = l_valid
out_parameters = ls_params.
* Open Job
l_jobname = 'RSNAST00'.
call function 'JOB_OPEN'
exporting
jobname = l_jobname
importing
jobcount = l_jobcount.
* Submit report to job
submit RSNAST00
via job l_jobname
number l_jobcount
to sap-spool without spool dynpro
spool parameters ls_params
and return.
* Schedule and close job.
call function 'JOB_CLOSE'
exporting
jobcount = l_jobcount
jobname = l_jobname
strtimmed = 'X'.
Regards,
Rich Heilman
‎2005 Nov 09 6:40 PM
‎2005 Nov 09 6:54 PM
Hi,
The problem is the my Z program says 100 records. split in 5 sessions of 20 each.
I call a 'Z' function module starting in new task
within that i say SUBMIT RSNAST00 with ...
....
and return.
I dont have the job number here.
There are some problems when you try to use the FM JOB_OPEN, JOB_SUBMIT AND JOB_CLOSE in a BACKGROUND PROCESS.
Is there a way I can get the job number during SUBMIT
Thanks
Satya
‎2005 Nov 09 6:46 PM
Do you need these messages right away, or do you really want to see them in a job log like in SM37. Reason why I ask, is you can create a background job on the fly and submit it, then the error jog would be visible from SM37. So do you need the error log coming back to you at runtime?
Example for submitting job in background.
report zrich_0001 .
data: l_valid,
ls_params like pri_params,
l_jobcount like tbtcjob-jobcount,
l_jobname like tbtcjob-jobname.
start-of-selection.
* Get Print Parameters
call function 'GET_PRINT_PARAMETERS'
exporting
no_dialog = 'X'
importing
valid = l_valid
out_parameters = ls_params.
* Open Job
l_jobname = 'RSNAST00'.
call function 'JOB_OPEN'
exporting
jobname = l_jobname
importing
jobcount = l_jobcount.
* Submit report to job
submit RSNAST00
via job l_jobname
number l_jobcount
to sap-spool without spool dynpro
spool parameters ls_params
and return.
* Schedule and close job.
call function 'JOB_CLOSE'
exporting
jobcount = l_jobcount
jobname = l_jobname
strtimmed = 'X'.
Regards,
Rich Heilman
‎2005 Nov 09 6:54 PM
‎2005 Nov 09 7:00 PM
In order to have a job number it must be scheduled to run in a batch job either thru SM36 or on the fly with the code above.
Let me try to get a handle on your problem.
You have a "Z" program which uses paraellel processing and in that call to the function module, it submits the "NAST" program and you need to get the output of the NAST program and bring it back to the "Z" program?
Regards,
Rich HEilman
‎2005 Nov 09 7:05 PM
Hi,
The main program ZRSNAST00 is running in a background job.
it then calls Z_PROCESS_RSNAST00 function module in 5 different tasks
within the Z_PROCESS_RSNAST00 function module RSNAST00 is to be submitted.
My question is that since its already into a background session which is using a batch job and that job is not yet closed. Will the JOB_OPEN function module not fail in certain or all cases?
Rich, if you can help me on this.
Thanks and regards,
Satya
‎2005 Nov 09 7:14 PM
‎2005 Nov 09 7:23 PM
Ok, I submitted this program in background, it creates 4 more jobs calling my test program ZRICH_0005. In that program, I am just issuing a message.
No problems.
report zrich_0001 .
data: l_valid,
ls_params like pri_params,
l_jobcount like tbtcjob-jobcount,
l_jobname like tbtcjob-jobname.
parameters: p_check.
start-of-selection.
do 4 times.
* Get Print Parameters
call function 'GET_PRINT_PARAMETERS'
exporting
no_dialog = 'X'
importing
valid = l_valid
out_parameters = ls_params.
* Open Job
clear l_jobname.
l_jobname = sy-index.
shift l_jobname left deleting leading space.
concatenate 'ZRICH_0005' l_jobname into l_jobname.
call function 'JOB_OPEN'
exporting
jobname = l_jobname
importing
jobcount = l_jobcount.
* Submit report to job
submit zrich_0005
via job l_jobname
number l_jobcount
to sap-spool without spool dynpro
spool parameters ls_params
and return.
* Schedule and close job.
call function 'JOB_CLOSE'
exporting
jobcount = l_jobcount
jobname = l_jobname
strtimmed = 'X'.
enddo.
Regards,
Rich Heilman