<?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: Extract data from a string in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891439#M679536</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; &amp;lt;XX&amp;gt;YYYY&amp;lt;\&amp;gt;, as you told in this string &amp;lt;/&amp;gt; will be in the last.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; data: a type i,&lt;/P&gt;&lt;P&gt;          str = &amp;lt;XX&amp;gt;YYYY&amp;lt;\&amp;gt;  ." (string)&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; a = strlen( str ).&lt;/P&gt;&lt;P&gt; a = a - 7.  " as last is &amp;lt;/&amp;gt; -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;3 chars plus YYYY --- 4 chars. so 7 chars&lt;/P&gt;&lt;P&gt; shift str left by a places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it doesn't work,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do a times.&lt;/P&gt;&lt;P&gt;   shift str left.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                       now you will get   str = YYYY&amp;lt;/&amp;gt;.&lt;/P&gt;&lt;P&gt;now ,&lt;/P&gt;&lt;P&gt;  str = str(4).     " finally you will get str = YYYY.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Oct 2007 12:43:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-22T12:43:59Z</dc:date>
    <item>
      <title>Extract data from a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891435#M679532</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;I need to &amp;lt;b&amp;gt;EXTRACT&amp;lt;/b&amp;gt; YYYY in the string &amp;lt;u&amp;gt;&amp;lt;&amp;lt;/u&amp;gt;XX&amp;lt;u&amp;gt;&amp;gt;&amp;lt;/u&amp;gt;YYYY&amp;lt;u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;\&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, only the charachters underlined are constant, as in... &amp;lt;\&amp;gt; will be present at the end of the string, but the first &amp;lt;&amp;gt; can have varying data between it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;string examples:&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;&amp;lt;&amp;lt;/u&amp;gt;PQRST&amp;lt;u&amp;gt;&amp;gt;&amp;lt;/u&amp;gt; YYYY &amp;lt;u&amp;gt;&amp;lt;\&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;&amp;lt;&amp;lt;/u&amp;gt;ABC&amp;lt;u&amp;gt;&amp;gt;&amp;lt;/u&amp;gt; XXXXYYYY &amp;lt;u&amp;gt;&amp;lt;\&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to extract the 'YYYY' or 'XXXXYYYY' or whatever else that comes after the closure of the first bracket '&amp;lt;*&amp;gt;' and the start of the second bracket '&amp;lt;\&amp;gt;'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried sy-fdpos, but it only gives the START of the &amp;lt;*&amp;gt; part. What really helps me is the CLOSE of the first &amp;lt;&amp;gt; and START of the second &amp;lt;&amp;gt;.&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>Mon, 22 Oct 2007 11:15:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891435#M679532</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T11:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891436#M679533</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;You can split at each "&amp;gt;" and delete the 2 last caracters of the second data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example :&lt;/P&gt;&lt;P&gt;&amp;lt;test&amp;gt;YYYY&amp;lt;\&amp;gt;&lt;/P&gt;&lt;P&gt;first data : &amp;lt;test&lt;/P&gt;&lt;P&gt;second data : YYYY&amp;lt;\   -&amp;gt; YYYY&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 11:57:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891436#M679533</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T11:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891437#M679534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can use split , that the only way to solve this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 12:06:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891437#M679534</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T12:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891438#M679535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also use this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while lv_string(1) ne '&amp;gt;'.&lt;/P&gt;&lt;P&gt;  shift lv_string.&lt;/P&gt;&lt;P&gt;endwhile.&lt;/P&gt;&lt;P&gt;shift lv_string.&lt;/P&gt;&lt;P&gt;if lv_string CA '&amp;lt;'.&lt;/P&gt;&lt;P&gt;  lv_result = lv_string(sy-fdpos).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lv_result will contain the values between the first &amp;gt; and the second &amp;lt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 12:20:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891438#M679535</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T12:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891439#M679536</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; &amp;lt;XX&amp;gt;YYYY&amp;lt;\&amp;gt;, as you told in this string &amp;lt;/&amp;gt; will be in the last.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; data: a type i,&lt;/P&gt;&lt;P&gt;          str = &amp;lt;XX&amp;gt;YYYY&amp;lt;\&amp;gt;  ." (string)&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; a = strlen( str ).&lt;/P&gt;&lt;P&gt; a = a - 7.  " as last is &amp;lt;/&amp;gt; -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;3 chars plus YYYY --- 4 chars. so 7 chars&lt;/P&gt;&lt;P&gt; shift str left by a places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it doesn't work,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do a times.&lt;/P&gt;&lt;P&gt;   shift str left.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                       now you will get   str = YYYY&amp;lt;/&amp;gt;.&lt;/P&gt;&lt;P&gt;now ,&lt;/P&gt;&lt;P&gt;  str = str(4).     " finally you will get str = YYYY.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 12:43:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891439#M679536</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T12:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891440#M679537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Regular expressions are the best way of doing that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT  zregex.

DATA:
  tmp(20) TYPE c,
  pattern(50) TYPE c,
  s1(10) TYPE c,
  s2(10) TYPE c,
  s3(10) TYPE c,
  s4(10) TYPE c,
  s5(10) TYPE c,
  n      TYPE i,
  it_result TYPE match_result_tab.


tmp = '&amp;lt;ABC&amp;gt; XXXXYYYY &amp;lt;&amp;gt;'.
pattern = '.*(&amp;lt;.*&amp;gt;)(.*)(&amp;lt;&amp;gt;).*'.


FIND REGEX pattern
  IN tmp
  MATCH COUNT n
  RESULTS it_result
  SUBMATCHES s1 s2 s3 s4 s5.

write:/ s1, s2, s3.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Rainer Hübenthal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 12:44:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891440#M679537</guid>
      <dc:creator>rainer_hbenthal</dc:creator>
      <dc:date>2007-10-22T12:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891441#M679538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a bunch for your replies mates,  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Absolute peach of a logic there by Michael, was best suited for my smartform. That's the one I used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All rewarded &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 13:00:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extract-data-from-a-string/m-p/2891441#M679538</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T13:00:01Z</dc:date>
    </item>
  </channel>
</rss>

