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: 

downloading to excel problem

Former Member
0 Kudos

Hi,

im trying to output my internal table contents to an excel spreadsheet. i used set pf-status so that an icon shows up on the application tool bar and its working fine and triggers the xxl_simple_api FM TOO. however, im not getting any output on the excel spread sheet.please help me out. i attached the code below.

regards,

ravi.

DATA :

it_online LIKE gxxlt_o OCCURS 0 WITH HEADER LINE,

it_print LIKE gxxlt_p OCCURS 0 WITH HEADER LINE.

header-col_no = 1.

header-col_name = 'FIELD1'.

APPEND header.

header-col_no = 2.

header-col_name = 'FIELD2'.

APPEND header.

header-col_no = 3.

................

CALL FUNCTION 'XXL_SIMPLE_API'

EXPORTING

  • header = 'test'

  • filename = 'ZPROGRAM'

N_KEY_COLS = 0

TABLES

col_text = header[]

data = itab_excel[] "data itab

online_text = it_online

print_text = it_print

EXCEPTIONS

dim_mismatch_data = 1

file_open_error = 2

file_write_error = 3

inv_winsys = 4

inv_xxl = 5

OTHERS = 6.

*

IF sy-subrc <> 0.

EXIT.

ENDIF.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check this example..This is working fine for me..

DATA: COL_TEXT LIKE GXXLT_V OCCURS 0 WITH HEADER LINE.

DATA: ONLINE_TEXT like GXXLT_O occurs 0 with header line.

DATA: PRINT_TEXT like GXXLT_P occurs 0 with header line.

col_text-col_no = '1'.

col_text-col_name = 'ID'.

APPEND COL_TEXT.

col_text-col_no = '2'.

col_text-col_name = 'NAME'.

APPEND COL_TEXT.

data: begin of data occurs 0,

id type int4,

name type char20,

end of data.

data-id = 1.

data-name = 'Naren'.

append data.

data-id = 2.

data-name = 'Test'.

append data.

CALL FUNCTION 'XXL_SIMPLE_API'

EXPORTING

N_KEY_COLS = 1

TABLES

col_text = col_text

data = data

online_text = online_text

print_text = print_text

EXCEPTIONS

DIM_MISMATCH_DATA = 1

FILE_OPEN_ERROR = 2

FILE_WRITE_ERROR = 3

INV_WINSYS = 4

INV_XXL = 5

OTHERS = 6

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks,

Naren

Message was edited by: Narendran Muthukumaran

2 REPLIES 2

Former Member
0 Kudos

Hi,

Make the N_KEY_COLS = 1 instead of 0..

Thanks,

Naren

Former Member
0 Kudos

Hi,

Check this example..This is working fine for me..

DATA: COL_TEXT LIKE GXXLT_V OCCURS 0 WITH HEADER LINE.

DATA: ONLINE_TEXT like GXXLT_O occurs 0 with header line.

DATA: PRINT_TEXT like GXXLT_P occurs 0 with header line.

col_text-col_no = '1'.

col_text-col_name = 'ID'.

APPEND COL_TEXT.

col_text-col_no = '2'.

col_text-col_name = 'NAME'.

APPEND COL_TEXT.

data: begin of data occurs 0,

id type int4,

name type char20,

end of data.

data-id = 1.

data-name = 'Naren'.

append data.

data-id = 2.

data-name = 'Test'.

append data.

CALL FUNCTION 'XXL_SIMPLE_API'

EXPORTING

N_KEY_COLS = 1

TABLES

col_text = col_text

data = data

online_text = online_text

print_text = print_text

EXCEPTIONS

DIM_MISMATCH_DATA = 1

FILE_OPEN_ERROR = 2

FILE_WRITE_ERROR = 3

INV_WINSYS = 4

INV_XXL = 5

OTHERS = 6

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks,

Naren

Message was edited by: Narendran Muthukumaran