Skip to Content
0
Former Member
Jul 16, 2009 at 05:03 AM

How to upload excel file in Webdynpro application using ABAP

63 Views

Hi Experts,

Am developing a webdynpro application in which it will take an excel file as input and display the contents in the form of a table in output. I am able to upload tab delimited text file and populate the table using the below code but not able to do the same with .xls file. Pls let me know if I need to use a different function module for upload excel file.

  • get single attribute

wd_context->get_attribute(

EXPORTING

name = `DATASOURCE`

IMPORTING

value = l_xstring ).

CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'

EXPORTING

in_xstring = l_xstring

IMPORTING

out_string = l_string.

SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE i_data.

  • Bind With table Element.

LOOP AT i_data INTO l_string.

SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.

READ TABLE fields INTO lv_field INDEX 1.

fs_table-name = lv_field.

READ TABLE fields INTO lv_field INDEX 2.

fs_table-age = lv_field.

APPEND fs_table TO t_table1.

ENDLOOP.

lo_nd_data = wd_context->get_child_node( 'DATA_TAB' ).

lo_nd_data->bind_table( T_TABLE1 ).

Thanks,

Subathra