Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

GUI_DOWNLOAD - fieldnames does not exist

Hi All,

I have managed to sort out the format of my question, so I have closed the other post and started a fresh

I am wondering if you can help in anyway, I am trying to create a datafile and dump it to a PC, so far I use the cl_gui_frontend_services=>file_save_dialog to allow the user to specify the file location and this does indeed create the file, what I really need are column heading added to the file.

I have search around and it seems that I have to pass FIELDNAMES to cl_gui_frontend_services=>gui_download.

I have created the headers and insterted the field FIELDNAMES but get an error saying :

Formal Parameter FIELDNAMES does not exist.

Also I really need the fieldnames to be created by myself as a couple of the column types are the same and that would confuse the users.

Here is the code I use.

TYPES: BEGIN OF t_fieldnames_structure, " Structure for table of internal fieldnames
            col_text(10) TYPE c,
        END OF t_fieldnames_structure.

        DATA: lw_filename    TYPE string, " For file_save_dialog to store the filename
              lw_path        TYPE string, " For file_save_dialog to store the filepath
              lw_fullpath    TYPE string, " For file_save_dialog to store the full path
              lw_save_result TYPE i,      " For file_save_dialog to store the user input, cancel, save.....
              li_fieldnames  TYPE TABLE OF t_fieldnames_structure, " Internal table for the fieldnames
              lwa_fieldnames LIKE LINE OF li_fieldnames.           " Work area for the fieldnames internal table

         lwa_fieldnames-col_text = 'MATNR'.
         APPEND lwa_fieldnames TO li_fieldnames.

         " Display the file save dialog
                window_title         = 'Data unload'
                default_extension    = 'TXT'
                default_file_name    = 'GLD-datadump'
                initial_directory    = 'c:\temp\'
                filename             = lw_filename
                path                 = lw_path
                fullpath             = lw_fullpath
                user_action          = lw_save_result
         IF sy-subrc <> 0.

         IF lw_save_result = 0.
         " User wants the data to be saved
             " Write the file to the desired destination
                     filename                  = lw_filename
                     filetype                  = 'DAT'
                     write_field_separator     = 'X'
                    data_tab                  = i_simulation_structure
                    fieldnames                = li_fieldnames
                     file_write_error          = 1
                     others                    = 24
             IF sy-subrc <> 0.
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

         ENDIF. " User wants the data to be saved

If you have any ideas how I can achieve this it would be great.

Thanking you in advance


Former Member
Not what you were looking for? View more on this topic or Ask a question