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: 

regarding header proble in FM GUI_download.

Former Member
0 Kudos

Hi,

I want to write header in XL file by using the paramter fieldnames, but the FM is not considering full text what i m giving ,

please see the below code

*

*To download

DATA : BEGIN OF t_header OCCURS 0,

name(100) TYPE c,

END OF t_header.

DATA : BEGIN OF itab OCCURS 0,

fld1(100) TYPE c,

fld2 TYPE char10,

fld3 TYPE char10,

END OF itab.

DATA: v_pass_path TYPE string.

itab-fld1 = 'Hi'.

itab-fld2 = 'hello'.

itab-fld3 = 'welsuresh'.

APPEND itab.

CLEAR itab.

itab-fld3 = 'welcome'.

APPEND itab.

t_header-name = 'Field1 for sure and ucb and acc'.

APPEND t_header.

t_header-name = 'Field2'.

APPEND t_header.

t_header-name = 'Field3'.

APPEND t_header.

v_pass_path = 'P:\Suresh\UCB\Incidents\INC - sanjay - pooja\File from pooja\suresh.xls'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = v_pass_path

filetype = 'DBF' " This is important

*for XL download

APPEND = 'X'

  • WRITE_FIELD_SEPARATOR = 'X'

header = '00'

  • TRUNC_TRAILING_BLANKS = ' '

WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = 'X'

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • 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 = itab

fieldnames = t_header.

thanks,

Suresh

2 REPLIES 2

former_member705122
Active Contributor
0 Kudos

Hi Suresh,

Try to replicate through this code,

TABLES: sflight.

DATA:

BEGIN OF t_sflight OCCURS 0,

carrid TYPE sflight-carrid,

connid(5) TYPE c,

fldate TYPE sflight-fldate,

seatsmax TYPE sflight-seatsmax,

seatsocc TYPE sflight-seatsocc,

END OF t_sflight.

DATA:

BEGIN OF t_header OCCURS 0,

header(50) TYPE c,

END OF t_header.

PARAMETERS: p_carr TYPE sflight-carrid.

*DATA: t_sflight TYPE TABLE OF sflight WITH HEADER LINE.

SELECT carrid connid fldate seatsmax seatsocc

FROM sflight

INTO TABLE t_sflight

WHERE carrid = p_carr.

t_header-header = 'Carrid'.

APPEND t_header.

t_header-header = 'Connid'.

APPEND t_header.

t_header-header = 'Fldate'.

APPEND t_header.

t_header-header = 'Max'.

APPEND t_header.

t_header-header = 'Min'.

APPEND t_header.

LOOP AT t_sflight .

WRITE: / t_sflight-carrid,

t_sflight-connid,

t_sflight-fldate,

t_sflight-seatsmax,

t_sflight-seatsocc.

ENDLOOP.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\My Documents\temp\test.xls'

filetype = 'DAT'

TABLES

data_tab = t_sflight

fieldnames = t_header.

Regards

Adil

0 Kudos

hi,

ur header text is short.. try to give some 40 characters u dont get full header text ur trying to append..

Thanks for the reply.. tell if we can do some otherway..

thanks,

Suresh