Skip to Content

OPEN DATASET write to root folder

Nov 22, 2017 at 10:45 AM


avatar image

Hi Exprets,

I would like to store data in application server in the following directory.

the directory ( lets say folder name is "Folder1" is created under 'root' node in AL11. Now how do i write my OPEN dataset statemnet

what should lv_file shoud have?

OPEN DATESET lv_file .....

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
Jörgen Lindqvist Nov 22, 2017 at 11:37 AM

The OPEN DATASET command expects a real physical file name, and the format depends on the operating system of the current app server. For instance on a LINUX os this mig be '/Folder1/filename' if that folder is placed directly in the root.

If the path is identical across all application servers and the system landscape, you don't need the root node in AL11 for this, but of course you can use Logical file names as well. (Then use transactions AL11, FILE, SF01 and then use function module FILE_GET_NAME to get the actual file name to use in you call to OPEN DATASET).

Show 4 Share
10 |10000 characters needed characters left characters exceeded


thanks for the reply. I have tried below as path and it works fine


I want to place the file po.xml in "home" directory under root node. I tried '/home/po.xml' but it is dumping.. I have attached the screen shots of AL11. please suggest.


home.png (28.2 kB)
root.png (7.7 kB)

Then this is most likely an autorization issue on the OS level. The <sid>adm user probably does not have write access in the /home/ directory. If there is where the files should be placed, the system administrator of the server need to grant access for that user to the /home directory.


Ok. so you think there is nothing wrong in the way I am providing the file name /home/po.xml. Is there anyway I can check in SAP that authorisation is failing


Yes, its in the documentation provided by Suhas Saha as well... This will give you the error message:

data lv_message type string.
open dataset '/home/po.xml' for output in text mode encoding default message lv_message.
cl_demo_output=>display( lv_message ). 
Suhas Saha
Nov 22, 2017 at 02:20 PM

Everything you want to know is listed in the ABAP(F1) Documentation.

10 |10000 characters needed characters left characters exceeded
Horst Keller
Nov 23, 2017 at 12:12 PM
10 |10000 characters needed characters left characters exceeded
Mohammad Waseem Nov 22, 2017 at 11:34 AM

if you want to write data in AL11 then:

OPEN DATASET lv_file for OUTPUT in <mode>.

Just write open dataset in ABAP editor and click F1 on OPEN, you will get all the required details.

Let me know if you still stuck

LV_file should be of LOCALFILE type and should have the full path like '/usr/local/bin/test.txt'

10 |10000 characters needed characters left characters exceeded
Raymond Giuseppi
Nov 23, 2017 at 10:35 AM

To insure correct behavior of your program you should first check authorization at SAP level

           ACTIVITY             = 'WRITE'
           FILENAME             = filename
           NO_AUTHORITY         = 1      
           OTHERS               = 4. 

But, of course, you should also CATCH handleable exceptions like CX_SY_FILE_AUTHORITY (list can be found with F1 or online help) for error raised by actual server.

Also most Admins I know, wont allow you to put your data in root folder, bad practice indeed?

10 |10000 characters needed characters left characters exceeded