<?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: String format in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375456#M184121</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use &amp;lt;b&amp;gt;replace&amp;lt;/b&amp;gt; statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To replace a string in a field with a different string, use the REPLACE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE &amp;lt;str1&amp;gt; WITH &amp;lt;str2&amp;gt; INTO &amp;lt;c&amp;gt; [LENGTH &amp;lt;l&amp;gt;].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement searches the field &amp;lt;c&amp;gt; for the first occurrence of the first &amp;lt;l&amp;gt; positions of the pattern &amp;lt;str1&amp;gt;. If no length is specified, it searches for the pattern &amp;lt;str1&amp;gt; in its full length.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, the statement replaces the first occurrence of the pattern &amp;lt;str1&amp;gt; in field &amp;lt;c&amp;gt; with the string &amp;lt;str2&amp;gt;. If a length &amp;lt;l&amp;gt; was specified, only the relevant part of the pattern is replaced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the return code value of the system field SY-SUBRC is set to 0, this indicates that &amp;lt;str1&amp;gt; was found in &amp;lt;c&amp;gt; and replaced by &amp;lt;str2&amp;gt;. A return code value other than 0 means that nothing was replaced. &amp;lt;str1&amp;gt;, &amp;lt;str2&amp;gt;, and &amp;lt;len&amp;gt; can be variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: T(10) VALUE 'abcdefghij',&lt;/P&gt;&lt;P&gt;STRING LIKE T,&lt;/P&gt;&lt;P&gt;STR1(4) VALUE 'cdef',&lt;/P&gt;&lt;P&gt;STR2(4) VALUE 'klmn',&lt;/P&gt;&lt;P&gt;STR3(2) VALUE 'kl',&lt;/P&gt;&lt;P&gt;STR4(6) VALUE 'klmnop',&lt;/P&gt;&lt;P&gt;LEN TYPE I VALUE 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRING = T.&lt;/P&gt;&lt;P&gt;WRITE STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE STR1 WITH STR2 INTO STRING.&lt;/P&gt;&lt;P&gt;WRITE / STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRING = T.&lt;/P&gt;&lt;P&gt;REPLACE STR1 WITH STR2 INTO STRING LENGTH LEN.&lt;/P&gt;&lt;P&gt;WRITE / STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRING = T.&lt;/P&gt;&lt;P&gt;REPLACE STR1 WITH STR3 INTO STRING.&lt;/P&gt;&lt;P&gt;WRITE / STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRING = T.&lt;/P&gt;&lt;P&gt;REPLACE STR1 WITH STR4 INTO STRING.&lt;/P&gt;&lt;P&gt;WRITE / STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output appears as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abcdefghij&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklmnghij&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklmnefgh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklghij&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklmnopgh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note how, in the last line, the field STRING is truncated on the right. The search pattern 'cdef' of length 4 is replaced by 'klmnop' of length 6. Then, the rest of the field STRING is filled up to the end of the field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 May 2006 12:57:09 GMT</pubDate>
    <dc:creator>vinod_gunaware2</dc:creator>
    <dc:date>2006-05-16T12:57:09Z</dc:date>
    <item>
      <title>String format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375455#M184120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   I have a value like 'C-1000010' in a variable and i need to eliminate the Hyphen and result should be 'C1000010'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls give me an idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2006 12:55:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375455#M184120</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-16T12:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: String format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375456#M184121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use &amp;lt;b&amp;gt;replace&amp;lt;/b&amp;gt; statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To replace a string in a field with a different string, use the REPLACE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE &amp;lt;str1&amp;gt; WITH &amp;lt;str2&amp;gt; INTO &amp;lt;c&amp;gt; [LENGTH &amp;lt;l&amp;gt;].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement searches the field &amp;lt;c&amp;gt; for the first occurrence of the first &amp;lt;l&amp;gt; positions of the pattern &amp;lt;str1&amp;gt;. If no length is specified, it searches for the pattern &amp;lt;str1&amp;gt; in its full length.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, the statement replaces the first occurrence of the pattern &amp;lt;str1&amp;gt; in field &amp;lt;c&amp;gt; with the string &amp;lt;str2&amp;gt;. If a length &amp;lt;l&amp;gt; was specified, only the relevant part of the pattern is replaced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the return code value of the system field SY-SUBRC is set to 0, this indicates that &amp;lt;str1&amp;gt; was found in &amp;lt;c&amp;gt; and replaced by &amp;lt;str2&amp;gt;. A return code value other than 0 means that nothing was replaced. &amp;lt;str1&amp;gt;, &amp;lt;str2&amp;gt;, and &amp;lt;len&amp;gt; can be variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: T(10) VALUE 'abcdefghij',&lt;/P&gt;&lt;P&gt;STRING LIKE T,&lt;/P&gt;&lt;P&gt;STR1(4) VALUE 'cdef',&lt;/P&gt;&lt;P&gt;STR2(4) VALUE 'klmn',&lt;/P&gt;&lt;P&gt;STR3(2) VALUE 'kl',&lt;/P&gt;&lt;P&gt;STR4(6) VALUE 'klmnop',&lt;/P&gt;&lt;P&gt;LEN TYPE I VALUE 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRING = T.&lt;/P&gt;&lt;P&gt;WRITE STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE STR1 WITH STR2 INTO STRING.&lt;/P&gt;&lt;P&gt;WRITE / STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRING = T.&lt;/P&gt;&lt;P&gt;REPLACE STR1 WITH STR2 INTO STRING LENGTH LEN.&lt;/P&gt;&lt;P&gt;WRITE / STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRING = T.&lt;/P&gt;&lt;P&gt;REPLACE STR1 WITH STR3 INTO STRING.&lt;/P&gt;&lt;P&gt;WRITE / STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRING = T.&lt;/P&gt;&lt;P&gt;REPLACE STR1 WITH STR4 INTO STRING.&lt;/P&gt;&lt;P&gt;WRITE / STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output appears as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abcdefghij&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklmnghij&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklmnefgh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklghij&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklmnopgh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note how, in the last line, the field STRING is truncated on the right. The search pattern 'cdef' of length 4 is replaced by 'klmnop' of length 6. Then, the rest of the field STRING is filled up to the end of the field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2006 12:57:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375456#M184121</guid>
      <dc:creator>vinod_gunaware2</dc:creator>
      <dc:date>2006-05-16T12:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: String format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375457#M184122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use the replace command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	Data p(6) value &amp;#145;ABCABC&amp;#146;.&lt;/P&gt;&lt;P&gt;	Replace &amp;#145;A&amp;#146; with &amp;#145;&amp;#146; into p.&lt;/P&gt;&lt;P&gt;	Write:/ p.		DEFABC&lt;/P&gt;&lt;P&gt;	(Replaces first occurrence only)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the above doesnt work then use the following code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;data : a(10),b(10), d(20).&lt;/P&gt;&lt;P&gt;Split STR at '-' into a b.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Concatenate a b into d.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Sorry to edit this once again&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2006 13:01:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375457#M184122</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2006-05-16T13:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: String format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375458#M184123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;REPLACE &amp;#145;&amp;amp;&amp;#146; WITH &amp;#145; &amp;#146; into value.&lt;/P&gt;&lt;P&gt;CONDENSE value [NO-GAPS].&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwise you can break the value into two using offset&lt;/P&gt;&lt;P&gt;and then concatenate again .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Naresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2006 13:03:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375458#M184123</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-16T13:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: String format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375459#M184124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kalimuthu&lt;/P&gt;&lt;P&gt;Try the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: str1 type string value 'C-1000010'.&lt;/P&gt;&lt;P&gt;DATA: str2 type string.&lt;/P&gt;&lt;P&gt;concatenate str1 0(1) + str1 2(7) into str2 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Prabhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2006 13:05:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375459#M184124</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-16T13:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: String format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375460#M184125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kalimuthu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This logic will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : str(15) type c value '1-23000234',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replace '-' with ' ' into str.&lt;/P&gt;&lt;P&gt;condense str NO-GAPS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Susmitha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2006 13:05:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375460#M184125</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-16T13:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: String format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375461#M184126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt; Use Replace&lt;/P&gt;&lt;P&gt;REPLACE ALL OCCURRENCES OF '-' IN v_text WITH ' '.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2006 13:05:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375461#M184126</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-16T13:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: String format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375462#M184127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
split yoursting at '-' into str1 str2.
concatente  str1 str2 into yourstring.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2006 13:07:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375462#M184127</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-16T13:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: String format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375463#M184128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;replace '-' with space in v_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;condense v_text&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2006 13:07:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-format/m-p/1375463#M184128</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-16T13:07:21Z</dc:date>
    </item>
  </channel>
</rss>

