Gui_download and ws_download
Hi Guys,
What is the difference between <b>gui_download</b> and <b>ws_download</b>.
Hi,
WS_DOWNLOAD is an outdate and obselete.
<u><b>Functionality of GUI_DOWNLOAD:</b></u>
File transfer from an internal table on the backend to a file on the
presentation server.
Storing SAP data in a file on the file system of the presentation
server.
The functionality is similar to that of module WS_DOWNLOAD. The
difference is that the DataProvider is used for downloading the data
instead of GMUX.
Example
1.) Binary download (not converted)
begin of itab,
raw(255) type x,
end of itab occurs 0.
CALL FUNCTION 'GUI_DOWNLOAD'
exporting
bin_filesize = 500
filetype = 'BIN'
filename = 'C:\DOWNLOAD.BIN'
tables
data_tab = itab.
loads 500 bytes of internal table itab into the file 'C:\DOWNLOAD.BIN'
on the frontend PC. The data transferred is not converted.
JLN
Similar Messages
-
Filename in gui_download and ws_download
Hi Friends..
if i using like this..
concatenate 'C:\'
syst-date
'.xls'
into mc_filename.
in program and gave the mc_filname as a filename in the function module.its working fine in ws_download but it was not working in gui_download function module.
so please give your valuable suggetion regarding this..
Thanks
GowrishankarHi Gowrishankar,
In WS_DOWNLOAD Function module Filename type is char but
In GUI_DOWNLOAD Function module Filename type is string.
so it is going to dump. first change the type of filename in your program
Plzz reward if it is helpful,
Mahi. -
GUI_DOWNLOAD and UPLOAD Function Modules?
Hi All,
What exactly done by GUI_DOWNLOAD and UPLOAD Function Modules?
Akshitha.What you exactly want know?
Here is the Sap documentation for both FM:
FU GUI_UPLOAD
Short Text
Upload for Data Provider
Functionality
The module loads a file from the PC to the server. Data can be transferred binarily or as text. Numbers and date fields can be interpreted according to the user settings.
Example
Binary upload: No conversion or interpretation
begin of itab,
raw(255) type x,
end of itab occurs 0.
CALL FUNCTION 'GUI_UPLOAD'
exporting
filetype = 'BIN'
filename = 'C:\DOWNLOAD.BIN'
tables
data_tab = itab.
Text upload
begin of itab,
text(255) type c,
end of itab occurs 0.
CALL FUNCTION 'GUI_UPLOAD'
exporting
filetype = 'ASC'
filename = 'C:\DOWNLOAD.TXT'
tables
data_tab = itab.
Parameters
FILENAME
FILETYPE
HAS_FIELD_SEPARATOR
HEADER_LENGTH
READ_BY_LINE
DAT_MODE
CODEPAGE
IGNORE_CERR
REPLACEMENT
CHECK_BOM
VIRUS_SCAN_PROFILE
NO_AUTH_CHECK
FILELENGTH
HEADER
DATA_TAB
Exceptions
FILE_OPEN_ERROR
FILE_READ_ERROR
NO_BATCH
GUI_REFUSE_FILETRANSFER
INVALID_TYPE
NO_AUTHORITY
UNKNOWN_ERROR
BAD_DATA_FORMAT
HEADER_NOT_ALLOWED
SEPARATOR_NOT_ALLOWED
HEADER_TOO_LONG
UNKNOWN_DP_ERROR
ACCESS_DENIED
DP_OUT_OF_MEMORY
DISK_FULL
DP_TIMEOUT
Function Group
SFES
FU GUI_DOWNLOAD
Short Text
Download an Internal Table to the PC
Functionality
Data transfer of an internal table form the server to a file on the PC. The Gui_Download module replaces the obsolete modules Ws_Download and Download. The file dialog of the download module is available in the class Cl_Gui_Frontend_Services.
Further information
TYPE-POOLS: ABAP.
Binary download table
DATA: BEGIN OF line_bin,
data(1024) TYPE X,
END OF line_bin.
DATA: data_tab_bin LIKE STANDARD TABLE OF line_bin.
Ascii download table
DATA: BEGIN OF line_asc,
text(1024) TYPE C,
END OF line_asc.
DATA: data_tab_asc LIKE STANDARD TABLE OF line_asc.
DAT download table
DATA: BEGIN OF line_dat,
Packed TYPE P,
Text(10) TYPE C,
Number TYPE I,
Date TYPE D,
Time TYPE T,
Float TYPE F,
Hex(3) TYPE X,
String TYPE String,
END OF line_dat.
DATA: data_tab_dat LIKE STANDARD TABLE OF line_dat.
Get filename
DATA: fullpath TYPE String,
filename TYPE String,
path TYPE String,
user_action TYPE I,
encoding TYPE ABAP_ENCODING.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = 'Gui_Download Demo'
WITH_ENCODING = 'X'
INITIAL_DIRECTORY = 'C:\'
CHANGING
FILENAME = filename
PATH = path
FULLPATH = fullpath
USER_ACTION = user_action
FILE_ENCODING = encoding
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
IF user_action <> CL_GUI_FRONTEND_SERVICES=>ACTION_OK.
EXIT.
ENDIF.
Download variables
DATA: length TYPE I.
Binary download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = fullpath
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = length
TABLES
DATA_TAB = data_tab_bin
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.
Ascii download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = fullpath
FILETYPE = 'ASC'
IMPORTING
FILELENGTH = length
TABLES
DATA_TAB = data_tab_asc
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.
DAT download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = fullpath
FILETYPE = 'DAT'
IMPORTING
FILELENGTH = length
TABLES
DATA_TAB = data_tab_dat
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.
Parameters
BIN_FILESIZE
FILENAME
FILETYPE
APPEND
WRITE_FIELD_SEPARATOR
HEADER
TRUNC_TRAILING_BLANKS
WRITE_LF
COL_SELECT
COL_SELECT_MASK
DAT_MODE
CONFIRM_OVERWRITE
NO_AUTH_CHECK
CODEPAGE
IGNORE_CERR
REPLACEMENT
WRITE_BOM
TRUNC_TRAILING_BLANKS_EOL
WK1_N_FORMAT
WK1_N_SIZE
WK1_T_FORMAT
WK1_T_SIZE
WRITE_EOL
FILELENGTH
DATA_TAB
FIELDNAMES
Exceptions
FILE_WRITE_ERROR
NO_BATCH
GUI_REFUSE_FILETRANSFER
INVALID_TYPE
NO_AUTHORITY
UNKNOWN_ERROR
HEADER_NOT_ALLOWED
SEPARATOR_NOT_ALLOWED
FILESIZE_NOT_ALLOWED
HEADER_TOO_LONG
DP_ERROR_CREATE
DP_ERROR_SEND
DP_ERROR_WRITE
UNKNOWN_DP_ERROR
ACCESS_DENIED
DP_OUT_OF_MEMORY
DISK_FULL
DP_TIMEOUT
FILE_NOT_FOUND
DATAPROVIDER_EXCEPTION
CONTROL_FLUSH_ERROR
Function Group
SFES -
How to get gui_download and gui_upload with popup filename?
how to get gui_download and gui_upload with popup filename?
Here is a short example.
report zrich_0003 .
data: ifiletab type filetable.
data: xfiletab like line of ifiletab.
data: xstring type string.
data: rc type i.
data: itab type table of string.
data: xtab type string.
start-of-selection.
call method cl_gui_frontend_services=>file_open_dialog
changing
file_table = ifiletab
rc = rc.
read table ifiletab into xfiletab index 1.
xstring = xfiletab-filename.
check not xstring is initial.
call method cl_gui_frontend_services=>gui_upload
exporting
filename = xstring
changing
data_tab = itab.
loop at itab into xtab.
write:/ xtab.
endloop.
Regards,
Rich Heilman -
Hi,
In sap gui was trigered action whih is using smartform and then output was being downloaded and saved as using:
CALL FUNCTION 'GUI_DOWNLOAD' - to
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
After the ubgrade this action is not working in web ui.
Anyone knows how to change this to work in web ui?
Thank you in advanceHi Tanja Lukovic
Pls check the settings defined in the SPRO path CRM->Basic settings->actions under this select your relevant application area and check whether any start/schedule conditions are not met (check in conditions) , apart from this reason there could be other reasons also pls check the trigger processing type (it should be smart form print).
if the actions are already created , you can change actions and conditions.
Thanks & Regards
Raj -
GUI_DOWNLOAD and background processing
Hello,
I have created a process which creates a file. this process uses GUI_DOWNLOAD to put the file on the users C drive or other directory on our network. The user wants to run this process in background and the program is returning a 6 (error unknown) from the GUI_DOWNLOAD FM. I was looking on SDN and found out the GUI_DOWNLOAD only works in foreground. You have to use OPEN and CLOSE DATASET statements to process in background. I am thinking about putting a button to denote foreground/background processing and using the appropriate statements to process the file. I will then have to get the file from the app server to a place will the user can get access to it.
<b>first question</b> - is there a FM to do a FTP from the app server to a directory on our network for the user to access?
<b>second question</b> - is this the right approach or is there something else that I should be doing.
thanks in advance for your helpHi,
Yes, your right, GUI_DOWNLOAD wil not work in background mode, you need to place the file in Application server, here.
See the below link for a FTP program, use the proper commands(i do not know whether downloading the file is possible through the commands)
http://www.sap-img.com/ab003.htm
or else, write a small program which downloads the data from the application server, but it should run in the foreground
Regards
Sudheer -
What is difference between GUI_download and Open dataset
Dear All,
I know there are 2 options for downloading SAP data.
1) GUI_DOWNLOAD Functional Module.
2) OPEN DATASET DSET FOR OUTPUT IN TEXT MODE.
What is the difference ??
When I should use ?? What are the deciding factors ??
Regards
venkatHi All,
Thank You very Much for quick replies.
1) GUI_DOWNLOAD is used to download data into your local PC. can be run only in frontend.
2) OPEN DATASET is used for downloading into Application Server
Thank You one and all.
Closing Thread, Alloting Points. -
Need help: GUI_DOWNLOAD and tab-separated in between fields.
hello everyone,
this is the layout of the interface that i created:
sy-title
total records processed: XX
total records failed: XX
summary of the error
pernr<tab>name<tab>error message<tab>otherfieldshere
i wanted the error log to be saved locally thus, i have to use GUI_DOWNLOAD.
ok, here's the current parameters i supplied with my gui_download:
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_file_string
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = i_error_log
(exceptions not displayed)
the problem that i have is that, there is a difference between the error logs displayed after the execution and the error logs saved in my local directory.
i did find a way to resolve this BUT, i still need to refine it. also, the spaces between the fields seems not tab delimited, but separated by space.
to explain further here's the current error log that i have downloaded:
10000001<tab>10/23/2006<tab>01<tab>P<tab>11<tab>01
the header:
sy-title
total records processed: XX
total records failed: XX
summary of the error
is not included in the downloaded errorlog file.
i added some modification of my report to include it because, i want to to look exactly the same as of the errorlog generated/displyed after the execution.
the result looks as it is what i've expected BUT,
when i checked the spaces in between fields...
it is all separated by spaces... not tab.
here is the actual error log that i have obtained:
sy-title
total records processed: XX
total records failed: XX
summary of the error
pernr<space><space><space>name<space><space><space><space><space><space>error message<space><space>otherfieldshere
What i wanted to resolve is that, i want the error log to be tab delimited and not separated by space.
is this possible? if it is, any suggestion will truly be appreciated.Hi,
Please check your flat file i think it they have used the Three spaces instead of using a SINGLE TAB. between the fields.
Thanks & Regards,
Chandralekha. -
GUI_DOWNLOAD and codepage problem
I'm trying to download XML data using this function module to a local PC file. It contains finnish characters such as Ä.
When I open the XML file with an XML editor, it tells me that "Byte 0xFF found in file ... is invalid for encoding utf-8'
I think I need to save the file with ISO-8859-9 encoding, but I tried to use a codepage for that in the function module, and that also didn't work.
Can anybody suggest what I may be doing wrong?
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
filetype = 'BIN'
write_lf = ' '
* codepage = '1611'
TABLES
data_tab = lt_table.Try using the following method:
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = lv_string
iv_codepage = '1611'
iv_add_bom = 'X'
IMPORTING
et_solix = binary_content
ev_size = size ).
CATCH cx_bcs.
MESSAGE e445(so).
ENDTRY.
For your table run it for every line and append the lines of the 'binary_content' into a collecting table (binary_content_all or something). Play with the BOM (Byte order mark) to see if you need it or not. After the table has been processed you can download the binary_content_all with your function module but I recommend using:
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = l_filename
filetype = 'BIN'
CHANGING
data_tab = binary_content
Let me know if this was helpful!
Cheers,
Roel van den Berge -
GUI_DOWNLOAD and spaces
Hi
I'm using GUI_DOWNLOAD to load data down to a local file. My internal table consists of 2 fields
field(660) type c,
spaces(12) type c.
I have two issues, when I down load the file, I'm not sure if I get 672 characters transfered to the text file, I have written some code to find the length of each line. When I try to read the file using notepad I have no idea how many characters are per row. Is theer any standard MS software that I can use to get the field length
Regards
J-JHi jim,
Add one more field to ur internal table EOD(1) " End of file
loop at itab into wa_itab.
itab-EOD = 'E'.
modify itab from wa_itab.
endloop.
then you can identify the end of file with E at the end -
Cl_gui_frontend_services= gui_download and logical path issue
Hi all!!
I'm downloading a table with this class/method, and when i have worked with a LOCAL folder, it worked fine, but now, i need to put the file into a server folder. So i get the logical path in this way:
10.20.xx.xx
but when i pass the filename to the method: v_filename = '
10.20.xx.xx\file.txt' the file is not generated into this folder.. and i have permission to access and modify this folder..
Thanks for your feedbak!If you need transfer each record of the table (I suppose itab with header line):
LOOP AT itab.
TRANSFER itab TO file_path
ENDLOOP.
Note: All of fields in itab must be character-type if the file was opened as a text file.
Other example:
OPEN DATASET '/usr/sap/tmp/ztest.txt' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
TRANSFER zdepmentt TO '/usr/sap/tmp/ztest.txt'.
ENDIF.
CLOSE DATASET '/usr/sap/tmp/ztest.txt'.
Here the content of the data object (flat structure) "zdepmentt" is transferred to the application server file '/usr/sap/tmp/ztest.txt'.
Note: The file ztest.txt is automaticaly created. -
Using GUI_DOWNLOAD and FILE_SAVE_DOWNLOAD in WebDynpro
Hi Experts,
i have a WebDynpro, in which i try to create a FILE-Download-Window to save a File in the temp-folder.
For this i used the CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG and the the function GUI-DOWNLOAD. Both I tested in an report. they worked, but in the WebDynpro they didn't work.
Have anybody an idea for solving this problem?
Thanks a lotHi,
You need not use these Function modules in WD application because WD Object library provides options for uploading and Downloading function. Just use these buttons in your screen and the functions will come automatically.
ags. -
Is there any alternative to GUI_DOWNLOAD other than WS_DOWNLOAD?
Hi All,
Is there any alternative FM other than GUI_DOWNLOAD and WS_DOWNLOAD?I need to download a PDF file to a network drive.
Thanks in Advance,
AnjalyHi,
If u want to download a PDF file from application server...
u can use the transaction... <b>CG3Y</b> directlyy..
just check it and use it in ur program..
cheers,
Simha. -
Any alternative FM for GUI_DOWNLOAD other than WS_DOWNLOAD?
Hi All,
Is there any alternative FM other than GUI_DOWNLOAD and WS_DOWNLOAD?I need to download a PDF file to a network drive.
Thanks in Advance,
Anjalycheck this thread
ITS Upload / Download using CL_GOS_MANAGER
Raja -
Calling GUI_DOWNLOAD Function
i would like to store my internal table into my local disk , there are two functions GUI_DOWNLOAD and WS_DOWNLOAD.
how do i call these functions.
if i want to specify the file name in my selection screen what should be the data type of the file name.
when i call the function GUI_DOWNLOAD , there is an error saying mismatch of datatype of filename.Dear Rajarshi,
I gave the file name as a paramater with type c length 30 , but it is still showing the same error
The message is given below --
'The function Module interface allows you to specify only fields of a particular type under"FILENAME". The field PATH specified here has a different field type'
Please do suggest some solution.
Regards
Arun
Maybe you are looking for
-
Let me begin by saying I'm new to the Mac world as well as to the realm of online forums so I apologize if this is a question that was already asked and/or if it is a very noobish question... But anyway, I just recently got the new Macbook Pro 15" wi
-
Copy of WT MD60 'Arrears Recovery' not clearing Ded. WT amount from ARRS
Since I can't search only the Threads in HCM I will have to make my own question. Hope soemone has run into this before. Using US Payroll, copy of schema QP00, we have 2 situations with deductions in arrears that I have not found a working solution.
-
Lumia 620 - How do I 'preview' the ringtones prior...
Greetings, I bought a Lumia 620 yesterday and I cannot find a way of hearing the ringtones so that I can choose my preference. Searching on 'ringtones' and 'preview' hasn't brought anything up and neither has a good read of the User Guide. Could some
-
Having problem with with Apple tv?
I am having problem with wifi connection? can someone please help me out with this problem
-
How to access the handle of the Frame window ?
How to access the handle of the frame window through out the application ?. I want to display an alert box, while I click the fifth inner child component of the Frame . I am using Dialog Class for the alert box, I have to pass the frame handle to the