9/27/2019 File Upload And In Webdynpro Abap
i'm searching for a webdynpro abap-code snippet to get a uploaded file(xstring) into the BDS (Business Document Service) system of SAP. I'm using the 'file upload' function of webdynpro.
Active7 years, 3 months ago
Abap Excel Upload
Upload XLSX file in WebDynpro ABAP and view its content. You can see many posts in WebDynpro ABAP Form about reading an Excel file and showing its content in a WebDynpro ABAP Table, however many of them would be closed unanswered since it was not directly possible. Now it is possible with this interesting and collaborative project ABAP2XLSX!!! Upload excel sheet in web dynpro for ABAP and displaying the excel data in ALV table using ABAP2XLSX. Upload a display excel data in webdynpro ALV using ABAP2XLSX; Upload a display excel data in webdynpro ALV using ABAP2XLSX. Click Insert Element and create file upload element. Create data binding as below.
I've tried to insert the file with the BDS-function 'CREATE_WITH_AS_TABLE' but only rubbish was stored in the BDS. Most of the files would be in a binary format or zip files.
Can someone help me to solve this little problem?
Thanks
Enrico2012Enrico2012
2 Answers
Hi thanks for your answer.
I found the solution of this little problem. I forgot to convert the xsting in binary format to insert the file in the bds system. Unfortunatly many guys have the same problem but nobody posted a snippet.
The important code is:
My complete class:
I hope the code will help other Web Dynpro newbie's.
Cheers Heinrich
Enrico2012Enrico2012
Have you tried this function?
Also to store that file in BDS, you have to use
Hope its helpful.
MtuMtu
Not the answer you're looking for? Browse other questions tagged file-uploadabapwebdynpro or ask your own question.Skip to end of metadataGo to start of metadata
Scenario:To create WebDynpro Application. We would accept an input value from the user as an excel file name.By using Browser we will select Excel File with path.After clicking on UPLOAD button it will upload that excel file data and it will store data in an internal table and it will display data on that page.
Procedure:
1.Go to transaction SE80.
2.Select 'WebDynpro Comp./Intf' from the list. 3.Create a new WebDynpro component by the name ZEXCEL_UPLOAD. 4. Double-click on the View. Select Context Tab. 5. Create an attribute as shown below.
6. Create a node as shown below:
7. Create an attributes for the DATA_TAB node like below.
Create Attribute Age.
8. Double click on View. We would be designing the screen of our application with the following elements: File Upload Button Table Insert Element FILE_UPLOAD for Uploading File. 9. Insert Element Button.Set its Text property as UPLOAD. Create a new action for button. 10. Insert an Element TABLE and do binding by right clicking on it and select Create Binding. By pressing Enter button Binding will be done. 11. Set Column's header property as below. Same way set header property for the Age column too. 12. Select element File upload and set its DATA property like below. 13. Now select View's method list
14. 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, lo_nd_data TYPE REF TO if_wd_context_node, lo_el_data TYPE REF TO if_wd_context_element, 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. ENDLOOP.
Find and Download User Guides and Installations Manuals for your Fisher & Paykel Appliances: Washing Machines, Dryers, Dishwashers, Fridges, Ovens, etc. Find Part Number Follow the steps below to find your appliance's manual and locate the part number you're looking for.
lo_nd_data = wd_context->get_child_node( 'DATA_TAB' ).
lo_nd_data->bind_table( T_TABLE1 ).
15. Activate the Program and Create an application by right clicking and save it.
16. Test Application.
OUTPUT:
Click on Browse.Select An EXCEL file with two Columns. Click on UPLOAD Button.and Excel data will be displayed like below. Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |