on 09-23-2009 2:16 PM
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
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.
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).
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
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.