Application Development 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: 

How to eliminate additional row with header like F1, F2 in excel file when using gui_download

Former Member
0 Kudos

Hi expert,

We are facing problem to remove the unwanted header, i.e. F1, F2, etc...' which is automatic appear when we downloaded the file into excel format using GUI_DOWNLOAD with file type 'DBF'. The reason we use 'DBF' format is to retain the leading zero in one of the fields downloaded and ensure the records are printed line by line. It is also a requirement that the file must be in .xls or .csv format, text format is not allowed.

The number of records appended to the internal table is correct, i.e. 2 but when we open the file it shows 3 with header in first line. If we delete the index 1 from internal table, the no. of record become 1, which is not right.

We tried to search the post from other users but can't find a final anwer or solution on it. We don't want to amend the file manually because it consists of sensitive data and it should be automatically downloaded to a designated location with the desired format and retrieved by another party.

Could anyone kindly help asap?

Thanks in advance.

Regards,

PCG

2 REPLIES 2

Former Member
0 Kudos

Hi,

If you know some tips and tricks or sample, could you please share with me?

Thanks.

Regards,

PCG

0 Kudos

Hi PCG,

if you create a dBase .dbf file and want to import it to excel, you will always get those unwanted header lines. The only thing you can doe is to keep that line empty. Sample:

REPORT  z_dl_test.

TYPES: BEGIN OF ty_mat,

         matnr TYPE matnr,

         mtart TYPE mtart,

       END   OF ty_mat.

DATA: it_mat TYPE TABLE OF ty_mat.

DATA: it_fnm TYPE TABLE OF fieldname_type.

START-OF-SELECTION.

  APPEND  SPACE                    TO  it_fnm.

  APPEND  SPACE                    TO  it_fnm.

  SELECT *                       FROM  mara

                                 INTO  CORRESPONDING FIELDS

                                   OF  TABLE  it_mat

                                   UP  TO 50  ROWS

  ORDER                            BY  matnr.

  CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

      filename                      =  'D:\temp\test.dbf'

      filetype                      =  'DBF'

    TABLES

      data_tab                      =  it_mat

      fieldnames                    =  it_fnm

    EXCEPTIONS

      OTHERS                        =  0.

Regards,

Klaus