on 05-25-2008 10:23 PM
Hello All,
I have requirement where i have to export the internal table onto presentation server ( excel or xml etc) in webdynpro when a button is clicked or using Filedownload UI element. I have to import the same into the internal table when File upload is used or button is clicked.
Your help will be appreciated and points awarded.
Thanks in Advance.
hi prasad.....
you can upload a .csv file into an internal table and tehn to a table in web dynpro using the file upload ui element.
begin of wa, " structure of the node/file
mandt type mandt,
matnr type matnr,
end of wa,
itab like table of wa,
rows type standard table of string , " will hold the entire contents
wa_rows(300) type c .
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_contents LIKE ls_context-contents.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `CONTENTS`
IMPORTING
value = lv_contents ).
DATA : loc_conv TYPE REF TO cl_abap_conv_in_ce,
var_string TYPE string, " holds the string value of the file
inst type ref to CL_SWF_UTL_CONVERT_XSTRING,
inst1 type ref to cl_abap_conv_in_ce.
CALL METHOD cl_abap_conv_in_ce=>create
EXPORTING
input = lv_contents
encoding = 'UTF-8'
replacement = '?'
ignore_cerr = abap_true
RECEIVING
conv = loc_conv.
CALL METHOD loc_conv->read
IMPORTING
data = var_string.
SPLIT var_string AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE ROWS.
LOOP AT ROWS INTO WA_ROWS .
split wa_rows at ',' into wa-mandt wa-matnr.
append wa to itab.
ENDLOOP.
DATA lo_nd_table TYPE REF TO if_wd_context_node.
DATA lo_el_table TYPE REF TO if_wd_context_element.
DATA ls_table TYPE wd_this->element_table.
* navigate from <CONTEXT> to <TABLE> via lead selection
lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).
* get element via lead selection
lo_el_table = lo_nd_table->get_element( ).
lo_nd_table->bind_table( itab ).
for downloading you can use file download ui element.
---regards,
alex b justin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
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.