<?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 Re: Replace 0 (zero) bytes in strings in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167054#M1516674</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try moving the string to a xstring variable and try replacing it in byte mode.&lt;/P&gt;&lt;P&gt;make use of classes cl_abap_conv_out_ce and cl_abap_conv_in_ce.&lt;/P&gt;&lt;P&gt;Please search in scn for this classes, you will get lot of examples.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is an example link:[http://www.sapfans.com/forums/viewtopic.php?p=91589&amp;amp;sid=c7ef36fec60a616f1194b6fdac217d4b]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Keshav.T on Aug 2, 2010 7:20 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Aug 2010 13:49:28 GMT</pubDate>
    <dc:creator>kesavadas_thekkillath</dc:creator>
    <dc:date>2010-08-02T13:49:28Z</dc:date>
    <item>
      <title>Replace 0 (zero) bytes in strings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167053#M1516673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;we are transfering column data to an external system (C programm) -&lt;/P&gt;&lt;P&gt;some of the data in SAP contain zero bytes (not the character '0') in hex view 00 00.&lt;/P&gt;&lt;P&gt;But C strings are null delimited. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;How can I replace all occurences of hex .. 00 00 .. in a string with another valid character (e.g. space 20 00)?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There must be a way to replace single bytes in a char variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Aug 2010 13:29:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167053#M1516673</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-02T13:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Replace 0 (zero) bytes in strings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167054#M1516674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try moving the string to a xstring variable and try replacing it in byte mode.&lt;/P&gt;&lt;P&gt;make use of classes cl_abap_conv_out_ce and cl_abap_conv_in_ce.&lt;/P&gt;&lt;P&gt;Please search in scn for this classes, you will get lot of examples.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is an example link:[http://www.sapfans.com/forums/viewtopic.php?p=91589&amp;amp;sid=c7ef36fec60a616f1194b6fdac217d4b]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Keshav.T on Aug 2, 2010 7:20 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Aug 2010 13:49:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167054#M1516674</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-08-02T13:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replace 0 (zero) bytes in strings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167055#M1516675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;In this case do you use the clase cl_abap_char_utilities, for replace Cero by atribute SPACE_STR_LANGU or SPACE_STR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lquispe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Aug 2010 16:12:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167055#M1516675</guid>
      <dc:creator>luis_quispe</dc:creator>
      <dc:date>2010-08-02T16:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Replace 0 (zero) bytes in strings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167056#M1516676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should also determine why you have these 00 bytes, and why your C program can't handle them, because maybe you shouldn't simply delete them.&lt;/P&gt;&lt;P&gt;For example, if you have a Unicode SAP system, all occidental characters are encoded on 2 bytes with one which is 00, but some other characters may contain 2 non 00 bytes. In that case, you may get some bizarre characters in your C program because it will be unable to understand in which code page they are encoded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that case, you should better do as Keshav said: determine what encoding your C program expects, and then, in your ABAP program, convert your string from SAP code page (name of encoding schemes in SAP) to this encoding. You also indicate a replacement character for those characters which don't have a corresponding value.&lt;/P&gt;&lt;P&gt;Notes:&lt;/P&gt;&lt;P&gt;1) if you write data to a file (on server probably), you can choose the target code page and replacement character in OPEN DATASET statement&lt;/P&gt;&lt;P&gt;2) if you use RFC, you can enter the replacement character directly in the RFC destination (SM59).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 07:35:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167056#M1516676</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2010-08-04T07:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Replace 0 (zero) bytes in strings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167057#M1516677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;thank you for your post and tipps.&lt;/P&gt;&lt;P&gt;I know how Unicode characters are encoded. &lt;/P&gt;&lt;P&gt;The source SAP System is a &lt;STRONG&gt;ANSI&lt;/STRONG&gt; system - so we do not have any multibyte encodings.&lt;/P&gt;&lt;P&gt;It seems that that data came from a migration from R2 to R3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 08:00:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167057#M1516677</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-04T08:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Replace 0 (zero) bytes in strings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167058#M1516678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay. So, it will be easier to use this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA l_null_character TYPE c LENGTH 1.
l_null_character = cl_abap_conv_in_ce=&amp;gt;uccpi( 0 ).
REPLACE ALL OCCURRENCES OF l_null_character WITH space IN yourstring.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sandra Rossi on Aug 4, 2010 8:03 PM&lt;/P&gt;&lt;P&gt;(I forgot ALL OCCURRENCES OF in my initial post)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 08:41:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-0-zero-bytes-in-strings/m-p/7167058#M1516678</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2010-08-04T08:41:48Z</dc:date>
    </item>
  </channel>
</rss>

