<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Converting RTF from MS SQL database to Plain Text in ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-rtf-from-ms-sql-database-to-plain-text-in-abap/m-p/8011521#M1607743</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are selecting data from an external MS SQL database into an internal table using ABAP. The data for the text field is coming out in the format below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2018{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}  {\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\f0\fs17 dsfdsgds gsgsdfgf\par  }u2019 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know if there is a way in ABAP to convert this text into a readable format?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We want the text from this field to used in BAPI_PO_CREATE1 as the poitem-SHORT_TEXT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Karen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Aug 2011 13:25:04 GMT</pubDate>
    <dc:creator>former_member498918</dc:creator>
    <dc:date>2011-08-08T13:25:04Z</dc:date>
    <item>
      <title>Converting RTF from MS SQL database to Plain Text in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-rtf-from-ms-sql-database-to-plain-text-in-abap/m-p/8011521#M1607743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are selecting data from an external MS SQL database into an internal table using ABAP. The data for the text field is coming out in the format below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2018{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}  {\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\f0\fs17 dsfdsgds gsgsdfgf\par  }u2019 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know if there is a way in ABAP to convert this text into a readable format?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We want the text from this field to used in BAPI_PO_CREATE1 as the poitem-SHORT_TEXT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Karen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 13:25:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-rtf-from-ms-sql-database-to-plain-text-in-abap/m-p/8011521#M1607743</guid>
      <dc:creator>former_member498918</dc:creator>
      <dc:date>2011-08-08T13:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Converting RTF from MS SQL database to Plain Text in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-rtf-from-ms-sql-database-to-plain-text-in-abap/m-p/8011522#M1607744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Karen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA l_string TYPE string.
l_string = '{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}'
&amp;amp;' {\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\f0\fs17 dsfdsgds gsgsdfgf\par }'.

DATA lt_tline TYPE TABLE OF tline.
DATA lt_rtf TYPE tdtab_x256.
DATA l_size TYPE i.
CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
  EXPORTING
    text      = l_string
  IMPORTING
    length    = l_size
  TABLES
    ftext_tab = lt_rtf.
DATA ls_thead TYPE thead.
CALL FUNCTION 'CONVERT_RTF_TO_ITF'
  EXPORTING
    header            = ls_thead
    x_datatab         = lt_rtf
    x_size            = l_size
  TABLES
    itf_lines         = lt_tline
  EXCEPTIONS
    invalid_tabletype = 1
    missing_size      = 2
    OTHERS            = 3.
DATA lt_string TYPE TABLE OF string.
CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
  EXPORTING
    lf           = 'X'
  IMPORTING
    stream_lines = lt_string[]
  TABLES
    itf_text     = lt_tline.
DESCRIBE TABLE lt_string.
ASSERT sy-tfill = 1.
DATA l_result TYPE string.
READ TABLE lt_string INDEX 1 INTO l_result.

ASSERT l_result = ' dsfdsgds gsgsdfgf'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Note that the SAP function module returns an incorrect leading space, that you can easily remove.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Sandra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2011 22:06:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-rtf-from-ms-sql-database-to-plain-text-in-abap/m-p/8011522#M1607744</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2011-08-10T22:06:38Z</dc:date>
    </item>
  </channel>
</rss>

