Skip to Content
0
Former Member
Jan 02, 2012 at 01:50 PM

CRM_TEXT_READ_API giving corruption of char

126 Views

Hi

We are using the API - CRM_TEXT_READ_API which delivers the text as corrupted.

For ex: & appears like <(>&<)>

So we used CONVERT_ITF_TO_STREAM_TEXT after this API call .

Data: lt_stream_lines TYPE TABLE OF string,

ls_stream_lines TYPE string,

lt_stream_text TYPE TABLE OF tline.

CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'

EXPORTING

language = sy-langu

lf = 'X'

IMPORTING

stream_lines = lt_stream_lines

TABLES

itf_text = lt_stream_text.

And here as itf_text is of type tline it considers only 132 char and the remaining gets truncated.

So used the below FM.

LOOP AT lt_stream_lines INTO ls_stream_lines.

CALL FUNCTION 'CONV_TEXTSTRING_TO_ITF'

EXPORTING

iv_textstring = ls_stream_lines

IMPORTING

et_itf = lt_text_temp.

APPEND LINES OF lt_text_temp TO lt_stream_text.

REFRESH lt_text_temp.

ENDLOOP.

In this FM if a sentence has more than 132 char it gets splitted with a space and the 2nd part of the sentence appears in 2nd line.

For Ex: If a sentence has 264 char then 1st line has 132 char and 2nd line has the remaining chars. This makes the output look odd as the sentence gets splitted randomly in a paragraph.

Can anyone kindly suggest a logic to bring all chars of a paragraph together into lt_stream_text without splitting the sentence?