Application Development and Automation 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: 
Read only

Header in Excel

Former Member
0 Likes
602

Hi Masters!!

I know this is simple to you all but im having a problem in downloading my summary report in excel. the header doesnt appear in excel only the item data.

could someone here help me.tnx.points will be given. I have 40 fields and not all of them are in type c.

Hi Masters!!

I know this is simple to you all but im having a problem in downloading my summary report in excel. the header doesnt appear in excel only the item data.

could someone here help me.tnx.points will be given. I have 40 fields and not all of them are in type c.

4 REPLIES 4
Read only

gopi_narendra
Active Contributor
0 Likes
566

Use the FM : GUI_DOWNLOAD

Check this sample code


    IT_HEADING-TEXT = 'Company Code'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'RFQ Number'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'RFQ Line Item'.
    append IT_HEADING.
    ................
    " You can fill in as many field headings

    call function 'GUI_DOWNLOAD'
      exporting
        FILENAME                = L_FNAME
        FILETYPE                = 'DAT'
      tables
        DATA_TAB                = IT_FINAL
        FIELDNAMES              = IT_HEADING
 " the parameter FIELDNAMES should be used to create the heading

Regards

Gopi

Read only

0 Likes
566

How would I declare it_heading?

I declare it as gv_heading type c.

there's an error that occur.

The data object "GV_HEADING" has no structure and therefore no

component called "TEXT". called "TEXT".

Pls. Reply

Read only

Former Member
0 Likes
566

Hi,

Using GUI_DOWNLOAD doesnt download header automatically.

You need to build the logic for the same.

Pass all the HEADER TEXTS to a internal table i_header1 & call gui_download.

  • ASSIGN PATH FOR FILE DOWNLOAD

l_file = par_unix1.

IF NOT i_header1 IS INITIAL.

  • DOWNLOAD DATA TO PRESENTATION SERVER

CALL FUNCTION <b>'GUI_DOWNLOAD'</b>

EXPORTING

  • BIN_FILESIZE =

filename = l_file

filetype = 'ASC'

  • append = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

codepage = '8400'

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = i_header1

  • FIELDNAMES =

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.

If not i_item[] is initial.

  • DOWNLOAD DATA TO PRESENTATION SERVER

CALL FUNCTION <b>'GUI_DOWNLOAD'</b>

EXPORTING

  • BIN_FILESIZE =

filename = l_file

filetype = 'ASC'

<b> append = 'X'</b>

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

codepage = '8400'

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = i_item

  • FIELDNAMES =

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.

endif.

ENDIF.

Read only

Former Member
0 Likes
566

hi

good

when you r downloading your summary report into the excel select

list->export->Spreadsheet

than you save it in excel format,it ll display the header in the excel sheet,if you dont have header in your report output than it wont display in the excel sheet.

thanks

mrutyun^