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

Write File to Server

Former Member
0 Likes
549

Hello All,

I'm trying to write a file to a server.

When I specify the path as a drive on the application server('E:\usr\sap\trans\ftp\QUERIES\test.TXT'), it writes the file ok.

When I specify another server(
testserver\share\test.txt), it doe not write. The message i get is "No such file or directory"

The basis guys mapped a drive on the application server to the drive letter S(with a domain username and password) to the other server. I then tried "S:\test.txt" but still it does not write.

Does anybody have an idea of why I can't write to the other server, or how I can write to the other server?

I'm on a 4.7 system and here is the code i'm using:


DATA:
*   lv_file(255)   TYPE c VALUE 'E:usrsaptransftpQUERIEStest.txt',  "works
*   lv_file(255)   TYPE c VALUE '\testserversharetest.txt'  "does not work
      lv_file(255)   TYPE c VALUE 'S:test.txt',                     "does not work
      lv_line        TYPE string,
      lv_msg(60) TYPE c.


** open the file
OPEN DATASET lv_file  IN TEXT MODE ENCODING DEFAULT FOR OUTPUT MESSAGE lv_msg.

IF sy-subrc <> 0.
  MESSAGE e000(zz) WITH lv_msg.
ENDIF.

lv_line = 'This is a test'.

TRANSFER lv_line TO lv_file.

** close file
CLOSE DATASET lv_file .
IF sy-subrc <> 0.
  MESSAGE i000(zz) WITH 'Error closing file ' lv_file .
ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
465

hi

u specify that these (
testserver\share\test.txt) is not working bcz we cannot give the server name just like that u specify the ip address of the application server for which u want to write the file.e.g(
100.100.2.10\share\..) .

try this one it would be helpful.

2 REPLIES 2
Read only

Former Member
0 Likes
466

hi

u specify that these (
testserver\share\test.txt) is not working bcz we cannot give the server name just like that u specify the ip address of the application server for which u want to write the file.e.g(
100.100.2.10\share\..) .

try this one it would be helpful.

Read only

0 Likes
465

Hi Tamilarasan,

I tried using the ip, but I get the message "Invalid Argument". I pinged the IP via t-code SM49 and got a response, so I don't know what the invalid argument is.