2007 Sep 17 5:55 AM
hi friends..
i want to run the program in background..
how can i run my program in background ?
can you send me the code plz
2007 Sep 17 6:00 AM
Method 1: in SE38
type your program name
choose Program -> Execute -> Background
Method 2: in SM36
Create a job with your program name
it will run in bg
2007 Sep 17 6:00 AM
hi deva,
If it is report program then you can do that by difining a job for ur prog.
if it is batch method then you can do that by providing options in batch data communication.
<b>Reward points if useful</b>
Cheers,
Chandra
2007 Sep 17 6:01 AM
try with SM37 and SM36
Rewards if useful..................
Minal
2007 Sep 17 6:01 AM
Hi Deva,
Check this thread, it will surely help you.
https://forums.sdn.sap.com/click.jspa?searchID=5273985&messageID=3151612
Thanks,
Reward If Helpful.
2007 Sep 17 6:02 AM
You can directly run the program in back ground go to se38 menu Program->Execute->background. There is another way to run a program in background. using FM job_open, job_submit and job_close.
2007 Sep 17 6:03 AM
This is how to do it through code
data: lv_job_name like tbtco-jobname,
lv_job_nr like tbtco-jobcount,
lv_job_released type c,
lv_job_start_sofort type c,
lv_print_parameters type pri_params.
lv_job_name = 'Z_test'. " your background program name
call function 'JOB_OPEN'
exporting
jobname = lv_job_name
importing
jobcount = lv_job_nr
exceptions
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
others = 4.
if syst-subrc = 0.
*submit job with all the selection screen params...
submit (lv_job_name)
with applfile = applfile
with p_lines = p_lines
with rfc_dest = rfcdest
with p_selmtd = lv_selmtd
with px_shsim = px_shsim
with px_sherr = px_sherr
user syst-uname
via job lv_job_name number lv_job_nr and return.
if sy-subrc = 0.
call function 'JOB_CLOSE'
exporting
jobcount = lv_job_nr
jobname = lv_job_name
strtimmed = 'X'
importing
job_was_released = lv_job_released
exceptions
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
others = 8.
if syst-subrc <> 0.
message i162(00) with
'An error occured while closing the background job.'.
stop.
endif.
endif.
endif.
skip 1.
write: / 'Background process', lv_job_name ,
'called successfully' no-gap.
write: / 'You can check the job in transaction SM37'.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |