Regarding CL_GUI_FRONTEND_SERVICES

Dear forumers,
Is there a method available from the class CL_GUI_FRONTEND_SERVICES that can be used to select and browse for a file in the presentation server?
In other words, is there a method from this class that is similar to the function F4_FILENAME too? Also, is the function F4_FILENAME considered as an obsolete ABAP construct?
I have checked the methods in the class CL_GUI_FRONTEND_SERVICES, and I'm wondering if methods GET_DESKTOP_DIRECTORY or FILE_OPEN_DIALOG can be used for this purpose?
Please help. Thanks.

Hi Deborah,
Try method FILE_OPEN_DIALOG in class CL_GUI_FRONTEND_SERVICES.
For its use, refer the following thread:
Re: class and method can be used instead of F4_FILENAME
Regards,
Nitin.

Similar Messages

  • Regarding CL_GUI_FRONTEND_SERVICES= FILE_OPEN_DIALOG

    I'm using CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG to replace WS_FILENAME_GET which is an obsolete function module in ECC6.
    WS_FILENAME_GET was making use of the file mask -
    ',.csv  ,.csv ,.txt ,.txt.'
    When I use the same string in the file_filter parameter of FILE_OPEN_DIALOG, it doesn't work.
    Can somebody tell me the correct string format? I would like *.csv & *.txt as the file mask in the open dialog.
    Thanks!

    Hi
    U can give like this |.csv| ,|.csv |,|.txt |,|.txt.|'
    i think it will work.
    Thanks

  • Query regarding cl_gui_frontend_services= get_ip_address

    Hi,
    I am using the method get_ip_address on class  cl_gui_frontend_services to get the IP address of a machine.
    However, the wrong IP address appears to be being picked up.
    If I do an ip_config, I can see a list of 3 IP addresses, one for each of the following adapters:-
    Ethernet Adapter local area connection
    Ethernet Adapter Wireless Network Connection
    Ethernet Adapter DrayTek Virtual Interface
    I want the IP address of the local area connection but this method seems to be picking up one of the other ones.
    Does anyone have  any ideas on how I get round this?
    Thanks,
    Ruby

    Hi friend,
    Also try FM 'THUSRINFO'.
    It will return table containing IP address.
    Ex:
    DATA: BEGIN OF user_tab OCCURS 0.
            INCLUDE STRUCTURE uinfo.
    DATA:  END OF user_tab.
    CALL FUNCTION 'THUSRINFO'
      TABLES
        usr_tabl = user_tab.
    LOOP AT user_tab.
    WRITE:/ user_tab-hostadr.  <--- 'user_tab-hostadr' contains IP address
    ENDLOOP.
    Thanks..
    Edited by: Sap Fan on Mar 5, 2009 12:19 PM

  • Cl_gui_frontend_services

    How it possible to download file to excel with the column header by using the class cl_gui_frontend_services

    Hi,
    Please go through the following Thread hope will help you out,
    [Download Data Into Excel File  |Re: download data into excel file]
    [Regarding CL_GUI_FRONTEND_SERVICES|Regarding CL_GUI_FRONTEND_SERVICES]
    [CALL METHOD cl_gui_frontend_services=>file_save_dialog|Re: CALL METHOD cl_gui_frontend_services=>file_save_dialog]
    Kind Regards,
    Faisal

  • Actions - How to replace GUI_DOWNLOAD and CL_GUI_FRONTEND_SERVICES= FILE_SA

    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 advance

    Hi 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

  • Error calling class methods CL_GUI_FRONTEND_SERVICES

    Hi all,
    I have a requirement in BAPI (integrating solman to portal) to download file from app. server to local directory. I used the below FM to get temp directory of presntation server.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_TEMP_DIRECTORY
       CHANGING
         TEMP_DIR             =  LV_TEMP_DIR
       EXCEPTIONS
         CNTL_ERROR           = 1
         ERROR_NO_GUI         = 2
         NOT_SUPPORTED_BY_GUI = 3
         others               = 4.
       CALL METHOD cl_gui_cfw=>flush.
    It works fine in R3, but when i called it from portal it shows Access not possible using 'NULL' object reference with a short dump .
    st22 shows
    Error in ABAP application program.
    The current ABAP program "CL_GUI_FRONTEND_SERVICES======CP" had to be
    terminated because one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    An exception occurred. This exception is dealt with in more detail belo
    . The exception, which is assigned to the class 'CX_SY_REF_IS_INITIAL',
    neither
    caught nor passed along using a RAISING clause, in the procedure
    "GET_TEMP_DIRECTORY" "(METHOD)"
    Since the caller of the procedure could not have expected this exceptio
    to occur, the running program was terminated.
    The reason for the exception is:
    Attempt to access a component using 'NULL' object reference (points
    to nothing).
    An object reference must point to an object (an instance of a class)
    before you can use it to access components (variable:
    "CL_GUI_FRONTEND_SERVICES=>HANDLE").
    Either the reference has not yet been set, or it has been reset to
    'NULL' by a CLEAR statement.
    When i put external break point and the dump comes during execution of CALL METHOD cl_gui_cfw=>flush.
    Is it not possible to use CL_GUI_FRONTEND_SERVICES in RFC ??.
    thanks and regards
    Jijo

    [CL_GUI_FRONTEND_SERVICES|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=cl_gui_frontend_services+portal&adv=false&sortby=cm_rnd_rankvalue] needs a SAPGUI, so it is not possible to use it in RFC, BSP or other portal.
    Regards

  • Error calling methods CL_GUI_FRONTEND_SERVICES

    Hi all,
    I have a requirement in BAPI (integrating solman to portal) to download file from app. server to local directory. I used the below FM to get temp directory of presntation server.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_TEMP_DIRECTORY
       CHANGING
         TEMP_DIR             =  LV_TEMP_DIR
       EXCEPTIONS
         CNTL_ERROR           = 1
         ERROR_NO_GUI         = 2
         NOT_SUPPORTED_BY_GUI = 3
         others               = 4.
       CALL METHOD cl_gui_cfw=>flush.
    It works fine in R3, but when i called it from portal it shows Access not possible using 'NULL' object reference with a short dump .
    st22 shows
    Error in ABAP application program.
    The current ABAP program "CL_GUI_FRONTEND_SERVICES======CP" had to be
    terminated because one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    An exception occurred. This exception is dealt with in more detail belo
    . The exception, which is assigned to the class 'CX_SY_REF_IS_INITIAL',
    neither
    caught nor passed along using a RAISING clause, in the procedure
    "GET_TEMP_DIRECTORY" "(METHOD)"
    Since the caller of the procedure could not have expected this exceptio
    to occur, the running program was terminated.
    The reason for the exception is:
    Attempt to access a component using 'NULL' object reference (points
    to nothing).
    An object reference must point to an object (an instance of a class)
    before you can use it to access components (variable:
    "CL_GUI_FRONTEND_SERVICES=>HANDLE").
    Either the reference has not yet been set, or it has been reset to
    'NULL' by a CLEAR statement.
    When i put external break point and the dump comes during execution of CALL METHOD cl_gui_cfw=>flush.
    Is it not possible to use CL_GUI_FRONTEND_SERVICES in RFC ??.
    thanks and regards
    Jijo

    Hi,
    the dump is because you cannot use that function from a BSP application, which runs in internet or intranet. The procedure in this case is different:
    DATA: flights  TYPE flighttab,
            flight   LIKE LINE OF flights,
            appl     TYPE string,
            filetype TYPE string,
            output   TYPE string,
            output2  TYPE xstring,
            response     TYPE REF TO if_http_response,
            l_len        TYPE i,
            seatsmax     TYPE string,
            seatsocc     TYPE string.
      appl = 'application/msexcel'.
      filetype = 'attachment;filename=mi archivo.xls'.
      SELECT * FROM sflight
         INTO TABLE flights
         UP TO 20 ROWS.
      LOOP AT flights INTO flight.
        seatsmax = flight-seatsmax. CONDENSE seatsmax.
        seatsocc = flight-seatsocc. CONDENSE seatsocc.
        CONCATENATE output
        flight-carrid cl_abap_char_utilities=>horizontal_tab
        flight-connid cl_abap_char_utilities=>horizontal_tab
        flight-fldate cl_abap_char_utilities=>horizontal_tab
        flight-planetype cl_abap_char_utilities=>horizontal_tab
        seatsmax cl_abap_char_utilities=>horizontal_tab
        seatsocc cl_abap_char_utilities=>horizontal_tab
        cl_abap_char_utilities=>cr_lf
        INTO output.
      ENDLOOP.
      response = runtime->server->response.
      response->delete_header_field( name = if_http_header_fields=>cache_control ).
      response->delete_header_field( name = if_http_header_fields=>expires ).
      response->delete_header_field( name = if_http_header_fields=>pragma ).
      response->set_header_field( name = if_http_header_fields=>content_type
                                  value = appl ).
      response->set_header_field( name = 'content-disposition'
                                  value = filetype ).
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text     = output
          mimetype = 'text/unicode; charset=utf-16le'
        IMPORTING
          buffer   = output2.
      CONCATENATE cl_abap_char_utilities=>byte_order_mark_little
                  output2 INTO output2 IN BYTE MODE.
      l_len = XSTRLEN( output2 ).
      response->set_data( data = output2
                          length = l_len ).
      navigation->response_complete( ).
    This is the code for downloading an Excel file.

  • Cl_gui_frontend_services: possible to change the user for writing files?

    Hi,
    I'm using the class cl_gui_frontend_services to allow the user to copy a file to a specified network drive (using the method file_copy). The user can open the file again, if he double clicks on a row in a ALV table. So far so good, this works already.
    But one requirement for this solution is, that the user can not access the directory where the copied files are stored directly.
    Now I'm wondering if it is possible to use a specified system user for copying the files? My idea is to switch to the system user just for the method file_copy. I didn't find a method for doing this yet but maybe somebody knows if this is possible.
    Thanks and regards,
    Martin

    Hi ,
    Regarding to your last question; You can get the file list of a specified directory while using OPEN DATASET related commands. After the list populated you make the user select it with the help of a popup screen.
    Gets the list of a specified directory's content
      CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
        EXPORTING
          dir_name               = gv_drctry
        TABLES
          dir_list               = lt_dirlist
        EXCEPTIONS
          invalid_eps_subdir     = 1
          sapgparam_failed       = 2
          build_directory_failed = 3
          no_authorization       = 4
          read_directory_failed  = 5
          too_many_read_errors   = 6
          empty_directory_list   = 7
          OTHERS                 = 8.
    Hope it's useful...

  • Exit CL_GUI_FRONTEND_SERVICES= FILE_OPEN_DIALOG once I get the file name

    Hi
    I have where I have a selection screen that finds the file, you can say where to get the file. After that I need to close that window. How do I close it???
    Below is an example of my program. After I choose the file and execute the program, I have a <b>write</b> statement. I don't see that statement on the screen. How do i terminate the input screen and display text.
    Parameters :  AUSZFILE      LIKE RFPDO1-FEBUMSF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR AUSZFILE.          "mo271101
      DATA: L_FILES TYPE FILETABLE,                            
            H_FILES TYPE FILE_TABLE,                           
            L_RC LIKE SY-SUBRC.                                
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG        CHANGING                                               
          FILE_TABLE              = L_FILES                    
          RC                      = L_RC                       
        EXCEPTIONS                                             
          FILE_OPEN_DIALOG_FAILED = 1                          
          CNTL_ERROR              = 2                          
          ERROR_NO_GUI            = 3                          
          NOT_SUPPORTED_BY_GUI    = 4                          
          OTHERS                  = 5.                         
      IF SY-SUBRC <> 0 OR L_RC < 0.                            
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO       "mo271101
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.   
      ELSE.                                                     "mo271101
        READ TABLE L_FILES INDEX 1 INTO H_FILES.              
        AUSZFILE = H_FILES-FILENAME.                           
      ENDIF.
    Write AUSZFILE.
    Thanks in advance

    You must remember the START-OF-SELECTION event here,  after you select the file name and click F8, the START-OF-SELECTION event is triggered, but if it is not there, nothing will happen.
      if sy-subrc <> 0 or l_rc < 0.
        message id sy-msgid type sy-msgty number sy-msgno       "mo271101
        with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.                                                     "mo271101
        read table l_files index 1 into h_files.
        auszfile = h_files-filename.
      endif.
    start-of-selection.            "<--  Add this
      write:/ auszfile.
    Regards,
    RIch Heilman

  • How to use CL_GUI_FRONTEND_SERVICES= GET_SCREENSHOT?

    Hi everybody,
    I've noticed this function lately and wanted to test it. I wrote report like below, but nothing is displayed. Data are read (at least I'm getting something in this xstring), url is being generated, container and picture objects are created, and url is loaded without error. So what is wrong here?
    REPORT  ZTEST11.
    data: lv_mime TYPE string,
           lv_data TYPE xstring.
    DATA: BEGIN OF graphic_table OCCURS 0,
            line(255) TYPE x,
          END OF graphic_table.
    DATA: graphic_size TYPE i.
    DATA: graphic_url(255).
    DATA: l_graphic_conv TYPE i,
          l_graphic_offs TYPE i.
    DATA: lo_picture TYPE REF TO cl_gui_picture,
          lo_container TYPE REF TO cl_gui_docking_container.
    data lv_result type i.
    PARAMETERS tmp.
    AT SELECTION-SCREEN OUTPUT.
      IF lo_container IS NOT BOUND.
        CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_SCREENSHOT
          IMPORTING
            MIME_TYPE_STR        = lv_mime
            IMAGE                = lv_data.
          graphic_size = XSTRLEN( lv_data ).
          CHECK graphic_size > 0.
          l_graphic_conv = graphic_size.
          l_graphic_offs = 0.
          WHILE l_graphic_conv > 255.
            graphic_table-line = lv_data+l_graphic_offs(255).
            APPEND graphic_table.
            l_graphic_offs = l_graphic_offs + 255.
            l_graphic_conv = l_graphic_conv - 255.
          ENDWHILE.
          graphic_table-line = lv_data+l_graphic_offs(l_graphic_conv).
          APPEND graphic_table.
        CALL FUNCTION 'DP_CREATE_URL'
          EXPORTING
            TYPE                       = 'image'
            SUBTYPE                    = 'png'
          TABLES
            DATA                       = graphic_table
          CHANGING
            URL                        = graphic_url.
        CREATE OBJECT LO_CONTAINER
          EXPORTING
            EXTENSION                   = 600.
        CREATE OBJECT LO_PICTURE
          EXPORTING
            PARENT = LO_CONTAINER.
        CALL METHOD LO_PICTURE->LOAD_PICTURE_FROM_URL
          EXPORTING
            URL    = graphic_url.
      ENDIF.
    Best regards
    Marcin Cholewczuk

    Hi Sandra,
    I saw it somewhere, but I guess I was too cleaver and was hoping that maybe somehow it will work After your sugestion I've changed and instead of picture I've used html like below and now it works. Thank you very much for your help.
      CALL METHOD LO_HTML->LOAD_DATA
        EXPORTING
          TYPE                 = 'image'
          SUBTYPE              = 'png'
        IMPORTING
          ASSIGNED_URL = graphic_url
        CHANGING
          DATA_TABLE           = graphic_table."graphic_table.
        CALL METHOD LO_HTML->SHOW_URL
          EXPORTING
            URL                    = graphic_url.
    Best regards
    Marcin Choleczuk

  • Regarding Uploading of internal Table - Its Urgent.

    Hi All,
                 I want to upload the data from an Excel File into Interna Table.
                 GUI_UPLOAD is used for Flat File but for Excel Which FM should I use?
                 Can Any One give me the sample code for this ?
                 Points will be rewarded.   
                 Thanks in Advance.
    Regards
    Jitendra Gujarathi

    hi
    REPORT zupload_excel_to_it NO STANDARD PAGE HEADING.
    TYPES:   BEGIN OF t_datatab ,
             col1(25)  TYPE c,
             col2(30)  TYPE c,
             col3(30)  TYPE c,
             col4(30)  TYPE c,
             col5(30)  TYPE c,
             col6(30)  TYPE c,
             col7(30) TYPE c,
             col8(30)  TYPE c,
             col9(30)  TYPE c,
             col10(30)  TYPE c,
             col11(30)    TYPE c,
           END OF t_datatab.
    DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
          wa_datatab TYPE t_datatab.
    DATA : gd_scol   TYPE i VALUE '1',
           gd_srow   TYPE i VALUE '1',
           gd_ecol   TYPE i VALUE '256',
           gd_erow   TYPE i VALUE '65536'.
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i.
    *Selection screen definition
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:  p_file LIKE rlgrap-filename
                   DEFAULT 'c:\test.xls' OBLIGATORY.   " File Name
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title     = 'Select File'
          default_filename = '*.xls'
          multiselection   = ' '
        CHANGING
          file_table       = it_tab
          rc               = gd_subrc.
      LOOP AT it_tab INTO p_file.
       so_fpath-sign = 'I'.
       so_fpath-option = 'EQ'.
       append so_fpath.
      ENDLOOP.
    START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM upload_excel_file TABLES   it_datatab
                                 USING   p_file
                                         gd_scol
                                         gd_srow
                                         gd_ecol
                                         gd_erow.
    END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3,
                wa_datatab-col4,
                wa_datatab-col5,
                wa_datatab-col6,
                wa_datatab-col7,
                wa_datatab-col8,
                wa_datatab-col9,
                wa_datatab-col10,
                wa_datatab-col11.
      ENDLOOP.
    *&      Form  UPLOAD_EXCEL_FILE
          upload excel spreadsheet into internal table
         -->P_TABLE    Table to return excel data into
         -->P_FILE     file name and path
         -->P_SCOL     start column
         -->P_SROW     start row
         -->P_ECOL     end column
         -->P_EROW     end row
    FORM upload_excel_file TABLES   p_table
                           USING    p_file
                                    p_scol
                                    p_srow
                                    p_ecol
                                    p_erow.
      DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
    Has the following format:
                Row number   | Colum Number   |   Value
         i.e.     1                 1             Name1
                  2                 1             Joe
      DATA : ld_index TYPE i.
      FIELD-SYMBOLS : .
    Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename                = p_file
          i_begin_col             = p_scol
          i_begin_row             = p_srow
          i_end_col               = p_ecol
          i_end_row               = p_erow
        TABLES
          intern                  = lt_intern
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'Error Uploading file'.
        EXIT.
      ENDIF.
      IF lt_intern[] IS INITIAL.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'No Data Uploaded'.
        EXIT.
      ELSE.
        SORT lt_intern BY row col.
        LOOP AT lt_intern.
          MOVE lt_intern-col TO ld_index.
          ASSIGN COMPONENT ld_index OF STRUCTURE p_table TO <fs>.
          MOVE lt_intern-value TO .
          AT END OF row.
            APPEND p_table.
            CLEAR p_table.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "UPLOAD_EXCEL_FILE
    plz reward points!
    rgds

  • Cl_gui_frontend_services=   allow browsing to directory path

    Hi guys,
    i have created a program to automate the download of joblogs and spools using CALL TRANSACTION SM37 .
    currently i am taking the location where files need to be stored from selection screen.
    now  i want to use  <b>cl_gui_frontend_services=>?</b>
    to allow browse function to directory path where i need to save the files(i.e spool and joblog).
    it will be of great help if you could send me a piece of code using cl_gui_frontend_services=>? which can <i><i><u>allow browsing to directory path</u></i></i> where i can save the files.
    Thanks
    Ankit
    LnT Infotech,Mumbai

    I had the same problem like Adel when calling the browser via cl_gui_frontend_services=>execute().
    On my old school XP machine the synchronous start is doing well, but not on my colleagues W7 64 machines.
    I used a registrey key to get - in my case - the path to the Internet Explorer.
    (htmlfile\shell\open\command)
    On W7/64Bit this key contains the path to the 32 bit Binary:
    C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE
    If I start this application it's not synchronous, if i hard-code the path 64 bit binary
    (C:\Program File\Internet Explorer\IEXPLORE.EXE) the application runs synchronous.
    A pragmatic programmer could replace the ' (x86)' in the path, which should work on most Windows platforms
    Regards
    Dominik

  • Cl_gui_frontend_services= gui_download - issue with german special char

    Hello,
    we are using cl_gui_frontend_services=>gui_download to create from an itab an excel file.
    We face the issue that in this excel file german special characters like Ä, Ü, Ö, ß are not displayed correctly.
    I think we need to use a different codepage. But which one?
    could you please give us a short coding example how to call cl_gui_frontend_services=>gui_download.
    Thanks a lot
    Kind regards
    Manfred

    Hi,
    Check the system is unicode or non-unicode . Codepage for Unicode system is ' 4102' and non-unicode is '1100'.
    Below are the sample code for the GUI_download with Class.
    DATA:  l_filename    TYPE string,
           l_filen       TYPE string,
           l_path        TYPE string,
           l_fullpath    TYPE string,
           l_usr_act     TYPE I.
    l_filename = SPACE.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
      EXPORTING
        DEFAULT_FILE_NAME    = l_filename
      CHANGING
        FILENAME             = l_filen
        PATH                 = l_path
        FULLPATH             = l_fullpath
        USER_ACTION          = l_usr_act
      EXCEPTIONS
        CNTL_ERROR           = 1
        ERROR_NO_GUI         = 2     
        NOT_SUPPORTED_BY_GUI = 3
        others               = 4.
    IF sy-subrc = 0
          AND l_usr_act <>
          CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = l_fullpath
       FILETYPE                        = 'DAT'
      TABLES
        DATA_TAB                        = T_DOWNL
    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.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDIF.
    Edited by: Sumodh P on May 11, 2010 5:24 PM

  • Cl_gui_frontend_services= gui_download - wrong behaviour with Windows UAC

    Hello,
    we are using the method cl_gui_frontend_services=>gui_download to store files on the presentation front end (Windows Vista with UAC).
    When the user has no windows rights to the target directory and UAC is active, then the method gui_download stores the file in other directory (C:\Users\<USER_NAME>\AppData\Local\VirtualStore\Windows) and returns with sy-subrc = 0.
    In our opinion this is a critical problem but SAP doesn't want to correct it.
    What do you think about it?
    regards,
    Kris

    Hello kpsgoutam ,
    thank you for your post but it's not an answer for my question. I know how to use 'gui_dowload'. The problem is, it works wrong with UAC and target directory, where you have no rights to write the file.
    Consider following code:
    REPORT ztest.
    DATA:
    " to reproduce the problem the UAC must be active
    " and you can't have write rights to the target directory
      lv_filename TYPE string VALUE 'c:\windows\test.txt',
      lt_data     TYPE TABLE of string,
      lv_data     TYPE string,
      lv_outlen   TYPE i.
    lv_data = 'Some test content'.
    APPEND lv_data TO lt_data.
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        filename                  = lv_filename
      IMPORTING
        filelength                = lv_outlen
      changing
        data_tab                  = lt_data
      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
        not_supported_by_gui      = 22
        error_no_gui              = 23
        others                    = 24.
    WRITE: / 'sy-subrc =', sy-subrc. " error: with active UAC the sy-subrc is 0
    regards,
    Kris

  • How can i get a file header using this method cl_gui_frontend_services= gui

    Hi Experts,
    How can i get a file header using this method cl_gui_frontend_services=>gui_download
    Thanks
    Basu

    Hi,
    You can use the FM - GUI_DOWNLOAD to specify the headers. It can be done in the following manner -
    TYPES: BEGIN OF ty_head, "Structure for header
                 h(10) TYPE c,
                 END OF ty_head.
    DATA: it_head  TYPE TABLE OF ty_head WITH HEADER LINE.
    "Adding header details
    it_head-h = 'Field1'.
    APPEND it_head.
    it_head-h = 'Field2'.
    APPEND it_head.
    it_head-h = 'Field3'.
    APPEND it_head.
    it_head-h = 'Field4'.
    APPEND it_head.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = p_file
       filetype                        = 'ASC'
       write_field_separator           = 'X'
       header                          = '00'  "<= note this
      TABLES
        data_tab                        = it_tab
       fieldnames                      = it_head[] "<= Pass your header table here
    EXCEPTIONS
       OTHERS                          = 1.
    Hope this helps.
    Regards,
    Himanshu

Maybe you are looking for