Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Debugging an background Job

Former Member
0 Likes
1,182

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 .

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,014

Ok, first, you do realize that you can not upload from the PC/desktop in the background, right. So you are seeing this problem when uploading from application server. Does it work when uploading from application server in the foreground?

Regard,

Rich Heilman

10 REPLIES 10
Read only

Former Member
0 Likes
1,014

Hi,

refer this thread:

rgds,

latheesh

Message was edited by: Latheesh Kaduthara

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,015

Ok, first, you do realize that you can not upload from the PC/desktop in the background, right. So you are seeing this problem when uploading from application server. Does it work when uploading from application server in the foreground?

Regard,

Rich Heilman

Read only

0 Likes
1,014

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

Read only

0 Likes
1,014

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.

Read only

0 Likes
1,014

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

Read only

0 Likes
1,014

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.

Read only

Former Member
0 Likes
1,014

Looks like you are trying to uplaod a presentation server file in background, which is not possible.

Regards,

ravi

Read only

0 Likes
1,014

enter tcode jdbg in the command box and then continue.

Thanks,

Read only

Former Member
0 Likes
1,014

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!!

Read only

0 Likes
1,014

Hi All,

Thank you all for your immediate and prompt replies.

Thanks and Regards,

Varun.