08-18-2015 7:33 PM
Hello,
I have following situation .
User is copy pasting the text in the item text of the purchase order. Display looks perfectly ok but when we try to read the text using FM 'READ_TEXT' some character are appearing as ‘# ‘. Ex in the editor the text “ 2 – 10’ adbcefghijk “ looks good but when your read it using FM we get following text “ 2 # 10 # adbcefghijk “. ie character like “ –‘ “ are replaced by # .
I Tried converting it to ascii binary format using CONVERT_ITF_TO_ASCII and SCMS_BINARY_TO_XSTRING,also tried FM CONVERT_ITF_TO_RTF and mehtod GET_TEXT_AS_STREAM of calss cl_gui_textedit . It did not works.
How to retrieve the text exactly as it appear in the sap screen. If we can see text in editor, there should be a way to read what we see.
Note : It works perfectly when I type in manually. issue is only when we copy.
Appreciate your valuable suggestion .
Thank you.
08-18-2015 8:32 PM
Hello Ravi
Probably some carriage return/line feed is being copied into the screen when the user copies the text.
Try replacing the CR/LF after using READ_TEXT. You can use the constant cl_abap_char_utilities=>cr_lf to replace the text.
Regards
Luis Becker
08-19-2015 12:40 AM
Thank you Luis for your response.
I do not think it is related to carriage return/line feed. You can
try typing in text in ms-word and copy the text into ME21/22N item text and in a program try reading it with READ_TEXT. For example try text “ Test 10’ – 10‘ pipe and 10”X20” sheets.”
Thank you.
08-19-2015 1:34 PM
Hello Ravi
I did a test here and I couldn't reproduce the error. However, in other editors, like ABAP text editors, I've seen tabs converted to #.
So I'd give you two suggestions:
1) Try replacing another special characters, like cl_abap_char_utilities=>horizontal_tab
2) Go to Word and activate "paragraph marks" to see which special characters are being introduced without noticing.
Regards
Luis Becker
08-19-2015 2:18 PM
Are you working in a Unicode environment, and a non-Unicode SAP, then text is converting during initial save and reading it later, you don't recognize it?
Hint: look for OSS notes for your system version (Try keywords as READ_TEXT and special characters) - which version, Unicode ?
Regards,
Raymond
08-19-2015 11:32 PM
Recently we faced the similar kind of issue but instead of replacing in all places it has always displayed with a * in the first character of each line , We have rectified by replacing * with '' and appended to another internal table .
It might be a wrong way but we didn't find any other replacing class / FM for the same.
08-20-2015 8:01 AM
Hello,
Maybe it is a carriage return.
You can goto debug mode of FM 'READ_TEXT':
Source code of LSTXDFDB
FORM READ_TEXTLINES
...Code:
PERFORM READ_TEXTLINES TABLES LINES
if rt_header-tdtexttype is initial. "SAPscript format
import tline to rt_lines ->set variable "RT_LINES"
from database stxl(tx) ^^^^^^^^^^^^^^^^^^^^^^^
client rt_client
id stxl_id
ACCEPTING TRUNCATION "important for Unicod
IGNORING CONVERSION ERRORS.
else.
Here set "RT_LINES" as a variable, the click 'Status' icon, see if the
character is displayed as '#' and what is the hex value for this.
Regards,
Wen Peng
08-20-2015 1:31 PM
08-20-2015 1:39 PM
Luis,
I tried your suggestions it did not work, there are no tabor carriage return. I am sure you will realize the issue if you try with the example text I gave you. Especially when you copy
ms-word text which has special character like single quote, semi colon, double quotes,
underscore, hyphens etc.( -, ‘, “,- ).
Raymond,
I have looked at OSS notes nothing is close to working . we are in the SAP_BASIS 702 SP 12.Sap note 2014034 is some what related to my situation but I already
tried using the FM CONVERT_ITF_TO_ASCII without success.
Hamsitha,
Can you please elaborate I did not understand your suggestion.
Wen Peng,
Your suggestion looks promising I will try that. Do you know any FM or class that can convert hexdec to text and vic-versa.
Issue is only when we copy ms-word text which has special character like
single quote, semi colon, double quotes, underscore, hyphens etc ( -, ‘, “,_ ). I understand that special character representation in SAP and ms-word are different . But in sap continues text editor show exactly as in ms-word. Question is how to read or print what we see?
Thank you all for spending time on this.
08-21-2015 5:57 PM
Hello,
I think I am close I just need to convert hexdecimal Xstring into text. I have valid hexadecimal string which I was able to convert it to string/text using online string conversion website all I need is to do same thing in SAP.
I tried using many FM like HR_RU_CONVERT_HEX_TO_STRING,HR_KR_XSTRING_TO_STRING and class cl_abap_conv_x2x_ce and cl_abap_conv_in_ce with input code page as UFF-8(4110) and output as 1100 and vice-versa.nothing works .
anyone know how to convert hexdecimal to string/text?
Wen Peng,In debug it reads as #(hexdec value 92) so that do not help much.
Thank you
08-21-2015 6:03 PM
Hi,
Did you try the FM STPU1_HEX_TO_CHAR
for hex to char conversion.
Thanks.
08-21-2015 6:32 PM
Hamsitha,
I have already tried FM STPU1_HEX_TO_CHAR without any success.
Thank you.