FILE_SAVE_DIALOG

I have a procedure that will write to a csv file and I use the FILE_SAVE_DIALOG function from webutil at the beginning to select a file name and location. If they select a previous file, is there anyway to ask if they want to overwrite or not??? Right now if they select a previous file it will automatically overwrite.

Figured it out, I didn't notice that webutil had a file_exists function till now.

Similar Messages

  • About file_save_dialog and  gui_download

    Hello experts,
    I have made a report wherein I can let the users download the report to their PC. Now, they want it in such a way that they don't have to 'maximize' the width for each column so the data can be read clearly. Also, they want it to be defaulted in excel format.
    below are the codes:
    DATA: file_name TYPE string,
          file_path TYPE string,
          full_path TYPE string,
          act TYPE i,
          var1 TYPE string.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
       CHANGING
        filename = file_name
        path = file_path
        fullpath = full_path
        user_action = act
       EXCEPTIONS
        cntl_error = 1
        error_no_gui = 2
    *NOT_SUPPORTED_BY_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.
      IF act = 0.
        var1 = full_path.
        p_file = var1.
      ENDIF.
    CALL METHOD cl_gui_frontend_services=>gui_download
       EXPORTING
        filename = var1
        filetype = 'ASC'
        write_field_separator = 'X'
       CHANGING
        data_tab = it_download[]
       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.
    Again, thank you guys and take care!

    Hi,
    Check this in that case....
    REPORT  testexcel          .
    INCLUDE ole2incl.
    DATA: application TYPE ole2_object,
           workbook TYPE ole2_object,
           sheet TYPE ole2_object,
           cells TYPE ole2_object.
    CONSTANTS: row_max TYPE i VALUE 256.
    DATA index TYPE i.
    DATA: BEGIN OF itab1 OCCURS 0,
    first_name(10),
    last_name(10),
    END OF itab1.
    START-OF-SELECTION.
    itab1-first_name = '123445'.
    itab1-last_name = 'tesst'.
    append itab1.
    clear itab1.
    itab1-first_name = '123446'.
    itab1-last_name = 'tesst'.
    append itab1.
    clear itab1.
      CREATE OBJECT application 'excel.application'.
      SET PROPERTY OF application 'visible' = 1.
      CALL METHOD OF application 'Workbooks' = workbook.
      CALL METHOD OF workbook 'Add'.
    * Create first Excel Sheet
      CALL METHOD OF application 'Worksheets' = sheet
                                   EXPORTING #1 = 1.
      CALL METHOD OF sheet 'Activate'.
      SET PROPERTY OF sheet 'Name' = 'Sheet1'.
      LOOP AT itab1.
        index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
        CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
        SET PROPERTY OF cells 'Value' = itab1-first_name.
            index = index + 1. " 1 - column name
        CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
        SET PROPERTY OF cells 'Value' = itab1-last_name.
      ENDLOOP.
    * Save excel speadsheet to particular filename
    CALL METHOD OF sheet 'SaveAs'
                      EXPORTING #1 = 'c:tempexceldoc1.xls'     "filename
                                #2 = 1.                          "fileFormat
    Regards
    vijay

  • Disable 'Cancel' button in cl_gui_frontend_services= file_save_dialog...

    Hello Experts,
    Is there a way to disable the 'Cancel' button in method 'FILE_SAVE_DIALOG' of class
    cl_gui_frontend_services? Because in our requirement, the saving of the file is mandatory.
    Thank you guys and take care!

    HI, Viraylab
    Use the Logic Bellow it will solve out your problem, using following you must provide a file name other wise after selecting Cancel button this dialog will appear again.
    PERFORM save_dialog.
    *&      Form  save_dialog
    *       text
    FORM save_dialog.
      DATA: filename TYPE string,
            path TYPE string,
            fullpath TYPE string.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = 'Select File Name'
        CHANGING
          filename             = filename
          path                 = path
          fullpath             = fullpath
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_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.
      IF filename IS INITIAL.
        PERFORM save_dialog.
      ENDIF.
    ENDFORM.                    "save_dialog
    Please Reply if any Issue,
    Best Regards,
    Faisal

  • Update terminated in CL_GUI_FRONTEND_SERVICES= FILE_SAVE_DIALOG

    Hi Guys,
    I am saving Invoice Output type into local PDF file and using CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG to give user the choice where to save the file. It gives an abap short dump "Access not possible using 'NULL' object reference". and update is terminated in the same method.
    I think output types are executing in Update Taks.
    It's working fine when used in other programs(Normal)
    Suggestions are Welcome. Thanks! Vijender
    The code is :
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
        EXPORTING
          WINDOW_TITLE         = 'Save PDF File'
          DEFAULT_EXTENSION    = 'PDF'
          DEFAULT_FILE_NAME    = LV_NAME_INIT
          FILE_FILTER          = '*.PDF'
          INITIAL_DIRECTORY    = 'C:'
         PROMPT_ON_OVERWRITE  = 'X'
        CHANGING
          FILENAME             = LV_FNAME
          PATH                 = LV_PATH_FOLDER
          FULLPATH             = LV_FILE_NAME
        EXCEPTIONS
          CNTL_ERROR           = 1
          ERROR_NO_GUI         = 2
          NOT_SUPPORTED_BY_GUI = 3
          OTHERS               = 4.

    HI, Viraylab
    Use the Logic Bellow it will solve out your problem, using following you must provide a file name other wise after selecting Cancel button this dialog will appear again.
    PERFORM save_dialog.
    *&      Form  save_dialog
    *       text
    FORM save_dialog.
      DATA: filename TYPE string,
            path TYPE string,
            fullpath TYPE string.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = 'Select File Name'
        CHANGING
          filename             = filename
          path                 = path
          fullpath             = fullpath
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_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.
      IF filename IS INITIAL.
        PERFORM save_dialog.
      ENDIF.
    ENDFORM.                    "save_dialog
    Please Reply if any Issue,
    Best Regards,
    Faisal

  • Question for cl_gui_frontend_services= file_save_dialog

    Hi Expert.
    I made simple test page.
    there is nothing but this code in oninitlization
    * event handler for data retrieval
      DATA: ld_filename TYPE string,
            ld_path TYPE string,
            ld_fullpath TYPE string,
            ld_result TYPE i.
    * Display save dialog window
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
    *      window_title      = ' '
          DEFAULT_EXTENSION = 'XLS'
          default_file_name = 'accountsdata'
          INITIAL_DIRECTORY = 'c:temp'
        CHANGING
          filename          = ld_filename
          path              = ld_path
          fullpath          = ld_fullpath
    * Check user did not cancel request
      CHECK ld_result EQ '0'.
    and that shows
    "method:FILE_SAVE_DIALOG ,line : 164
    An attempt was made to execute a dynamic method callon an initial(NULL-) object reference. The reference must refer to an object."
    why this error caught?
    Did I miss something or made mistake BSP code above?
    should I create some object before call cl_gui_frontend_services=>file_save_dialog?
    I don't have any clue on this.
    help me please. thanks .

    Oh yes - this most certainly will not work from BSP.  This class and any other that uses the control framework are written as proxy objects to code that actually executes as part of the SAPGui on the client machine.
    BSP is completly web centric.  Its output can only be ran in a browser.  To the browser the output of BSP doesn't look any different than any other web page that might come from ASP, JSP, PHP, etc. 
    Also because BSP runs in a browser - the amount of interaction that can occur with the client (particularly around file downloads) is somewhat limited. There is no file download element or a file save as dialog object. There are other ways to attach content to an HTTP Response or place it in a hidden iFrame - the browser is then responsible for intrepting this information and offering the file save as or open dialog based upon the appropriate MIME Type. 
    This weblog is the primer on BSP downloads written by the Jedi Master himself:
    <a href="/people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents:///people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents
    If you search you will find other examples in the older BSP weblogs as well.

  • CALL METHOD cl_gui_frontend_services= file_save_dialog

    Hi,
    I want to use 'CALL METHOD cl_gui_frontend_services=>file_save_dialog', to choose a path for saving my txt files.  I only want the user to be able to choose the path and not have to supply a filename aswell.  My filenames are standard in the program and I don't want them to be changed by the user.
    Is there another method which is designed for this or is there a simple parameter I have missed?
    Thanks and regards,
    Simon.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_f.
       PERFORM f_search_help_pa_f1.
    FORM f_search_help_pa_f1 .
       CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
         EXPORTING
           program_name  = sy-repid
           dynpro_number = sy-dynnr
         CHANGING
           file_name     = pa_f
         EXCEPTIONS
           mask_too_long = 1
           OTHERS        = 2.
       IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    ENDFORM.                    " f_search_help_pa_f1
    Try this
    Regards

  • APPEND cl_gui_frontend_services  file_save_dialog

    Hi,
    with old functions DOWNLOAD it was possible to append a file to an existing,
    how can I do this using method file_save_dialog of the class cl_gui_frontend_services?
    Please help me!
    Thanks
    Lara

    Hello Lara,
    file_save_dialog doesn't have this option but gui_download from cl_gui_frontend_services has it (append).
    Regards, Martin

  • Cl_gui_frontend_services= file_save_dialog?

    Hi All,
    Im trying to use the below method, what are all the parameters need to fill and hw to declare those parameters.
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
       WINDOW_TITLE         =
       DEFAULT_EXTENSION    =
       DEFAULT_FILE_NAME    =
       FILE_FILTER          =
       INITIAL_DIRECTORY    =
       WITH_ENCODING        =
       PROMPT_ON_OVERWRITE  = 'X'
      CHANGING
        filename             =
        path                 =
        fullpath             =
       USER_ACTION          =
       FILE_ENCODING        =
    EXCEPTIONS
       CNTL_ERROR           = 1
       ERROR_NO_GUI         = 2
       NOT_SUPPORTED_BY_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.
    Puppy.

    Hi ,
    copy this code and try this , after executing this code ypu will get the path into  "  lv_fullpath " .
    and then pass this lv_fullpath to next function module like gui_download .
      DATA:   v_name  TYPE string,
              v_file  TYPE rlgrap-filename,
              lv_filename    TYPE string,
              lv_filen       TYPE string,
              lv_path        TYPE string,
              lv_fullpath    TYPE string.
    *  MOVE v_name TO lv_filename.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
    *     WINDOW_TITLE         =
    *     DEFAULT_EXTENSION    =
    *    default_file_name    = lv_filename
    *     WITH_ENCODING        =
    *     FILE_FILTER          =
    *     INITIAL_DIRECTORY    =
    *     PROMPT_ON_OVERWRITE  = 'X'
        CHANGING
          filename             = lv_filen
          path                 = lv_path
          fullpath             = lv_fullpath
    *     USER_ACTION          =
    *     FILE_ENCODING        =
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_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.
    Regards,
    Aby.

  • Cl_gui_frontend_services= file_save_dialog - how to admit JUST .txt ext

    hi all, i'm using the: cl_gui_frontend_services=>file_save_dialog class and method..
    My question, how can i do for RESTRICT the file extension of the file JUST to '.txt' ?? if the user select the name of the file to create to 123.pdf -for example- that the system don't let him to continue, or just add the txt extension to the final of the filename.. -like 123.pdf.txt ??
    Thanks!!

    Hi Pampeano,
    i I have  created a small code snippet :-
    LV_FILENAME TYPE STRING,
    LV_FULLPATH TYPE STRING,
    LV_PATH TYPE STRING,
    LV_ACTION TYPE I,
    LV_FILE TYPE STRING,
    DEFAULT_EXTENSION TYPE STRING.
    if DEFALUT_EXTENSION  ne 'TXT'.
    eRROR ........
    ENDIF.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
    EXPORTING
    WINDOW_TITLE = 'Please select the location'
    DEFAULT_EXTENSION = DEAFAULT_EXTENSION
    DEFAULT_FILE_NAME = LV_FILE
    FILE_FILTER = '*.TXT'
    CHANGING
    FILENAME = LV_FILENAME
    PATH = LV_PATH
    FULLPATH = LV_FULLPATH
    USER_ACTION = LV_ACTION
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    OTHERS = 3.
    Regards
    Abhii
    Edited by: Abhii on Aug 17, 2010 7:44 AM
    Edited by: Abhii on Aug 17, 2010 7:44 AM
    Edited by: Abhii on Aug 17, 2010 7:44 AM
    Edited by: Abhii on Aug 17, 2010 7:46 AM

  • Question on cl_gui_frontend_services= file_save_dialog

    Hi all,,,  need your help.. thank you i n ad vance ..
    why ist tht happen?  the default extension, 'txt'
    but  the "save as type" in the dialog box  shows 'XLS', excel file ??
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title      = 'Save file to'
          DEFAULT_EXTENSION = 'txt'
          default_file_name = v_filename
          INITIAL_DIRECTORY = 'c:\'
        CHANGING
          filename          = t_file
          path              = ld_path
          fullpath          = ld_fullpath
          user_action       = ld_result.

    you can do in this way....
    in this case default is 'XLS' and he can choose all the files.
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title      = l_title
          default_extension = 'XLS'
          file_filter       = ' '
        CHANGING
          fullpath          = l_fullpath
          path              = l_path
          filename          = l_filename
        EXCEPTIONS
          OTHERS            = 1.
    Regards
    Vijay

  • WEBUTIL FILE_SAVE_DIALOG BUG

    This is more untested code than a bug.
    I am using WEBUTIL_FILE.FILE_SAVE_DIALOG in my form to download a file from the database onto client machine.
    When the file dialog comes up and the user clicks on a directory to save to, the File Name field gets replaced with the directory name. In other words, file dialog assumes that the user wants to rename the file as "Desktop". Instead of saving the file (say photo.gif) into c:\...\Desktop\photo.gif, it creates a file called "Desktop". In the windows environment, the File Name field does not change with every click of the button. Does anyone have a workaround to stop the File Name field from changing when the user clicks on a directory?
    Thanks.
    kh

    this is a "bad" behaviour, but actually it is.
    Years ago I think, there were the same limitations in d2kwutil. Other non-oracle-tools have the same problem. I'm sure, that this will be corrected in the next versions.
    Gerd

  • Webutil_file.file_save_dialog

    i use
    webutil_file.file_save_dialog(null,fileName,null,'Save')
    i save a document from db to client.
    the fileName i read from the database.
    when i open the file_save_dialog the fileName is displayed as default. but when i want to save it somewhere else by browsing the filesystem, the filename is lost.
    whick means: when clicking a folder in the file_save_dialog the filename-field becomes the directory-name.
    is this normal? how can i keep the filename in the filename-field in a file_save_dialog?

    This is actually an underlying bug in Java - it's fixed in Java 1.4 so when you go to that version you'll get it for free.

  • Selection screen : matchcode on RYEAR and also question on FILE_SAVE_DIALOG

    Hiii
    Question 1 -->
    i have on the selection screen a parameter of type RYEAR i check in database and theere is no matchcode attach to it.
    can you please advise whether there is a standard matchcode i can used or am i missing something?
    Question 2 -->
    And also on my selection screen i have 2 parameter
    P_path type string
    P_name type string
    on the P_path we need to put the directory name and also implement a F4 where user can browse the directory.   On the p_name we will put the file name
    have done somwthing like that.  sorry i don't remember the exact name?
    at selection screen on value request p_path
    call method cl_xxxxx-file_save_dialogue
    the problem is that the FILE_SAVE_DIALOGUE i must enter the a file name on the pop-up before clicking on save,
    I don't want an F4 of P_PATH i want to only the browse directory path not save. can you please advise if there are another method for that?

    Check this code;
    PARAMETER: p_path TYPE char50,
                                   p_name TYPE char50.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
      DATA: lv_path TYPE string.
      lv_path = p_path.
      CALL METHOD cl_gui_frontend_services=>directory_browse
        EXPORTING
    *      window_title         = 'Jay'
          initial_folder       = lv_path
        CHANGING
          selected_folder      = lv_path
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
      p_path = lv_path.

  • Save file without FILE_SAVE_DIALOG

    Hi experts!
    I need to download a massive amount of files to a single folder and i don't want the dialog apear each time.
    Is there a way to perform by myself the save_file_dialog?
    I have the source path and the destination path.. what should i do next?
    (All the files are fom DMS if it's help on the answer)
    Thanks,
    Maor

    Hi,
    do you use gui_download function.
    you can just give the specific path and you wont need dialog.
    Best Regards,
    Burak

  • 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

Maybe you are looking for

  • Apps crash whenever I try to print

    Hi, My office computer is an iMac with a 1.83 GHz intel core duo processor, running OSX 10.4.11 and using an HP Color LaserJet 2605dn printer. In the last month or so, whenever I try to print from any app - Preview, Reader, Firefox, or Word - the pro

  • Transaction code: Reversal of Dunning run?

    In SAP help: http://help.sap.com/erp2005_ehp_03/helpdata/EN/45/fe26de40dc41b2e10000000a11466f/frameset.htm You can use menu Periodic Processing ® For Contract Accounts ® Dunning ® Mass Reversal of Dunning Notices. I can not find this transaction code

  • Auto populating the Date/Time Field in a Column

    I'm having an issue with the a Date and Time Column type auto populating the current date and time correctly.  I've put the =Now() function in the calculated value box.  I get the correct date and I get a time but the time is wrong,  its on Pacific T

  • Keep getting "Sync encountered an error while syncing" message

    It says "Incorrect account name or password. Sync will automatically retry this action." I can't seem to access the Sync tab on options to try to re-enter my username and password. Also when I go to "Reconnect to Sync" I get a blank page.

  • Unable to run Cache Factory JVM instance throws Missing POF config xml file

    I have configured three JVM instances in Eclipse using Run Configurations Menu - JUnit JVM -Default Cache Server JVM -Cache Factory JVM The configurations of Default Cache Server are Main Class : com.tangosol.net.DefaultCacheServer Arguments: -Dtango