Skip to Content
0
Former Member
Apr 24, 2007 at 02:51 PM

Write File to Server

53 Views

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.