<?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: Extracting from String in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224687#M477968</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  not to hijack the thread but see if this helps: Modified version of Ram's code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZTEST.

data:
w_string type string value 'ram[mohan]hh[rao]k[nagam]',
*w_string(50) type c value 'ram[mohan]hh[rao]k[nagam]',
w_len type i,
w_cnt type i.

data:
w_output type string ,
w_temp type string.

data:
itab like standard table of w_string with header line.


w_len = strlen( w_string ).

*do w_len times.
*w_cnt = sy-index - 1.
*
*if w_string+w_cnt(1) eq '['.
*w_string+w_cnt(1) = ']'.
*endif.
*
*enddo.
translate w_string using '[]'.
split w_string at ']' into table itab.

loop at itab .
w_cnt = sy-tabix mod 2.

if w_cnt eq 1.

w_len = strlen( itab ).
if w_len = 1.
w_temp = '[?]'.
else.
w_temp = '[*]'.
endif.
else.
w_temp = itab.
endif.

concatenate w_output w_temp into w_output.
clear w_temp.
endloop.

write: w_output.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Apr 2007 10:09:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-26T10:09:04Z</dc:date>
    <item>
      <title>Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224671#M477952</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;if i have a String like 'M[ey]er' how could i extract all information that is not within the brackets so it would give me 'Mer' then ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 07:10:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224671#M477952</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-04-26T07:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224672#M477953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u can use keyword&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SPLIT  'PRABHU' at 'R' into x1 x2 .&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3400358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3400358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after that u can use concatenate keyword to get into single 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;Prabhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 07:14:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224672#M477953</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T07:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224673#M477954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SPLIT string at '[' into x1 x2.&lt;/P&gt;&lt;P&gt;SPLIT x2 at ']' into x3 x4.&lt;/P&gt;&lt;P&gt;concatenate x1 x4 into x5 then x5 will contain the required string 'Mer'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 07:31:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224673#M477954</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T07:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224674#M477955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you, here is what i got:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; DATA:
   w_string TYPE string ,
   w_sub_string TYPE string,
   w_int TYPE i,
   zaehl TYPE i,
   w_char,
   w_counter TYPE i,
   fl_flag.

  w_string = i_s2.

  w_int = STRLEN( w_string ).
  w_counter = 0.

  DO w_int TIMES.
    zaehl = zaehl + 1.
    w_char = w_string+w_counter(1).

    IF w_char EQ '['.
      zaehl = zaehl - 1.
      WRITE:/ zaehl.
  
      CLEAR fl_flag.
    ENDIF.


    IF fl_flag = 'X'.
      CONCATENATE  w_sub_string w_char INTO w_sub_string.
    ENDIF.

    IF w_char EQ ']'.
      zaehl = 0.
      fl_flag = 'X'.

    ENDIF.

    w_counter = w_counter  + 1.
   
  ENDDO.
  
 WRITE:/ zaehl.
  i_s2 = w_sub_string.

ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now how do i have to adapt the code that i can do the following:&lt;/P&gt;&lt;P&gt;If i have the string 'Jose[ph]M[ue]ller' then i want to get '[&lt;STRONG&gt;][ph][?][ue][&lt;/STRONG&gt;]'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will surely reward points generously!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 08:05:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224674#M477955</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-04-26T08:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224675#M477956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data str type string.&lt;/P&gt;&lt;P&gt;data str1 type string.&lt;/P&gt;&lt;P&gt;data str2 type string.&lt;/P&gt;&lt;P&gt;data str3 type string.&lt;/P&gt;&lt;P&gt;data str4 type string.&lt;/P&gt;&lt;P&gt;data str5 type string.&lt;/P&gt;&lt;P&gt;str = 'p[riya]nk'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;split str at '[' into str1 str2.&lt;/P&gt;&lt;P&gt;write : / str1, str2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;split str2 at ']' into str3 str4.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; str3, str4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if strlen( str1 ) = 1.&lt;/P&gt;&lt;P&gt;str1 = '?'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;str1 = '*'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if strlen( str4 ) = 1.&lt;/P&gt;&lt;P&gt;str4 = '?'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;str4 = '*'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate str1 '['  str3  ']' str4 into str5.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; str5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Priyank Jain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 08:16:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224675#M477956</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T08:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224676#M477957</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;Following is the code in addition to what all has been said by others&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : string(20),&lt;/P&gt;&lt;P&gt;string1(20),&lt;/P&gt;&lt;P&gt;string2(20),&lt;/P&gt;&lt;P&gt;string3(20),&lt;/P&gt;&lt;P&gt;string4(20),&lt;/P&gt;&lt;P&gt;del value '[',&lt;/P&gt;&lt;P&gt;del2 value ']'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;string = 'M[ey]er'.&lt;/P&gt;&lt;P&gt;split string at del into string1 string2.&lt;/P&gt;&lt;P&gt;*write / string1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;split string2 at del2 into string3 string4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*write / string4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate string1 string4 into string1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write / string1.  "Gives you Mer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 08:52:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224676#M477957</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T08:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224677#M477958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi does this function also respect that there can be more than one [xyz] in a string ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 08:56:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224677#M477958</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-04-26T08:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224678#M477959</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;Just paste this code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; w_string type string value 'ram[mohan]hh[rao]kk[nagam]',&lt;/P&gt;&lt;P&gt; w_len type i,&lt;/P&gt;&lt;P&gt; w_cnt type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; w_output type string,&lt;/P&gt;&lt;P&gt; w_temp type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; itab like standard table of w_string with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replace all occurrences of '[' in w_string with ']'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;split w_string at ']' into table itab.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;loop at itab .&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;  w_cnt = sy-tabix mod 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if w_cnt eq 1.&lt;/P&gt;&lt;P&gt;    w_temp = '[*]'.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    w_temp = itab.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;  &amp;lt;b&amp;gt;concatenate w_output w_temp into w_output.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;  clear w_temp.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;endloop.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &amp;lt;b&amp;gt;write: w_output.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 08:57:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224678#M477959</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T08:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224679#M477960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, but i am on 4.6 so "all occurrences" wont work, sorry!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 08:58:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224679#M477960</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-04-26T08:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224680#M477961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZTEST.

data: v_name type string value 'Me[yjghje]r'.
data: str1 type string.
data: str2 type string.
data: dummy type string.

split v_name at '[' into dummy str1.
split str1 at ']' into str2 dummy.
concatenate '[' str2 ']' into str2.
replace all occurrences of str2  in v_name with  ''.
write:/ v_name.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 09:01:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224680#M477961</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T09:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224681#M477962</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 with this..&amp;lt;b&amp;gt;without replace&amp;lt;/b&amp;gt; stmt..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; w_string(50) type C value 'ram[mohan]hh[rao]kk[nagam]',&lt;/P&gt;&lt;P&gt; w_len type i,&lt;/P&gt;&lt;P&gt; w_cnt type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; w_output type string ,&lt;/P&gt;&lt;P&gt; w_temp type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; itab like standard table of w_string with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_len = strlen( w_string ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_len times.&lt;/P&gt;&lt;P&gt; w_cnt = sy-index - 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; if w_string+w_cnt(1) eq '['.&lt;/P&gt;&lt;P&gt;     w_string+w_cnt(1) = ']'.&lt;/P&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;split w_string at ']' into table itab.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;loop at itab .&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;  w_cnt = sy-tabix mod 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if w_cnt eq 1.&lt;/P&gt;&lt;P&gt;    w_temp = '[*]'.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    w_temp = itab.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  concatenate w_output w_temp into w_output.&lt;/P&gt;&lt;P&gt;  clear w_temp.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write w_output.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 09:27:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224681#M477962</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T09:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224682#M477963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rammohan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is quite close to what i need, thank you! Could you adjust it once more for me ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i need is when i have 'ram[mohan]hh[rao]k[nagam]'. The desired output would be '[&lt;STRONG&gt;][mohan][&lt;/STRONG&gt;][rao][?][nagam]'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where do i need to change coding ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 09:34:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224682#M477963</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-04-26T09:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224683#M477964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Clemens Leider  ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now paste this code...modified..solves ur problem..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; w_string(50) type C value 'ram[mohan]hh[rao]k[nagam]',&lt;/P&gt;&lt;P&gt; w_len type i,&lt;/P&gt;&lt;P&gt; w_cnt type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; w_output type string ,&lt;/P&gt;&lt;P&gt; w_temp type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; itab like standard table of w_string with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_len = strlen( w_string ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_len times.&lt;/P&gt;&lt;P&gt; w_cnt = sy-index - 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; if w_string+w_cnt(1) eq '['.&lt;/P&gt;&lt;P&gt;     w_string+w_cnt(1) = ']'.&lt;/P&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;split w_string at ']' into table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab .&lt;/P&gt;&lt;P&gt;  w_cnt = sy-tabix mod 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if w_cnt eq 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &amp;lt;b&amp;gt;w_len = strlen( itab ).&lt;/P&gt;&lt;P&gt;    if w_len = 1.&lt;/P&gt;&lt;P&gt;      w_temp = '[?]'.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;    w_temp = '[*]'.&lt;/P&gt;&lt;P&gt;    endif.&amp;lt;/b&amp;gt;    &lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    w_temp = itab.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  concatenate w_output w_temp into w_output.&lt;/P&gt;&lt;P&gt;  clear w_temp.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  write: w_output.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 09:49:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224683#M477964</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T09:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224684#M477965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much, now it works as i wanted it to, but one last question remains - how to use this logic with a string rather than type c ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 09:53:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224684#M477965</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-04-26T09:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224685#M477966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ram's code works for works for strings as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 09:55:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224685#M477966</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T09:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224686#M477967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, i am afraid it doesnt because i get an error stating that at writing positions at fields of type string or xstring no offsetlenght is allowed - it refers to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_string+w_cnt(1) eq '['.&lt;/P&gt;&lt;P&gt;w_string+w_cnt(1) = ']'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you help me ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 09:58:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224686#M477967</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-04-26T09:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224687#M477968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  not to hijack the thread but see if this helps: Modified version of Ram's code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZTEST.

data:
w_string type string value 'ram[mohan]hh[rao]k[nagam]',
*w_string(50) type c value 'ram[mohan]hh[rao]k[nagam]',
w_len type i,
w_cnt type i.

data:
w_output type string ,
w_temp type string.

data:
itab like standard table of w_string with header line.


w_len = strlen( w_string ).

*do w_len times.
*w_cnt = sy-index - 1.
*
*if w_string+w_cnt(1) eq '['.
*w_string+w_cnt(1) = ']'.
*endif.
*
*enddo.
translate w_string using '[]'.
split w_string at ']' into table itab.

loop at itab .
w_cnt = sy-tabix mod 2.

if w_cnt eq 1.

w_len = strlen( itab ).
if w_len = 1.
w_temp = '[?]'.
else.
w_temp = '[*]'.
endif.
else.
w_temp = itab.
endif.

concatenate w_output w_temp into w_output.
clear w_temp.
endloop.

write: w_output.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 10:09:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224687#M477968</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T10:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224688#M477969</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;Modified &amp;lt;b&amp;gt;...works with string&amp;lt;/b&amp;gt; also...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; w_string type string value 'ram[mohan]hh[rao]kkk[ram]h[nagam]',&lt;/P&gt;&lt;P&gt; w_len type i,&lt;/P&gt;&lt;P&gt; w_cnt type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; w_output type string ,&lt;/P&gt;&lt;P&gt; w_temp type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; itab like standard table of w_string with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;translate w_string to upper case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_len = strlen( w_string ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_len times.&lt;/P&gt;&lt;P&gt; w_cnt = sy-index - 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; if w_string+w_cnt(1) na sy-abcde.&lt;/P&gt;&lt;P&gt;    concatenate w_temp ']'  into w_temp.&lt;/P&gt;&lt;P&gt; else.&lt;/P&gt;&lt;P&gt;    concatenate w_temp w_string+w_cnt(1)  into w_temp.&lt;/P&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_string = w_temp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;split w_string at ']' into table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab .&lt;/P&gt;&lt;P&gt;  w_cnt = sy-tabix mod 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if w_cnt eq 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    w_len = strlen( itab ).&lt;/P&gt;&lt;P&gt;    if w_len = 1.&lt;/P&gt;&lt;P&gt;      w_temp = '[?]'.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;    w_temp = '[*]'.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    w_temp = itab.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  concatenate w_output w_temp into w_output.&lt;/P&gt;&lt;P&gt;  clear w_temp.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  write: w_output.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 10:15:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-from-string/m-p/2224688#M477969</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T10:15:59Z</dc:date>
    </item>
  </channel>
</rss>

