<?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: changing some characters in string in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957026#M393807</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;*Code to Replace one char with another using TRANSLATE command&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------" /&gt;&lt;P&gt;DATA: ld_date(10) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ld_date = '28.10.1979'.&lt;/P&gt;&lt;P&gt;*Finds all occurences of first char(.) &amp;amp; replaces them with second(-)&lt;/P&gt;&lt;P&gt;TRANSLATE ld_date using '.-'.    &lt;/P&gt;&lt;P&gt;*ld_date will now contain '28-10-1979'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bijal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Feb 2007 07:14:49 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-21T07:14:49Z</dc:date>
    <item>
      <title>changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957020#M393801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I want to change in string occurance of some unwanted characters with '_', but I know only good characters. Any idea how it can be done simply ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 06:57:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957020#M393801</guid>
      <dc:creator>marcin_cholewczuk</dc:creator>
      <dc:date>2007-02-21T06:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957021#M393802</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;PRE&gt;&lt;CODE&gt;DATA: int_char(10) type c value '0123456789'.

if var CO sy-abcde.
* only alphabets
elseif var CO int_char.
* only numberics
else.
Special cases.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you have to chk that &amp;lt;b&amp;gt;special cases&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:00:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957021#M393802</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2007-02-21T07:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957022#M393803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;uhhhhhh, but that was not my question. I want to &amp;lt;b&amp;gt;change&amp;lt;/b&amp;gt; all occurance of bad characters with '_'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:07:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957022#M393803</guid>
      <dc:creator>marcin_cholewczuk</dc:creator>
      <dc:date>2007-02-21T07:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957023#M393804</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;PRE&gt;&lt;CODE&gt;DATA: String(20) type c value 'sautyn_nbj_jjk',
          string1(20) type c,
          str(1) type c value '_'.

REPLACE str with space INTO string1.
CONDENSE string1 NO-GAP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok so u can &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: String(20) type c value 'sautyn@nbj,jjk'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;b&amp;gt;SPLIT STRING AT DELIMITERS INTO str1 str2 str3...&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;depending on number of delimiters.&lt;/P&gt;&lt;P&gt;Then&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;CONCATENATE str1 str2 str3 INTO string SEPERATED BY '_'.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:09:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957023#M393804</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-21T07:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957024#M393805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Marcin,&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;&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;&lt;/P&gt;&lt;P&gt;Pls. mark if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:12:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957024#M393805</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-21T07:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957025#M393806</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;PRE&gt;&lt;CODE&gt;* Replacing and translating characters in strings
DATA: STRING(80).

STRING = 'Variable_The variable _ is substituted later.'.

REPLACE '_' WITH ' ' INTO STRING.
condense string no-gaps.

WRITE / STRING.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:13:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957025#M393806</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2007-02-21T07:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957026#M393807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;*Code to Replace one char with another using TRANSLATE command&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------" /&gt;&lt;P&gt;DATA: ld_date(10) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ld_date = '28.10.1979'.&lt;/P&gt;&lt;P&gt;*Finds all occurences of first char(.) &amp;amp; replaces them with second(-)&lt;/P&gt;&lt;P&gt;TRANSLATE ld_date using '.-'.    &lt;/P&gt;&lt;P&gt;*ld_date will now contain '28-10-1979'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bijal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:14:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957026#M393807</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-21T07:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957027#M393808</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;lets say yout string name is STRING1. and i am giving the code for Numbers, if you want alphabets then chage the code according, only change the INT_CHAR to length 26 and values should be a to z.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: int_char(10) type c value '0123456789'.
Data: len type i.
data: first type i, 
        last type i.
first = 0.
last = 1.
describe field STRING1 length LEN.
do LEN times.
 STRING+first(last) CO INT_CHAR.
 if sy-subrc &amp;lt;&amp;gt; 0.
 replace STRING1+first(last)  with '_' into STRING1.
 endif.
first = first + 1.
last = last + 1.
Enddo.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt; Sudheer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Sudheer Junnuthula&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:18:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957027#M393808</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-21T07:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957028#M393809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u have good characters in variables say v1 v2 v3.&lt;/P&gt;&lt;P&gt;concatenate v1 '_' v2  '_' v3 into str.&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;keerthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:18:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957028#M393809</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-21T07:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957029#M393810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Sudheer your solution is what I thought of, but I was hoping that there is possibility to do this in simplier way. If I knew bad characters I would've done it like bijal proposed or by using OVERLAY instruction - that was kind of solution I was thinking about.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:30:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957029#M393810</guid>
      <dc:creator>marcin_cholewczuk</dc:creator>
      <dc:date>2007-02-21T07:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: changing some characters in string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957030#M393811</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;In Sudheer's reply u can do like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;DATA: int_char(30) type c value '`~!@#$%^&amp;amp;*()_-+=|\"':;?/&amp;gt;.&amp;lt;,'.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Data: len type i.
data: first type i, 
        last type i.
first = 0.
last = 1.
describe field STRING1 length LEN.
do LEN times.
 STRING+first(last)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &amp;lt;b&amp;gt;CA&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;INT_CHAR.
 if sy-subrc &amp;lt;&amp;gt; 0.
 replace STRING1+first(last)  with '_' into STRING1.
 endif.
first = first + 1.
last = last + 1.
Enddo.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. Include all unwanted characters in the int_char.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:35:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/changing-some-characters-in-string/m-p/1957030#M393811</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-21T07:35:18Z</dc:date>
    </item>
  </channel>
</rss>

