on 08-16-2010 11:08 AM
Hello Togehter,
i've got a Problem when i'm uploading, in WebDynpro, a .txt File to an Internal Table of SAP.
The umlaut Ää, Öö and Üü were replaced with #.
Can sb. explain why?
What I have to do to upload it correct?
Regards Chris
Is your ABAP system Unicode or Non-Unicode? If non-Unicode what language are you logged into the ABAP system with? How is the text file saved? Even a TXT format can be saved different ways? For instance if saved from WordPad you have the choice of Text or Text Unicode?
Basically what is happening is that the characters you describe are not in the ASCII7 range. It sounds like you are working with a non-unicode file on a non-unicode system and the code page of your ABAP system (which in a non-unicode system is controlled by the logon language) doesn't match the code page of the uploaded text file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The file is uploaded as an XSTRING so you must be doing some conversion to get it back to STRING for processing. What are you doing at this point? This is probably where the corruption occurs becuase of code page conversion.
You could consider saving the file within Excel as Unicode Text instead of a code page specifc text tab delimited format.
lo_el_context->get_attribute(
EXPORTING
name = `DATASOURCE`
IMPORTING
value = lv_datasource ).
convt = cl_abap_conv_in_ce=>create( input = lv_datasource
ignore_cerr = ABAP_TRUE ).
convt->read( IMPORTING data = s_cont ).
SPLIT s_cont AT cl_abap_char_utilities=>cr_lf INTO TABLE s_table.
The convertion from Xstring to String i did. And is working fine.
I tried to save the File as Unicode FIle, but is not working uploading it.
What is the source code page of the frontend machine? With the conversion classes you are using you must specify the source code page if it doesn't match the default one of the logon language.
>I tried to save the File as Unicode FIle, but is not working uploading it.
What exactly isn't working? You would need to adjust the conversion logic to specific that the source is Unicode (probably UTF-16le knowing Microsoft Office - but you might have to research that).
What is the source code page of the frontend machine? With the conversion classes you are using you must specify the source code page if it doesn't match the default one of the logon language.
Sorry i don't know what you mean with this phrase.
Yes you're right, i have to adjust the conversion logik.
Save your txt file in UTF format as Thomas suggested.
and use the code to read it in the program, your attachment content goes into xstring.
data: lr_conv type ref to cl_abap_conv_in_ce.
data: lv_cont type string.
data: lv_xcont type xstring.
lr_conv = cl_abap_conv_in_ce=>create( encoding = 'UTF-8' input = ls_attachment-content ).
lr_conv->read( importing data = lv_xcont ).
call function 'CRM_IC_XML_XSTRING2STRING'
exporting
inxstring = lv_xcont
importing
outstring = lv_cont.
and now play with lv_cont.
Thx alot for Help.
I already solved my problem.
My uploaded File was ANSI and i don't was allowed to convert it in UTF.
So i added this to my upload coding: encoding = 'NON_UNICODE'.
convt = cl_abap_conv_in_ce=>create( input = lv_datasource
ignore_cerr = abap_true
encoding = 'NON-UNICODE' ).
So my Umlaut where acceptet. And on downloading this data and some other added data, I just insert
the following to my coding:
DATA: encoding TYPE abap_encoding VALUE '1100'.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = d_string
encoding = encoding
IMPORTING
buffer = d_xstring.
So with this Code it works very good.
Do you use the normal UI-Upl-File-Element?
In which context-node (data-types) do you load it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
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.