‎2014 Mar 03 4:28 AM
Hi Expert.
I need to Upload Excel file on Application server. So I can Use fm GUI_DOWNLOAD but by using this function module i got Error
'Access Denied'. Please help me....
Said Answer is with Example.
My Step : 1 ) Read all data from Database table in Internal table.
2) Try to Upload File to Application server Like
P_L_FILENAME = application server parth.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = P_L_FILENAME
FILETYPE = 'DAT'
APPEND = P_L_APPEND
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = P_I_DATATAB
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks & Regards.
Pradip Patel.
‎2014 Mar 03 5:08 AM
Hello Pradip,
Use like below.
*- Open the files in Application server
OPEN DATASET p_afile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*Move the Internal table data to the file
LOOP AT itab INTO str.
TRANSFER str TO p_afile.
ENDLOOP.
*- Close the Opened File in the Application Server
CLOSE DATASET p_afile.
Regards,
Thanga
‎2014 Mar 03 4:32 AM
Hi,
Perhaps you don't have authorization to access and write a file to the presentation server directory.
Sumeet
‎2014 Mar 03 4:58 AM
Hi Sumeet.
Thanks for Reply. I know I have not authorization for Upload File. But I want to Upload.
Now at Development stage I have map network and upload file to Application server.
But I will not map All user local to to SAP Production Server when my Project Live.
anybody answer ?
Thanks.
Pradip Patel.
‎2014 Mar 03 5:04 AM
Hi Pradip
In case you want to write file to application server then you should use Open/Close dataset. GUI_DOWNLOAD is for presentation server.
Nabheet
‎2014 Mar 03 5:04 AM
Hello Sumeet,
GUI_DOWNLOAD is to Download an Internal Table to the PC.
You have to use OPEN DATASET, TRANSFER and CLOSE DATASET to create files in the application server.
Regards,
Thanga
‎2014 Mar 03 5:08 AM
Hello Pradip,
Use like below.
*- Open the files in Application server
OPEN DATASET p_afile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*Move the Internal table data to the file
LOOP AT itab INTO str.
TRANSFER str TO p_afile.
ENDLOOP.
*- Close the Opened File in the Application Server
CLOSE DATASET p_afile.
Regards,
Thanga
‎2014 Mar 03 5:13 AM
hello Thanga.
Thanks for Reply.
Please tell me the Type of str.
data : str type ????????
Thanks.
Pradip Patel.
‎2014 Mar 03 5:18 AM
here 'str' refers to the work area of the internal table itab.
‎2014 Mar 03 5:22 AM
‎2014 Mar 03 6:37 AM
hI Thanga.
Thanks for Reply. Problem Solve....
thanks.
Pradip Patel.
‎2014 Mar 03 6:53 AM
Hello Pradip,
You are welcome
Please raise a discussion in SCN whenever any help required.
Regards,
Thanga
‎2014 Mar 03 5:08 AM
Hi,
I need to Upload Excel file on Application server. So I can Use fm GUI_DOWNLOAD but by using this function module i got Error
'Access Denied'. Please help me...
GUI_DOWNLOAD is used to download the Data of an internal table to LOCAL File on to the Presentation server.
Inorder to update the internal table values on to the Application server you need to use OPEN DATASET statement.
Regards,
Mayur Priyan. S
‎2014 Mar 03 6:19 AM
‎2014 Mar 03 5:11 AM
There are plenty of posts available in SCN regarding this. Also refer to the below link
Upload Internal table to Application Server and Presntation Server - Contributor Corner - SCN Wiki
Regards,
Thanga
‎2014 Mar 03 5:14 AM
Hi Pradip,
First of all you have to Upload your file from PC to Internal table in your report using GUI_UPLOAD.
After you get the records in your internal table use
1) OPEN DATASET <Application filepath> FOR OUTPUT IN TEXT MODE ENCODING <Code page>
2) Then use TRANSFER to transfer records from Internal table to application server.
3) CLOSE DATASET.
Thanks & Regards
Akshay