cancel
Showing results for 
Search instead for 
Did you mean: 

Excel file upload in Webdynpro ABAP

Former Member
0 Kudos

Hello  Friends,

I have gone through several threads regarding the excel file upload in Webdynpro Application.

Threads dates back to 2010 and before ( Old threads ).

Is it still not possible to upload the excel file directly into Webdynpro application. Is it necessary to create a text tab delimited file from that excel and upload ?

Expecting your valuable inputs.

Thank you.

Best Regards,

Hari.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Solved on my own.

Not possible to directly upload excel file.Only Comma separated or Text tab demilited file can be uploaded into Webdynpro Application

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi Hari...

  Try this...

Create a componenet controller

Create View

Create Window

And in ONACTIONUPLOAD method of View give the fllowing code..

method onactionon_upload .
types: begin of s_data,
          name(15) type c,
          age(2)   type c,
      end of s_data.
data:    it_table1 type standard table of s_data,
         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 s_data,
         l_xstring type xstring,
         fields type string_table,
         lv_field type string.


wd_context->get_attribute(

exporting
   name  = 'DATASOURCE'
importing
   value = l_xstring
   ).

call function 'HR_KR_XSTRING_TO_STRING'
  exporting
*   FROM_CODEPAGE       = '8500'
    in_xstring          = l_xstring
*   OUT_LEN             = OUT_LEN
importing
   out_string          = l_string
          .

split l_string at cl_abap_char_utilities=>newline into table i_data.

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 it_table1.


  endloop.

  lo_nd_data = wd_context->get_child_node( name = 'DATA_TAB' ).
  lo_nd_data->bind_table( it_table1 ).

endmethod.

Regards

Pradeep

Former Member
0 Kudos

Hello Hari,

Try and follow the steps given in the link below

http://www.saptechnical.com/Tips/ABAP/UploadExcel/Prg.htm

Regards,

Tushar

Former Member
0 Kudos
Former Member
0 Kudos

Hi,

I tried this solution, but its uploading wiht the garbage values.

Can you plz help?

Regards,

Sasi

Former Member
0 Kudos

Hi Hari,

I tried few solutions suggested by lot of people nothign worked, Please let me know if you find any solution,if i find it i will share that with you here.

Bye

sasi

Former Member
0 Kudos

Hi hari,

No need to copy it into a plain text file delimited by ';'. In built function modules are there to convert excel data into internal tables.

1. Use a FileUploadUIElement to upload the file.

2. The uploaded file content will be raw data( xstring).

3. Pass it to TEXT_CONVERT_XLS_TO_SAP if file is xls.

4.In case of xlsx use

'ALSM_EXCEL_TO_INTERNAL_TABLE' or 'KCD_EXCEL_OLE_TO_INT_CONVERT'

5. Now you can process the internal table data which is received from the Function Module

Regards,

Fareez

Former Member
0 Kudos

Hi,

First you need to download a template from your Web Dynpro application and fill the data into that excel file and save it and upload the same file, then the data gets uploaded into your application.

For every application you need to do this because there is some format which the WDA application can understand which is specific to its respective applications only so you need to download a template fill it and then upload. If you try using other excel file which is not downloaded from your application the data

would still get uploaded but you can see in some kind of binary format which cannot be converted into strings or any other type.

Former Member
Lukas_Weigelt
Active Contributor
0 Kudos

Eh?

To my understanding this is possible...

http://wiki.sdn.sap.com/wiki/display/WDABAP/Excel+File+Upload+And+Display+Data+Using+Web+DynPro+ABAP

You mean uploading an excel file without copy-paste its content into a txt.file and making ";" between for seperators or the like, do I understand correctly? Should work using the approach in Patel's Wiki

Cheers, Lukas