‎2008 May 14 8:28 AM
hey guys,
in my program b4 calling gui_download i need to take the path of desktop .
so i am calling the method GET_WINDOWS_DIRECTORYofCL_GUI_FRONTEND_SERVICES
CREATE OBJECT v_guiobj.
CALL METHOD v_guiobj->GET_DESKTOP_DIRECTORY
changing
DESKTOP_DIRECTORY = V_DESKTOP_DIRECTORY.
if sy-subrc = 0.
CONCATENATE V_DESKTOP_DIRECTORY '\smrt' '.pdf' INTO V_DESKTOP_DIRECTORY.
endif.
and then coding for
CALL FUNCTION 'GUI_DOWNLOAD'
follows..
the problem i am facing is..
the variable V_DESKTOP_DIRECTORY is not getting its value after the method is called......
why?
how to correct?
‎2008 May 14 8:36 AM
Which method are you calling? Your post title says GET_WINDOWS_DIRECTORY and your code says GET_DESKTOP_DIRECTORY.
Whichever, they are static methods. So you don't create an instance of them. You call them
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_WINDOWS_DIRECTORY...
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_DESKTOP_DIRECTORY...
And why are you then using the obsolete FM GUI_DOWNLOAD?
Instead use CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD...
matt
‎2008 May 14 8:36 AM
Which method are you calling? Your post title says GET_WINDOWS_DIRECTORY and your code says GET_DESKTOP_DIRECTORY.
Whichever, they are static methods. So you don't create an instance of them. You call them
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_WINDOWS_DIRECTORY...
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_DESKTOP_DIRECTORY...
And why are you then using the obsolete FM GUI_DOWNLOAD?
Instead use CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD...
matt
‎2008 May 14 8:54 AM
yea
i am calling GET_DESKTOP_DIRECTORY.
mstake in title..
also i have used
CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD...and seen..
yet no use..
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_DESKTOP_DIRECTORY
changing
DESKTOP_DIRECTORY = V_DESKTOP_DIRECTORY.
if sy-subrc = 0.
endif.
doesnot give any value into V_DESKTOP_DIRECTORY..
why?
‎2008 May 14 8:54 AM
intrestingly,
when i use
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_DESKTOP_DIRECTORY
changing
DESKTOP_DIRECTORY = V_DESKTOP_DIRECTORY.
if sy-subrc = 0.
endif.
or
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_WINDOWS_DIRECTORY
changing
WINDOWS_DIRECTORY = V_DESKTOP_DIRECTORY.
if sy-subrc = 0.
endif.
V_DESKTOP_DIRECTORY gets correct value
at the end of the call
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_bin_filesize
filename = V_DESKTOP_DIRECTORY
filetype = 'BIN'
changing
DATA_TAB = it_lines
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 <> 0.
i found this in debugging..
value of V_DESKTOP_DIRECTORY is ' ' before call of CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
but correct value is passed at the end...
but then during call
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
its taking ' ' and not able to download...
pls help
‎2008 May 14 9:33 AM
After your call to GET_DESKTOP_DIRECTORY, CALL METHOD cl_gui_cfw=>flush. It worked nicely for me. Obviously the problem described in the OSS note above has been fixed.
DATA: v_desktop_directory TYPE string.
CALL METHOD cl_gui_frontend_services=>get_desktop_directory
CHANGING
desktop_directory = v_desktop_directory.
CALL METHOD cl_gui_cfw=>flush.
WRITE v_desktop_directory.matt
Edited by: Matthew Billingham on May 14, 2008 10:36 AM
‎2008 May 14 10:10 AM
‎2008 May 14 9:28 AM
Are you working on SAP GUI for Windows with an old version, if yes look at [Note 913556 - Enhancement CL_GUI_FRONTEND_SERVICES for SAP GUI for Windows|https://service.sap.com/sap/support/notes/913556]
Symptom
The GET_PLATFORM, GET_LF_FOR_DESTINATION_GU, GET_TEMP_DIRECTORY and GET_DESKTOP_DIRECTORY methods of the CL_GUI_FRONTEND_SERVICES class are not supported in SAP GUI for Windows. If you call these methods, the NOT_SUPPORTED_BY_GUI exception occurs.
Reason and Prerequisites
The methods are not supported in SAP GUI for Windows.
Else look at thread .
Regards