cancel
Showing results for 
Search instead for 
Did you mean: 

problem in uploading an excel file in wd abap

Former Member
0 Kudos

I am trying to upload an excel file in wd abap but on uploading it shows me the data in the form of some codes but when i try to do the same thing using text file it works well.Plese refer the code .

METHOD onactionon_upload .

TYPES : BEGIN OF itab_str1,

name(10) TYPE c,

age(10) TYPE c,

END OF itab_str1.

DATA : t_table1 TYPE STANDARD TABLE OF itab_str1,

i_data TYPE STANDARD TABLE OF string,

lo_nd_sflight TYPE REF TO if_wd_context_node,

lo_el_sflight TYPE REF TO if_wd_context_element,

l_string TYPE string,

fs_table TYPE itab_str1,

l_xstring TYPE xstring,

fields TYPE string_table,

lv_field TYPE string.

DATA : t_table TYPE if_main=>elements_data_tab,

data_table TYPE if_main=>elements_data_tab.

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.

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_sflight = wd_context->get_child_node( 'DATA_TAB').

lo_nd_sflight->bind_table( t_table1 ).

ENDMETHOD.

Accepted Solutions (0)

Answers (3)

Answers (3)

P1029777
Explorer
0 Kudos

Hi Gorav,

R u uploading ".XLS" formate file? If yes then, save your excel file in to CSV(COMMA DELEMITED) and then upload,

I hope it will solve your problem.

Regards.

Gyanendra.

Former Member
0 Kudos

Thanks for your suggestion.

former_member199125
Active Contributor
0 Kudos

Problem is not with the file format nor Upload element.

problem is with conversion function module, still now for conversion of xcel data to string format we dont have perfect function module.

CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING

in_xstring = l_xstring

IMPORTING
out_string = l_string.

That's a bug with xcel conversion As of now I dont find any fm which converts xcel data to string without any problem.

Regards

Srinvivas

Edited by: sanasrinivas on Dec 23, 2011 7:02 AM