10-12-2007 4:05 AM
Hi,everyone!
I got a very easy problem when I want to run a program in background.
I wrote a program in SE38.We should enter some data to screen fields.And this program can select data from database and download these data into a local file, and give us a report.
I want to know how to execute this program in background,and how to see the results,file and report.
Because I'm a beginner , please give me some ideas or some materials, more detailed the better.
10-12-2007 4:07 AM
Hi,
SAP doesnt provide the feature to download file on presentation server in background i.e. using GUI_DOWNLOAD.
You have to download on application server using OPEN DATASET.
Best regards,
Prashant
10-12-2007 4:07 AM
Hi,
SAP doesnt provide the feature to download file on presentation server in background i.e. using GUI_DOWNLOAD.
You have to download on application server using OPEN DATASET.
Best regards,
Prashant
10-12-2007 4:07 AM
Hi,
1. Running report inbackground - Either through SM37 or directly using SE38- > Program -> Execute-> background.
2 If you are downloading file on presentation server then you can't run the progam in background
Regards,
Atish
10-12-2007 4:09 AM
Some links
background jobs
http://help.sap.com/saphelp_nw04/helpdata/en/ef/2c513897110872e10000009b38f889/content.htm
File downloads
http://help.sap.com/saphelp_nw04/helpdata/en/79/c554a3b3dc11d5993800508b6b8b11/content.htm
Regards,
Atish
10-12-2007 5:59 AM
Hi Feng,
First of all it is very starnge but SAP does not allow the combination of running a report n the background and saving it on the Presentation server.
Hence,whatever report has to run n the background,it has to be saved on the Application Server for which you will have to use the keywords:
Open Dataset.
Transfer.
Close Dataset.
To view the file stored,go to T-code AL11 and find the pathname.
In order to save this particular file on the Presentation server,you can use the T-code CG3Y and give the file name.
Also, instaed of coding for the schedulng the report in the background,you can also schedule it manually in SM37.
In case you have any further clarifications,do let me know.
Regards,
Puneet Jhari.
10-12-2007 6:07 AM
Hi
<b>This is how to do it through code</b>
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'.
<b>by useing T-codes</b>
First go to transaction SM36 to schedule the job.
When you enter the "Start condition" for job, do as follow.
- Select processing by "Date/Time".
Enter date as current date.
Let us say you are scheduling this job today then give date 08/30/2007.
- Check "periodic job" checkbox.
- Hit "periodic value" button and select to run "Daily"
<b>Reward if usefull</b>
10-12-2007 8:31 AM
Thanks , experts.
I have tried , and I will give my method in below. Am I right ?
1. At SE38 , I input my program's name ZTEST.
2. PROGRAM > EXECUTE>BACKGROUND
3. At Execute Report in Background , press 'Variants', then selection screen appears, I entered data into screen fields, and saved.
4. Return to Execute Report in Background, press Execute immd..
5. Then go to SM37, input my program's name, and press Execute. Then I can get the status.
I think it's right. But I don't know how to get the report.
Can you tell me ?
10-12-2007 9:09 AM
Hi,
The steps you have mentioned are correct.
Once the background job is completed, the status would be changed to COMPLETED in SM37.
Select the check box & click on DISPLAY SPOOL or DISPLAY ICON.
You will get a list. Again click on Display.
Final output would be displayed.
Best regards,
Prashant
10-12-2007 9:45 AM
Thanks very much , Prashant Patil .
I found the report.
And can you tell me the difference between these two methods?