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

Open downloaded file

Former Member
0 Likes
1,974

Hi guys ,

i want to open downloaded file in my report.

In my report we have provided two option.

one is to download file and

second one is to open file after download .

For the downloading i am using gui_donwload function module but i don't know how to do second option.

Thanks,

Jack

Hi guys ,

i want to open downloaded file in my report.

In my report we have provided two option.

one is to download file and

second one is to open file after download .

For the downloading i am using gui_donwload function module but i don't know how to do second option.

Thanks,

Jack

2 REPLIES 2
Read only

Former Member
0 Likes
920

Hi.

If you want to open it in notepad for example you can do like this:


CALL FUNCTION 'GUI_EXEC'
  EXPORTING
     command = 'NOTEPAD'
     parameter = 'C:ptdebug.txt'
* IMPORTING
*    RETURNCODE = .

Or if you want to use classes instead you can do like this:


CALL METHOD cl_gui_frontend_services=>execute
  EXPORTING
    document               = 'C:ptdebug.txt'
    operation              = 'OPEN'
  EXCEPTIONS
    cntl_error             = 1
    error_no_gui           = 2
    bad_parameter          = 3
    file_not_found         = 4
    path_not_found         = 5
    file_extension_unknown = 6
    error_execute_failed   = 7
    synchronous_failed     = 8
    not_supported_by_gui   = 9
    OTHERS                 = 10.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

Best Regards

Niklas

Read only

Former Member
0 Likes
920

Dis one let's You open any type of a file by a a default system application:

* Execute default file aplication
call method CL_GUI_FRONTEND_SERVICES=>EXECUTE
  EXPORTING
    DOCUMENT               = LV_FNAME
  EXCEPTIONS
    CNTL_ERROR             = 1
    ERROR_NO_GUI           = 2
    BAD_PARAMETER          = 3
    FILE_NOT_FOUND         = 4
    PATH_NOT_FOUND         = 5
    FILE_EXTENSION_UNKNOWN = 6
    ERROR_EXECUTE_FAILED   = 7
    OTHERS                 = 8.
if SY-SUBRC <> 0.

endif.