Application Development 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: 

Problem in file reading from AL11

himanshu_gupta2
Participant
0 Kudos

We are facing a problem in which sometime background jobs read the file from al11 and sometimes it says file not found.

Steps we are doing

1) reading .xls file from foreground job

2) right to AL11 in .xls format

3) submit program in background mode

4) read the file from AL11 . here sometimes file read from al11 and sometimes it throw message file not found. but if we check after few seconds or run the background job again using JDBG , it work perfectly..

Anyone face this kind of problem

My assumption is .xls format take few second more and submit program run before file actually created at AL11.

8 REPLIES 8

Sandra_Rossi
Active Contributor
0 Kudos

When I face this symptom, the most frequent cause is a wrong configuration of "file system" if your SAP system has several application servers. So, il you're in that case (SM51 to see if there are several app servers, SM37 to see in which app server your job has started), ask your admins. You may make sure of the problem by submitting your program to the same app server than the one of the failed job.

0 Kudos

we have only 1 application server .

I also checked the code. Submit program is called after Close dataset.

its very strange that sometimes file is created before program starts but sometimes not. but if we check even after 1-2 seconds .. it got created..

it seems .xls might taking more time but not sure about that.

0 Kudos

Then it must be something wrong

  • either in the logic (concurrent users writing to the same file? or there's maybe an issue if you used SAP lock objects and didn't release a lock in dialog mode? etc.),
  • or a problem with file system (did you search SAP notes? ask admins to search the web for reasons at OS/file system level)

0 Kudos

File is written for the first time so no concurrent users .

I still not found any problem with file system because few jobs are still running perfectly.

Former Member
0 Kudos

This is a normal behavior that happens when a file is written to a application server.

Better apply a "WAIT" in a loop and keep on checking for a file existence( for about 5 secs).

That should work.

Jelena
Active Contributor
0 Kudos

You might want to use the standard SAP terminology, there is no such thing as "foreground job". Also it's not clear how all this is occurring exactly - is this all part of the same ABAP report or separate transactions?

Overall what you perceive as "file not found" actually means "file cannot be opened". This could happen for a variety of reasons. One is already mentioned by Sandra (different servers), the other popular one is file being locked by another process.

As Saransh mentioned, you could try adding a pause. Or you could build in a "re-try" process or even change the design altogether. Such issues have been mentioned on SCN many times and old posts can be found in Google. This is not a unique situation.

0 Kudos

Thank Jelena for the reply.

As stated in the problem ,

1) Reading excel from presentation server from custom transaction

2) upload to AL11 in

3) submit the program in background mode from same custom transaction

4) background program read the data from AL11

Desgin change is not an option as it take lots of days to solve.

but for the time being to solve my problem i take your suggest to have retry process for max 5 seconds.

Sandra_Rossi
Active Contributor
0 Kudos

As I said previously, either it's a standard bug (cf SAP notes), or you have a problem in your program. Did you search SAP notes? In your initial program, are you sure you did not open several times? Did you use OPEN DATASET with FILTER? Did you correctly handle the exceptions after CLOSE DATASET? Etc. Same questions for the read program, and also in the OPEN DATASET, you may get the exact error message from the OS using addition MESSAGE.

The SAP note 27 (Recommendations for the ABAP file interface) could help you solve the issue -> https://service.sap.com/sap/support/notes/27

PS: of course, you could add a WAIT, but I never saw this in standard programs, and I'd like to have an official reference text which justifies that a wait is to be done always!