‎2006 Jun 21 3:25 PM
Hi All,
I have a report program which updates material master tales from file on application server or from desktop . This program works fine when run in foreground but when scheduled as an background job this gives n me error . I am posting the stauses messages .
<b>
Job log overview for job: ZFINIR3002 / 12200601
Date Time Message text Message class Message no. Message type
06/21/2006 12:20:11 Job started 00 516 S
06/21/2006 12:20:11 Step 001 started (program ZFINIR3002, variant &0000000000077, user name VARUN) 00 550 S
06/21/2006 12:20:14 Input file does not exist ZFIN 55 E
06/21/2006 12:20:14 Job cancelled after system exception ERROR_MESSAGE 00 564 A
</b>
Can anyon advise me on this ?
Regards,
Varun .
‎2006 Jun 21 3:28 PM
‎2006 Jun 21 3:28 PM
‎2006 Jun 21 3:28 PM
‎2006 Jun 21 3:31 PM
To debug in background, put an endless loop in your program.
while sy-subrc = 0.
check sy-subrc = 0.
endwhile.Run your program, go to Sm50, find your program running in a background task, select it, then from the menu, click program/session, then program, then debugging. Once you are in the debugger, the program will probably be on that endless loop. Change the value of sy-subrc to 1 and continue stepping thru the program.
Regards,
Rich Heilman
‎2006 Jun 21 3:38 PM
Hi Rich,
I am uploading data from PC file into internal table .This internal table data is used to update material master data uisng a BAPI .<b>I am not aware of this thing that we cannot upload from PC/Desktop in background . Is it true ?</b> When I run th program using PC file in foreground it is working fine .
Regards,
Varun.
‎2006 Jun 21 3:48 PM
You CAN NOT upload from PC in a background task. How will the background task know where to get the file, it has no idea about the machines connected to the frontend. This is the reason for the failure. You must upload from the application server using OPEN DATASET and READ DATASET.
Here is a simple example.
report zrich_0001.
Parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.txt'.
data: itab type table of string.
data: wa type string.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
append wa to itab.
enddo.
endif.
close dataset d1.Regards,
Rich Heilman
‎2006 Jun 21 3:48 PM
You cannot upload files from your desktop when you are running in the background and yes it is true.
You have to move the file to application server and use the constructs OPEN DATASET, READ DATASET, CLOSE DATASET.
When you run a program in the background, the processing is done on the application server side where there will be some processes dedicated for background jobs. That is the reason why it will not be able to read from desktop as the contact with the desktop is gone.
‎2006 Jun 21 3:29 PM
Looks like you are trying to uplaod a presentation server file in background, which is not possible.
Regards,
ravi
‎2006 Jun 21 3:33 PM
enter tcode jdbg in the command box and then continue.
Thanks,
‎2006 Jun 21 3:49 PM
Hi Varun,
You can run program in background only if the input file is on application server while in foreground, there is no such limitation.
You can place a check before material master update that if the program is run in background ( sy-batch = 'X' ) then upload the file to application server from desktop and open input file from there.
There a no. of ways to debug the background job as mentioned in above posts. 1 more way is to go to SM50 Txn and find your background job of Type 'BGD'. Check that process and go to Program/Session ->Program -> Debugging.
Cheers,
Vikram
Pls reward for helpful replies!!
‎2006 Jun 21 3:57 PM
Hi All,
Thank you all for your immediate and prompt replies.
Thanks and Regards,
Varun.