cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in downloading contents of UI table into excel sheet

Former Member
0 Kudos

Hi all,

Am downloading the content of UI table in screen on click of a UI button 'EXPORT' using the following method.

  • Node for getting row from screen table

DATA: lo_nd_n_one TYPE REF TO if_wd_context_node,

  • internal table to get selected row

li_temp TYPE STANDARD TABLE OF ztable,

  • workarea to get selected row

wa_temp LIKE LINE OF li_temp,

  • variable of type string to get values from all rows of table

table_string TYPE string,

  • varaiable of type xstring for creating of excel sheet

table_xstring TYPE xstring,

  • get amount value for each row

lv_amount TYPE string.

  • navigate from <CONTEXT> to <N_BILL_DETAILS> via lead selection

lo_nd_n_one= wd_context->get_child_node( name = wd_this->wdctx_n_one ).

  • To get all the rows in the table UI element

CALL METHOD lo_nd_n_one->get_static_attributes_table

IMPORTING

table = li_temp.

IF li_temp[] IS NOT INITIAL.

  • concatenate the column heading into a single line seperated by horizontal tab - header row

CONCATENATE '1' '2' '3' '4' '5' '6' '7' '8'

cl_abap_char_utilities=>newline INTO table_string SEPARATED BY

cl_abap_char_utilities=>horizontal_tab.

  • get each row from table and concatenate into string variable

LOOP AT lt_temp INTO wa_temp.

CLEAR lv_amount.

lv_amount = wa_temp-amount.

  • concatenate the column values into a single line seperated by horizontal tab

CONCATENATE table_string

wa_temp-first_field

wa_temp-second_field

wa_temp-third_field

wa_temp-fourth_field

lv_amount

wa_temp-sixth_field

wa_temp-seventh_field

wa_temp-eighth_field

cl_abap_char_utilities=>cr_lf INTO table_string

SEPARATED BY cl_abap_char_utilities=>horizontal_tab.

ENDLOOP.

  • FM to convert string format to xstring format for downloading to excel sheel

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = table_string

IMPORTING

buffer = table_xstring.

  • create excel sheet

CL_WD_RUNTIME_SERVICES=>attach_file_to_response( i_filename = 'SAMPE.XLS'

i_content = table_xstring

i_mime_type = 'EXCEL' ).

ENDIF.

I am able to download the contents into 'EXCEL' sheet.

But the problem in my first column i.e COLUMN 'A' is blank. The contents are starting from the COLUMN 'B'.

Please explain how to overcome this problem.

Edited by: Mohamed Aslam on Feb 22, 2010 1:04 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

format of question is not proper. Will post agian