2010 Jun 23 3:41 PM
Hello
I am using the fm GUI_DOWNLOAD to create a file and i want to write it on the sap server.How can this be done?We have an sap server which is running on linux and i've tried to write in one of the directories on the server,but instead it created that whole directory structure on my harddrive and not on the server
i gave the path something like this : /home/......
I also tried to write on an remote server which is accessible through internet explorer but when trying to write it with the bapi i get access denied.
Or maybe if you have any other solutions.
Thank you
Now i am using it like this:
data: gv_string type string.
OPEN DATASET P-FILE FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE MESSAGE GV_MSG.
IF SY-SUBRC NE 0.
WRITE: / 'File cannot be opened.Reason: ', GV_MSG.
ELSE.
LOOP AT itab INTO wa.
CONCATENATE wa-field1 wa-field2 INTO GV_STRING SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
TRANSFER GV_STRING TO P-FILE.
ENDLOOP.
CLOSE DATASET P-FILE.
and it solved moy problem.Thank you
2010 Jun 23 4:15 PM
I have found a very simple way to write to sap server, on linux of course:
PARAMETERS: P-FILE(50) TYPE C DEFAULT '/home/ftpwe/masterdata/cust_enhc.txt' LOWER CASE.
data: gv_msg(100) type c.
......
fill gt_datatab with information
.......
OPEN DATASET P-FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT MESSAGE GV_MSG.
IF SY-SUBRC NE 0.
WRITE: / 'File cannot be opened.Reason: ', GV_MSG.
ELSE.
LOOP AT GT_DATATAB INTO GS_DATATAB.
TRANSFER GS_DATATAB TO P-FILE.
ENDLOOP.
CLOSE DATASET P-FILE.
ENDIF.
2010 Jun 24 1:41 PM
Now i have managed to write the file on the sap server but i cannot read it with the lsmw.
I have tried all the 3 encoding formats but none of them is working,does anyone know how i can solve this problem?
Thank you
2010 Jun 24 1:58 PM
Hai,
In LSMW in Assign files step, we have two options to pick the file. One is Legacy system (On PC) then one more is From application server(Second one). Check whether you have selected the second option and also check whether you have given the right path. May be this will help you.
Regards,
Prabu S.
2010 Jun 24 2:15 PM
It is selected to read from the server,but the file encoding is not right.
I have tried to use the unix linefeed but i get an error and i do not know why
open dataset gv_file for output in text mode encoding default with unix linefeed.
Error: Unable to interpret "with"
What am i doing wrong?
2010 Jul 05 1:47 PM
Now i am using it like this:
data: gv_string type string.
OPEN DATASET P-FILE FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE MESSAGE GV_MSG.
IF SY-SUBRC NE 0.
WRITE: / 'File cannot be opened.Reason: ', GV_MSG.
ELSE.
LOOP AT itab INTO wa.
CONCATENATE wa-field1 wa-field2 INTO GV_STRING SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
TRANSFER GV_STRING TO P-FILE.
ENDLOOP.
CLOSE DATASET P-FILE.
and it solved moy problem.Thank you
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |