on 02-09-2010 4:36 AM
Hi friend's
In web dynpro program how to upload excel file into internal table and finally data will be save Y table.
Hai,
when u are uploading the file u change the file type as XLS to .CSV .
and follow the sample code...
create the attribute as xstring type.
DATA : s_table TYPE string_table,
s_string TYPE string.
IF lv_data IS NOT INITIAL .
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = lv_data
IMPORTING
ex_string = out_string.
SPLIT out_string AT cl_abap_char_utilities=>cr_lf INTO TABLE s_table.
LOOP AT s_table INTO s_string.
SPLIT s_string AT cl_abap_char_utilities=>horizontal_tab INTO v_po_no
ls_s0_f1
ls_s0_f2
ls_s0_f3
ls_s0_f4
ls_s0_f5
ls_s0_f6
.
APPEND ls_data TO lt_data.
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,
See the properties of File Upload UI element..
Link: [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/732f0510d83ff6e10000000a42189c/frameset.htm]
Goto References -> User Interface Elements -> Integration Category -> File upload..
After creating the 'FILE UPLOAD' element in a view.. Bind a datasource(a context attribute with STRING) with the data property..
Double click on ONACTION_UPLOAD method. Write a code as given below.
METHOD onactionon_upload .
TYPES : BEGIN OF str_itab,
name(10) TYPE c,
age(10) TYPE c,
END OF str_itab. DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
i_data TYPE STANDARD TABLE OF string,
l_string TYPE string,
fs_table TYPE str_itab,
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.
* 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. "Append to the internal table
ENDLOOP.
Edited by: Rameshkumar Raamasamy on Feb 9, 2010 9:39 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Found this helpful link [http://www.scribd.com/doc/13290757/Uploading-Excel-Files-Using-WebDynpro-for-ABAP|http://www.scribd.com/doc/13290757/Uploading-Excel-Files-Using-WebDynpro-for-ABAP]
Try following the way mentioned there, i'll also try creating a sample app.
Regards
Manas Dua
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
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.