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

Similar Messages

  • 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

  • Server path not drive CL_GUI_FRONTEND_SERVICES= FILE_OPEN_DIALOG

    Hi folks
    When using the CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG or WS_FILENAME_GET we some times have the server path returned.
    And sometimes the drive letter returned.
    See two examples:
    1: \\blrx1\os390out\id1\test.txt
    2: R:\os390out\id1\test.txt
    What to do when we ALWAYS want the server path returned??
    Best regards
    Carsten

    I have used this several times in my own coding and I always get the \\
    in my end result
    method import_the_file_locn.
      data:
        lv_wintitle type string value 'Select Upload File',
        lv_deffile type string value 'asset_data',
        lv_dir type string value 'c\:',
        ls_file type line of filetable,
        lv_rc type i,
        lv_user_action type i.
      free gv_sdir.
      call method cl_gui_frontend_services=>file_open_dialog
        exporting
          window_title            = lv_wintitle
          default_filename        = lv_deffile
          initial_directory       = lv_dir
        changing
          file_table              = gt_file
          rc                      = lv_rc
          user_action             = lv_user_action
        exceptions
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          others                  = 4.
      check lv_user_action is initial.
      read table gt_file into ls_file index 1.
      translate ls_file to lower case.
      gv_sdir = ls_file.
    endmethod.
    I don't know whether it is perhaps a mapping issue / windows setting that results in the path returned with the mapped drive?
    I just debugged one of methods above and I cant recreate the same issue when I pick up a file in a mapped directory, sorry.
    I guess there is also the option for you to do some substring manipulation and path mapping in a look up table - but if you have hundreds of servers rather than a few maybe not the best workaround.

  • File extension for: cl_gui_frontend_services= file_open_dialog

    Hello,
    I would like to set the file extension for cl_gui_frontend_services=>file_open_dialog such that my default extension in the file open dialogue is the .csv (comma-separated value) file. May I know how can I do that?
    Thanks!
    Regards,
    Anyi

    Hello,
    Thanks for the quick reply.
    Howeer, I tried to use the extension of CSV and the file dialogue opened up with .RTF (which is the default extension) instead.
    Any comment on that?
    Thanks!
    Anyi
    > HI,
    >
    > Here is the code
    >
      DATA:  l_title TYPE string,
    >          l_dfext TYPE string,
    > l_dfinm TYPE string,
    >          l_file  TYPE string,
    > l_path  TYPE string,
    >          l_fpath TYPE string.
    > le = 'SAVE FILE PATH'.
    >   l_dfext = 'csv'.
    > l_dfinm = 'Error_Idoc'.
    >
    > CONCATENATE l_dfinm sy-datum sy-uzeit INTO l_dfinm
    >  SEPARATED BY '_'.
    >
    > CONCATENATE  l_dfinm l_dfext INTO l_dfinm SEPARATED
    >  BY '.'.
    >
    > CALL METHOD
    >  cl_gui_frontend_services=>file_save_dialog
    >    EXPORTING
    >    window_title      = l_title
    >    default_extension = l_dfext
    >    default_file_name = l_dfinm
    >     INITIAL_DIRECTORY = L_DIR
    > CHANGING
    >       filename          =  l_file
    > path              =  l_path
    >       fullpath          =  l_fpath
    > CEPTIONS
    >       cntl_error        = 1
    > error_no_gui      = 2
    >       OTHERS            = 3.
    > s,
    > Richa

  • CL_GUI_FRONTEND_SERVICES= FILE_OPEN_DIALOG

    Hi Experts,
    I have a customized program with BDC. first My program will convert a .dbf file into .xls file. My second program executes the .xls file.
    The .xls file that I get from my first program will be transferred into a textbox in my second program.
    But my second program is using CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG to execute a command. If you just enter the directory/path in the textbox it wont execute but if you use f4 the program will successfully be executed.
    I have put my method in AT SELECTION-SCREEN. so that when I use the bdc it will automatically read the path BUT the dialogbox still appear.
    How can I make the dialog box disappear but still it will execute the method ?
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
        exporting
          default_filename        = cv_fname "'C:\USERS\Asd\DESKTOP\RATRA.XLS'
        CHANGING
          FILE_TABLE              = t_files
          RC                      = v_rcode
        EXCEPTIONS
             file_open_dialog_failed = 1
             cntl_error              = 2
             error_no_gui            = 3
             OTHERS                  = 4.

    Hi Jepoy,
    You can set the result of the save button which is action_ok in a variable. So when u execute the same code again, just pass this below method call.
    IF lv_result = cl_gui_frontend_services=>action_OK.
             RETURN.
           ENDIF.
    Regards,
    Sivaganesh

  • CL_GUI_FRONTEND_SERVICES= FILE_OPEN_DIALOG causes SAPGUI to crash

    Hi,
    When I try to select a file to download or upload an LSMW project my SAP GUI freezes completely, and the only way out is to kill it via Windows task manager.
    After quite some research I found out that:
    - This happens only on some PC's (but all PC's have the same SAP GUI version, i.e . 7.10)
    - When I debug this I see that the issue happens somewhere within CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    - The default folder passed to that method is C:\. If I change it to something else (in debug change mode), everything goes well
    Anybody experienced this before?
    Thanks
    Patrick

    Hi Jepoy,
    You can set the result of the save button which is action_ok in a variable. So when u execute the same code again, just pass this below method call.
    IF lv_result = cl_gui_frontend_services=>action_OK.
             RETURN.
           ENDIF.
    Regards,
    Sivaganesh

  • Error when using the method cl_gui_frontend_services= file_open_dialog

    Hello Experts,
    I am currently practicing BDC and I think the first step is to locate where my text file is. Now based on my code below, after selecting my text file nothing happens.
    Also, what will be my next after getting the file from a specific location? Thanks guys!
    REPORT  z_aris_practice_bdc_0
            NO STANDARD PAGE HEADING
            LINE-SIZE 255
            LINE-COUNT 64
            MESSAGE-ID zz.
    *BDC Data
    DATA: BEGIN OF bdc_tab OCCURS 0.
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdc_tab.
    *Internal Table
    DATA: BEGIN OF it_input OCCURS 0,
             user     TYPE usr02-bname,
             title    TYPE sza5_d0700-title_medi,
             lname    TYPE addr3_data-name_last,
             fname    TYPE addr3_data-name_first,
             initials TYPE addr3_data-initials,
             nickname TYPE addr3_data-nickname,
             function TYPE addr3_data-function,
          END OF it_input.
    DATA: gt_lines TYPE sy-tabix,
          gt_file  TYPE filetable,
          wa_file  TYPE filetable,
          gt_subrc TYPE i.
    *CONSTANTS
    CONSTANTS: c_mask(60) TYPE c  VALUE ',..'.
    *Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_input LIKE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_input.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
       WINDOW_TITLE            =
       DEFAULT_EXTENSION       =
       DEFAULT_FILENAME        =
       FILE_FILTER             =
          initial_directory       = 'C:\Temp\'
          multiselection          = 'X'
        CHANGING
          file_table              = gt_file[]
          rc                      = gt_subrc
       USER_ACTION             =
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          OTHERS                  = 4.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM put_in_itab.
      PERFORM process_records.
    *&      Form  get_files
          text
    FORM put_in_itab.
      DATA: lv_file TYPE string.
      lv_file = p_input.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = lv_file
        FILETYPE                      = 'ASC'
         has_field_separator           = 'X'
        HEADER_LENGTH                 = 0
        READ_BY_LINE                  = 'X'
        DAT_MODE                      = ' '
        CODEPAGE                      = ' '
        IGNORE_CERR                   = ABAP_TRUE
        REPLACEMENT                   = '#'
        CHECK_BOM                     = ' '
        VIRUS_SCAN_PROFILE            =
        NO_AUTH_CHECK                 = ' '
      IMPORTING
        FILELENGTH                    =
        HEADER                        =
        TABLES
          data_tab                      = it_input
       EXCEPTIONS
         file_open_error               = 1
         file_read_error               = 2
         no_batch                      = 3
         gui_refuse_filetransfer       = 4
         invalid_type                  = 5
         no_authority                  = 6
         unknown_error                 = 7
         bad_data_format               = 8
         header_not_allowed            = 9
         separator_not_allowed         = 10
         header_too_long               = 11
         unknown_dp_error              = 12
         access_denied                 = 13
         dp_out_of_memory              = 14
         disk_full                     = 15
         dp_timeout                    = 16
         OTHERS                        = 17
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        DESCRIBE TABLE it_input LINES gt_lines.
      ENDIF.
    ENDFORM.                    "get_files
    *&      Form  process_records
          text
    FORM process_records.
      LOOP AT it_input.
      ENDLOOP.
    ENDFORM.                    "process_records

    Hii viraylab,
    go throgh this link..This sample code solves ur problem....
    /people/milind.upasani/blog/2007/03/07/step-by-step-approach-to-ceate-simple-bdc-session-program-using-reusable-template
        U are new to BDC it seems...
        first u read the sap help ... then u will come know what to do after wards....
        http://help.sap.com/saphelp_47x200/helpdata/en/fa/097720543b11d1898e0000e8322d00/frameset.htm
    Be familiar with the structure BDCDATA.
    <b>Data transfers</b>  In this page..
    Next u need to know about the <b>transaction RECORDER the tcode is SHDB.</b>
    Nothing is difficult in this ..
    For example When u r creating a data element in SE11 u go through some screens in a flow, by clicking some pushbuttons and by generating some function codes manually, and entering values manually...
    But here u wont do it manually, these values will be populated from file into an internal table...
    Before calling a transaction into which u r going to populate the data is to be filled into a table with structure <b>BDCDATA.</b>
    <b>U need to use CALL TRANSACTION 'SE11' using BDCDATA or
    the session method..</b>
    Reward points for helpful answers...
    sai ramesh

  • Pop up coming twice while using CL_GUI_FRONTEND_SERVICES= FILE_OPEN_DIALOG

    Hello All,
      I am calling the method FILE_OPEN_DIALOG of the class CL_GUI_FRONTEND_SERVICES to display the pop up to select the file from the desktop.After i select the file and execute the program it displays the report and when i clcik the back button it gives me the pop up again.I have used  CALL METHOD CL_GUI_CFW=>FLUSH.Inspite of this it is not working properly.
    Thanks,
    Rakesh.

    Try This.....
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR F_PATH.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
      CHANGING
        file_table              = file
        rc                      = rtrncode
      EXCEPTIONS
        file_open_dialog_failed = 1
        cntl_error                   = 2
        error_no_gui               = 3
        not_supported_by_gui = 4
        others                        = 5

  • Upgradtion doubt in calling cl_gui_frontend_services= file_open_dialog

    hi,
        Im upgrading from 4.5b to ecc 6.0 in the following code the export parameter  Default extn parameter in the call method
    cl_gui_frontend_services=>file_open_dialog does not get displayed
    i,e *.xls should be there bydefault it is not there in 6.0 how to get it. check the code once
    ws_filename get fm is in comments
    CALL FUNCTION 'WS_FILENAME_GET'
          EXPORTING
               DEF_FILENAME     =  C_DEFFILE
               DEF_PATH         = L_LOCFILE
               MASK              = C_MASK
               MODE             = C_MODE
          IMPORTING
               FILENAME         = L_FILE
          EXCEPTIONS
               INV_WINSYS       = 1
               NO_BATCH         = 2
               SELECTION_CANCEL = 3
               SELECTION_ERROR  = 4
               OTHERS           = 5.
    IF SY-SUBRC EQ 3.
       MESSAGE I999 WITH 'Action Cancelled by user'(044).
       EXIT.
    ENDIF.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
      EXPORTING
        DEFAULT_EXTENSION        = '*.xls,'
        FILE_FILTER              = '.'
      CHANGING
        file_table               = W_FILENAME
        rc                       = w_rc
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5.
    IF W_RC IS NOT INITIAL.
       READ TABLE W_FILENAME INTO W_AREA INDEX 1.
    IF SY-SUBRC = 0.
       L_FILE = W_AREA-FILENAME.
    ENDIF.
    ENDIF.

      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = 'File Selection'
          default_filename        = '*.xls'
          file_filter             = '(*.xls)|*.XLS|'
        CHANGING
          file_table              = lt_filetable
          rc                      = lv_filecount
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          OTHERS                  = 5.

  • Exceptions in  cl_gui_frontend_services= file_open_dialog

    hi when upgrading from 4.5 to 6.o Im getting the following exception
    When the pop up box is cancelled during the download option, a success message is displayed in 6.0 whereas an error message is displayed in 4.5.
    here is the code
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
      EXPORTING
        DEFAULT_EXTENSION        = '*.xls,'
        DEFAULT_FILENAME         = '*.xls,'
        FILE_FILTER              = '.'
      CHANGING
        file_table               = W_FILENAME
        rc                       = w_rc
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5.
    IF W_RC IS NOT INITIAL.
       READ TABLE W_FILENAME INTO W_AREA INDEX 1.
    IF SY-SUBRC = 0.
       L_FILE = W_AREA-FILENAME.
    ENDIF.
    ENDIF.
      IF SY-SUBRC EQ 3.
        MESSAGE I999 WITH 'Action Cancelled by user'(044).
        EXIT.
      ENDIF.
    plz tell me where is the eror

    chk the data declearsation data type.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = 'Import from a local file'
          default_extension       = 'DAT'
         DEFAULT_FILENAME        =
          file_filter             = l_file_filter
          initial_directory       = 'C:\'
         MULTISELECTION          =
         WITH_ENCODING           =
        CHANGING
          file_table              = l_file_table
          rc                      = l_rc
         USER_ACTION             =
         FILE_ENCODING           =
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          OTHERS                  = 5
          CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
            EXPORTING
              FILENAME                = V_FILE
              FILETYPE                = 'ASC'
              WRITE_FIELD_SEPARATOR   = 'X'
            CHANGING
              DATA_TAB                = IT_MAIN[]
            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
              OTHERS                  = 23.
          IF SY-SUBRC <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.

  • 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.

  • 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

  • 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

  • Equivalent WD method for file_open_dialog

    Hello,
    What is the equivalent method in WD ABAP for cl_gui_frontend_services=>file_open_dialog (to specify the path of a file in a pop-up)?
    I have a requirement wherein i want to specify the path in which a file will be saved in the local system. I call the method ATTACH_FILE_TO_RESPONSE to save a file, but it doest gives me a path as such.
    Best Regards,
    Seshadri

    Both ATTACH_FILE_TO_RESPONSE  and fileDownload are the recommended methods to trigger download to the frontend.  They work a little differently than the old CL_GUI_FRONTEND_SERVICES becuase they are running within a browser and have to deal with a different security and interaction model for file downloads. With the ATTACH_FILE_TO_RESPONSE, the MIME type and the corresponding configuration on the client workstation control if the file gets the save dialog box or if it opens immediately.
    The fileDownload UI element has a behaviour property that helps you to influence the way the download is handled on the client side.
    The ACFUpDownload UI element is new in 7.01.  However on that release level it won't help you with this requirement because it doesn't support a file dialog yet.  That option won't be added until 7.02.

  • How to replace ws_filename_get function module to file_open_dialog

    how to replace ws_filename_get function module to file_open_dialog

    Here it is,
    DATA: i_file_name TYPE FILETABLE,
          w_file_name TYPE FILE_TABLE,
          v_rc TYPE i.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
      EXPORTING
        INITIAL_DIRECTORY       = 'C:\'
      CHANGING
        file_table              = i_file_name
        rc                      = v_rc
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        others                  = 4.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE i_file_name INTO w_file_name INDEX 1.
    No wthe w_file_name will contain the file name.
    Regards
    Kathirvel

Maybe you are looking for

  • Opatch lsinventory  command not working

    Hello  everyone ; DB  VERSION : 10.2.0.4.0 OS : OEL 5.5 Where  can i get installed patch details  on my database ? $ pwd /u01/app/oracle/product/10.2.0/db_1/OPatch $ opatch lsinventory bash: opatch: command not found opatch lsinventory -details bash:

  • Unnable to create SAVE_VIEW button in WAD vers 7.01

    Hi All I'm trying to create a button "Save View" with a command SAVE_VIEW in my WAD application. I would like that it works in the same way like in 3.5 Version (standard AdHoc Web Template). But this function doesn't work in my BI version 7.01 SP6. F

  • How to do checkbox selection

    can ne one tell me what trigger should be used on selection of check box items

  • For loop stops iterating at first page

    I have a loop that applies a paragraph style but it stops iterating at the first page of the document. I need it to apply the style to the entire document...can't figure out why this isn't working. Here is my script: var myDocument = app.activeDocume

  • I, like many other users, cannot install Google toolbar. It won't install!

    As soon as I updated Firefox to the latest version, the one I am using now, I downloaded Google toolbar for Windows 7; however, when I tried to install it just would not install due to incompatibility issues. I did a research on the Web regarding the