on 05-16-2008 1:08 AM
Hi All,
I need help in webdynpro download and upload.
i have a table element in the view and have rows in it.
I have 2 buttons one as import and other as export.
when i select the row in the table and click export button,
that data has to be saved in the excel file in local system
after asking the path.
same way, when i click the import button, it should pop up
asking for the path and should fill the table element in the view
with data from the file path given.
Your help will be highly appreciated.
Thanks in Advance
hi prasad........
you can use the file upload and download ui element...
but for uploading you can use .csv file format.
upload:
data:
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 ).
---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.
Hi Yogesh and Alex,
Thanks a lot for ur prompt replies. They were really helpful.
Yogesh,
As the export button (functionality) in ALV, do we have any import ? My idea is to avoid using the UI upload element.
Alex,
It did work. I was able to upload the data from the CSV file to the ALV using the UI upload element. Is there any way that we can upload from xls file instead of CSV ?
Thanks in Advance.
Hi,
The download option can be done using the ALV display.
[https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2881] [original link is broken] [original link is broken] [original link is broken];1_
There are the option called file upload and file download in the UI element you can use it. This will solve your problem.
Thanks
Yogesh
Edited by: Yogeshwaran K S on May 16, 2008 10:47 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.