Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

method GET_WINDOWS_DIRECTORYofCL_GUI_FRONTEND_SERVICES class givingproblem

Former Member
0 Likes
813

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?

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
724

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

6 REPLIES 6
Read only

matt
Active Contributor
0 Likes
725

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

Read only

Former Member
0 Likes
724

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?

Read only

Former Member
0 Likes
724

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

Read only

matt
Active Contributor
0 Likes
724

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

Read only

Former Member
0 Likes
724

thanks a lot matt

Read only

RaymondGiuseppi
Active Contributor
0 Likes
724

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