Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Read text(Continuous text editor) purchase order M22/23N

Former Member
0 Kudos

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.

11 REPLIES 11

Former Member
0 Kudos

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

0 Kudos

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.

0 Kudos

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

raymond_giuseppi
Active Contributor
0 Kudos

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

former_member7555
Participant
0 Kudos

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.

peng_wen
Active Participant
0 Kudos

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

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

Hi,

Did you try the FM   STPU1_HEX_TO_CHAR

for hex to char conversion.

Thanks.

Former Member
0 Kudos

Hamsitha,

I have already tried FM STPU1_HEX_TO_CHAR  without any success.

Thank you.