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: 

File is sometime not created in AL11 for a background job

Former Member
0 Kudos
5,358

Hi Expert,

I made a custom program and at the end of the program, I am writing the log in AL11 in text format.

   OPEN DATASET p_ofile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.


   LOOP AT it_error_list INTO wa_error_list.

     l_out_data = wa_error_list.

     TRANSFER l_out_data TO p_ofile.

   ENDLOOP.

   CLOSE DATASET p_ofile.

This is simple, but sometime there is no file created in the AL11.

I do direct executed for the backgorund job.

Have someone ever faced this problem?

Regards,

Robert

14 REPLIES 14

PeterJonker
Active Contributor
0 Kudos
1,138

add some error handling and create an error file when errors occurred and then place this on the AL11 directory. At least you will now that an error has occurred.

matt
Active Contributor
0 Kudos
1,138

Capture the message (if any) from OPEN DATASET (addition MESSAGE - read the abap documentation for the syntax). Check the sy-subrc after OPEN DATASET. If it is non-zero, report that in some way, with the message.

You should also check sy-subrc after TRANSFER and CLOSE, and report any non-zero return codes.

If, when you run the program, all the sy-subrc are 0, then the problem is not with your program. Perhaps the directory is full, or your file is being overwritten by another process.

Former Member
0 Kudos
1,138

Maybe the job user hasn't authorizations to the path of variable p_ofile.

You can use this function  "AUTHORITY_CHECK_DATASET" in your source code to identify the issue.

If SAP server is allocated in an operative system like LINUX or UNIX there are more authorizations

arindam_m
Active Contributor
0 Kudos
1,138

Hi,

Check if the file path location exists that is the folder directory exists and that the user with which the program s being executed has authorizations to create the file. Also check all the SY-SUBRC values after OPEN, TRANSFER and CLOSE operations.

Cheers,

Arindam

Former Member
0 Kudos
1,138

Hi

can you reproduce the case where there is no file exported (like: only at 1AM in the morning, or when the are no errors to report...)

Let us know

a

Former Member
0 Kudos
1,138

All good suggestions so far.  All I can add is to check your server architecture, if your instance has batch processes running on multiple application servers the file could be getting written to different places for each batch run.

Point of terminology: AL11 is a transaction for viewing files on the operating system, not a place to write files to.

Regards,

Nick

0 Kudos
1,138

Hi Nick,

Yes, there are 2 server running for production.

how can I check the server structure?

what should I do to check that?

Regards,

Robert

matt
Active Contributor
0 Kudos
1,138

Ask your basis team. On most systems I've worked on there is on the file structure set up to cover all application servers.

Former Member
0 Kudos
1,138

Hi All,

I have tried to debug, but when I debug, the file is always created.

I don't check the sy-subrc everytime, because there is more transfer above that code.

The strange thing was I tried to run it several times, sometime the file is created and sometime the file is not created.

I checked in the development, the file is always created. (the first check is on Production)

is it possible that the cause is the system?

Regards,

Robert

0 Kudos
1,138

Roberto says:  "I don't check the sy-subrc everytime"

And that is where you go wrong

matt
Active Contributor
0 Kudos
1,138

Return code? I don't need to check the ret... kzzz..s.....

---out-of-cheese-error---

---redo-from -start---

Former Member
0 Kudos
1,138

Hello,

After suffering a lot with this issue, we discovered that this random behaviour is due to the different server configurations, while scheduling the job in sm36, you can specify the ex. server, so try with the different options and see which one is working for you.

Then inform to your Basis team to investigate further.

At least you will be sure that the files are created always by forcing the correct server.

Enjoy!

0 Kudos
1,103

Hi ,Iam also facing the issue.File is not created through background job in cqd but when I debug the background job file is creating.Not able to find the reason behind this.Can you suggest me the idea to proceed with this issue 

0 Kudos
424

Your system has more than one application server. When you run the process in debug mode, the system generates the file on the same app server, and you can see it in AL11. But, in the background, it's dynamic. 

To check the file, open TCODE SM51, go to each app server, and check AL11. You will find the file in AL11 on one of the app servers.