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: 

cl_gui_frontend_services=>gui_download

former_member184504
Participant

Dear Experts,

I am facing an issue while using the method cl_gui_frontend_services=>gui_download, as it downloads first row as F1 F2 F3 F4 F5 and so on.. which I do not want. Please suggest how can I eliminate it.

Best Regards,

Paavan

9 REPLIES 9

former_member184504
Participant
0 Kudos
CALL METHOD cl_gui_frontend_services=>gui_download
  EXPORTING
    filename                   = file
*    filetype                  = 'DAT'
    filetype                  = 'DBF'
*    append                    = 'X'
    write_field_separator     = ' '
     fieldnames                = int_head[]
  changing
    data_tab                  = it_yes7.

joltdx
Active Contributor

We are going to need more information here, I believe... What do you have in "file"? What do you expect the first line to be? And why? 🙂

(Also 'DBF' is not supported anymore according to class documentation)

former_member184504
Participant
0 Kudos

Hi Jörgen,

Thanks for replying, in FILE I have path where file will be stored

"\\192.168.4.129\RTGS\AXIS\NKPL\NKPL24022021_002.XLS"

Best Regards,

Paavan

former_member184504
Participant
0 Kudos

I do not want

F1 F2 F3 F4 as the data in the excel file. Rest is all good..

Sandra_Rossi
Active Contributor

DBF is made of 3 sections header, fields and rows. If you don't want the whole DBF format then don't use it. Note that the rows are simply aligned fields like that (example for table SFLIGHT), so it's easy to generate that yourself:

100AA 001720180116   422.94USD  747-400   385   369   190593.88   31   28   21   21
100AA 001720180406   422.94USD  747-400   385   372     1668.23   31   30   21   20
...

joltdx
Active Contributor
0 Kudos

This will create a CSV file instead, with all the fields in the it_yes7 table, without the header line:

CALL METHOD cl_gui_frontend_services=>gui_download
  EXPORTING
    filename                   = file
    filetype                  = 'ASC'
    write_field_separator     = ','
  changing
    data_tab                  = it_yes7.

Excel will try to open it if it's named .XLS. Excel will say that it's no Excel file and ask if you still want to open it. If you do it will be fine.

0 Kudos

Hi Jorgen,

It creates a file but if a fields contains zero in front of it then it disappears in the file. I have to retain the zero prefixed to a field.

Best Regards,

Paavan

joltdx
Active Contributor
0 Kudos

I'd say that the leading zeros are most likely in your file, if it's in a char format in the table. But Excel displays them as number, because how would Excel know? 🙂 I'll add a new answer with a new proposal...

joltdx
Active Contributor
0 Kudos

So the functionality in the cl_gui_frontend_services=>gui_download to generate these files is not what you need then. The DBF format is giving you headers and the CSV is not showing leading zeros for numeric fields.

Have a look at abap2xlsx to generate a real excel file, which you will have full control over.