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: 

Write file in OS/400 library

Former Member
0 Kudos

Hi everybody

I am requested to save data from ABAP to a flat file in a <b>library</b> in OS/400. The name of the library is LEISAP. Searching around, I found out that I can access it using the path /QSYS.LIB/LEISAP.LIB/ and it already has some files. I am able to read the files in this library (for example the file MPSHR01606) using OPEN DATASET FOR INPUT with a filename like /QSYS.LIB/LEISAP.LIB/MPSHR01606.FILE/MPSHR01606.MBR.

But I can not figure out how to create a new file. What I am trying to do is:

OPEN DATASET file

FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

where file has the value '/QSYS.LIB/LEISAP.LIB/TEST.FILE/TEST.MBR', but it fails with sy-subrc = 8.

Any idea if it is possible to create a file in a libary in OS/400 from ABAP at all and how?

Thank you

Andreas

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Does it have to be in a library? Is this AS/400 running your SAP instance? If so, usually it is a good idea to right to the application server under /usr folder. This is under the IFS of the as/400.

Regards,

Rich Heilman

7 REPLIES 7

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Does it have to be in a library? Is this AS/400 running your SAP instance? If so, usually it is a good idea to right to the application server under /usr folder. This is under the IFS of the as/400.

Regards,

Rich Heilman

0 Kudos

If it's not possible, I will have to suggest to save the file somewhere else. But I would like to find out if it's possible to save it in the library or if there any valid reasons (security, whatever) not to do so before throwing in the towel...

Andreas

0 Kudos

Oh, btw: yes, it's the AS/400 running my SAP instance.

0 Kudos

My company is running the same, we store all files on the application server in the /usr folder of the IFS.

REgards,

Rich Heilman

Former Member
0 Kudos

Hi

Just to update the status: I was able to create file members with OPEN DATASET inside files that already exist. So all I am missing is how to create the files in the library.

Andreas

0 Kudos

It passed quite some time since my question and I had lost track of the thread, but here is the status:

There is no native way to create the file in the library from ABAP, the only way seems to be by using native OS/400 commands. This can be executed from ABAP too using CALL 'SYSTEM', but in our case we decided to create the files at the OS level so they can be accessed from SAP like any other regular file.

0 Kudos

Hi Andreas,

Check your aurhorization for creation of new file. You might not have proper access to create a new file.