on 01-04-2014 2:48 PM
Hello WD4A Gurus,
I have search a lot about excel upload functionality in WD but didnt get solution.
I managed to upload an excel by learning some tutorial but its showing garbage values in WD table.
Could you please make some suggestion or any other way to deal with excels uploads.
Thanks
Hello Guys,
Things mentioned in link ABAP WebDynpro - Upload Excel File using Class CL_FDT_XL_SPREADSHEET woked for me. Thanks..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As suggested by Kiran you should use abap2xlsx. It gives very good results. But it's limited to xlsX (xml based) files. Nothing for binary format xls files...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kiran,
I am uploading .csv comma separated file
1) using cl_abap_char_utilities=>newline we get all the values in an internal table.
2) We loop at this internal table and use SPLIT ls_data AT ',' INTO TABLE lt_fields. to get the values as follows :
i) Material Description
ii)MAKTX
iii)TEST#
This # signifies the end of line but how to remove it ,i have use all the attributes given in cl_abap_utilities to replace it with space but of no use.And when we bind this data to our field it gets shown as ******.
So how to resolve it?
Hi,
Write the below code in the action handler of upload and it should work if you use .csv file with correct file encding.
DATA lo_nd_table TYPE REF TO if_wd_context_node.
DATA lt_table TYPE wd_this->elements_table.
DATA ls_table TYPE wd_this->element_table.
DATA lt_rows TYPE STANDARD TABLE OF string.
DATA ls_rows TYPE string.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_content TYPE wd_this->element_context-content.
lo_el_context = wd_context->get_element( ).
*Read File Context
lo_el_context->get_attribute(
EXPORTING
name = `CONTENT`
IMPORTING
value = lv_content ).
DATA : lr_conv TYPE REF TO cl_abap_conv_in_ce,
string_data TYPE string.
*Convert Xstring data to string
CALL METHOD cl_abap_conv_in_ce=>create
EXPORTING
input = lv_content
encoding = 'UTF-8'
replacement = '#'
ignore_cerr = abap_true
RECEIVING
conv = lr_conv.
CALL METHOD lr_conv->read
IMPORTING
data = string_data.
SPLIT string_data AT cl_abap_char_utilities=>cr_lf INTO TABLE lt_rows.
LOOP AT lt_rows INTO ls_rows .
SPLIT ls_rows AT ',' INTO ls_table-f1 ls_table-f2 ls_table-f3. " here f1, F2,f3 are the attr names in your context node
REPLACE ALL OCCURRENCES OF '#' in ls_table-f3 WITH space.
APPEND ls_table TO lt_table.
ENDLOOP.
lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).
lo_nd_table->bind_table( new_items = lt_table set_initial_elements = abap_true ).
hope this helps u,
Regards,
Kiran
Hi Jitendra,
Please refer the below link
Rectifying garbage value problem in excel
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.