cancel
Showing results for 
Search instead for 
Did you mean: 

Upload a file excel with web dynpro

Former Member
0 Kudos

Hi all,

I need to upload a file excel with web dynpro and I have to view the content of this file as a table on a view. Are there standard methods that allow this operation?

Many thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

for uploading an excel file go thru this thread

in this thread saurav has explained it nicely.

try to go thru it and also refer the thread provided by him.

it might help you.

regards,

anand

Former Member
0 Kudos

Hi all,

on my system the FM HR_KR_XSTRING_TO_STRING there isn't but there is ECATT_CONV_XSTRING_TO_STRING. Can I use this FM? Can you have exemple of use of this FM?

Tks a lot.

Former Member
0 Kudos

Hi,

i think you can use ECATT_CONV_XSTRING_TO_STRING.

in this the importing parameter is of data type rawstring

and in HR_KR_XSTRING_TO_STRING the importing parameter is of data type xstring.

just give it a try .

Regards,

anand

Former Member
0 Kudos

Hi,

I used the FM LXE_COMMON_XSTRING_TO_STRING for convert XSTRING to STRING but the result is not the content of the excel file but a sequence of special characters. I have a question:

the FIle Upload UI element allow automatically the upload or I have to specify others things?

I suspect that the upload file doesn't work...

Tks in advance...

Former Member
0 Kudos

Hi

Check with the following link

[Upload excel file|https://wiki.sdn.sap.com/wiki/display/WDABAP/WDAforuploadingDatafrom+Excelsheet]

Hope this solves the issue, Let me know if any queries.

Regards,

Rajani

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I suspect that what was uploaded was a native binary Excel format. You can't just convert from XSTRING to STRING and have this content appear as normal text. The native binary Excel format is a propriatery Microsoft format. If you want to be able to convert this conent into an ABAP internal table, then the user needs to save the Excel document into an open format - like Text Tab Delimited or Comma Separated. Then once you convert from XSTRING to STRING you will have a clear text document. You can then use the SPLIT command to break the string down based upon the column separate (TAB or Comma) and the New Line character.

Former Member
0 Kudos

Tks Thomas, but I have a question. I use the following FM for conversion XSTRING --> STRING:

LXE_COMMON_XSTRING_TO_STRING

because the FM HR_KR_XSTRING_TO_STRING there isn't on my system. Please, could you write the code of the FM HR_KR_XSTRING_TO_STRING? So, I try to use this FM.

Tks...

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I also don't have the function module HR_KR_XSTRING_TO_STRING in my systems since it is HR application created function module and I work on NetWeaver only systems. It isn't going to solve your problem however. It will only convert XSTRING to STRING - not translate the microsoft propriatery format into a text string.

For XSTRING to STRING conversions, I personally use the class cl_abap_conv_in_ce.

data lr_conv       type ref to cl_abap_conv_in_ce.
lr_conv = cl_abap_conv_in_ce=>create( ).
lr_conv->convert( exporting input = xstring importing data = string ).

But as said, this isn't going to solve your problem of the fact that uploaded XSTRING is in Microsoft's propriatery binary format. This will work on an open standards based format of Excel file (like Tab Delimited, CVS, XML, etc).

Former Member
0 Kudos

TKS Thomas! In effect the main problem was the format of file!

And I used the 'cl_abap_conv_in_ce' object for the conversion!

Bye!

Former Member
0 Kudos

You can use the FileUpload uielement for this scenario. I am not sure if any standard fucntionality is available. You will programatically have to handle this. You can use the XSTRING format data from the Fileupload uielement

Former Member
0 Kudos

Tks Radhika, but after the choice of file I need to upload this file and convert it in an internal table...I would like to know if there is a standard method that allow this...

Many Tks...

Former Member
0 Kudos

Follow this approach; 1. Use a File upload UI element and bind it the data property with an attribute of type Xstring. Now you can get the Content in Xstring format using get_attribute method of the node. 2. Convert Xstring to String data using FM 'HR_KR_XSTRING_TO_STRING'. 3. Now split the string at new line so as to make an internal table . Eg: SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE it_table. here it_table is type table of string. 4.now loop at the internal table and separate the content of this table separated by tab. Eg: SPLIT wa_table AT cl_abap_char_utilities=>horizontal_tab INTO TABLE it_new. it_new type string_table. Hope this helps! Radhika.

Former Member
0 Kudos

Check this thread too; []

Former Member
0 Kudos

Tks a lot, i'll try!!!!

Bye!