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

Creating file with dat extension

Former Member
0 Likes
1,465

Hi experts,

I request a path on my selection-screen: p_file

Then I try to create the file.

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

tmp_text = 'Header'.

TRANSFER tmp_text TO p_file.

.....

CLOSE DATASET p_file.

In debug mode I see that OPEN DATASET statement has a sy-subrc 0 which means it can create the file. But I cannot see it in that directory which I set in p_file.

What did I wrong?

Hi experts,

I request a path on my selection-screen: p_file

Then I try to create the file.

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

tmp_text = 'Header'.

TRANSFER tmp_text TO p_file.

.....

CLOSE DATASET p_file.

In debug mode I see that OPEN DATASET statement has a sy-subrc 0 which means it can create the file. But I cannot see it in that directory which I set in p_file.

What did I wrong?

5 REPLIES 5
Read only

Former Member
0 Likes
1,385

Please check in AL11 tcode with your path ./ (in the directory parameter)

There you can get your file.

Edited by: Tirumula Rao Chinni on Mar 9, 2010 4:01 PM

Read only

0 Likes
1,385

Tirumula I set my desktop as the directory, but I cannot see it anywhere, even if I had write authorization to my desktop.

Could I create a file on my desktop with OPEN dataset?

Edited by: mrwhite on Mar 9, 2010 11:45 AM

Read only

0 Likes
1,385

Hi,

To be able to save a file to your own PC you should FM 'GUI_DOWNLOAD'. Open dataset will generally create the files on the SAP server generally the Unix box in which it is based on.

Hope it helps.

Thanks

Mani

Read only

0 Likes
1,385

Thanks, I was thinking about it. Yes I can use GUI_DOWNLOAD instead of OPEN dataset. I just wonder why don't the system gives me a dump?

Read only

0 Likes
1,385

I am glad you asked that question.

Go to the root directory of your SAP instance's unix directory. There you will see this file created. The File name will be your full pathname+file name. For example it will C:\docandsettings\username\desktop\filename.dat.

Thanks

Mani