<?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: Retrieve position and text from String in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776884#M1585031</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 managed to come right on my own using the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WORD = '14JUL-DO-HOU/CF-TEST/ST-1435/W-PROD 0601 VNDR 11195 HOLIDAY AUTOS S/NM-REDELINGHUIS ALETHAMRS/DT-2035/RT-ZAR5000/W-PROD 0601 '.
SPLIT WORD AT '/RT-' INTO FIRST_HALF SECOND_HALF.
SPLIT SECOND_HALF AT '/' INTO FIRST_HALF SECOND_HALF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIRST_HALF now contains the value "ZAR5000"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Mar 2011 07:00:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-03-28T07:00:06Z</dc:date>
    <item>
      <title>Retrieve position and text from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776880#M1585027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a string example displayed below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;14JUL-DO-HOU/CF-TEST/ST-1435/W-PROD 0601 VNDR 11195 HOLIDAY AUTOS S/DT-2035/RT-ZAR5000/TJ-54IMP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to find the value prefixed by "/RT-" and then retrieve the text up until the next "/".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EG. The result needs to be "ZAR5000" from the example string above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone please show me how to do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance&lt;/P&gt;&lt;P&gt;Anton Kruse&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 06:03:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776880#M1585027</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-28T06:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve position and text from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776881#M1585028</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;Below sample program . and apply same logic in your program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameter: p_str type char250.

data: lv_off type i,
      lv_i type i,
      lv_j type i,
      lv_str TYPE string.


FIND FIRST OCCURRENCE OF '/RT-'
    IN p_str
    IGNORING CASE
    MATCH OFFSET lv_off.

IF moff NE 0.
lv_i = lv_off + 4.
while p_str+lv_i(1) NE '/'.
CONCATENATE lv_str p_str+lv_i(1) INTO lv_str.
lv_i = lv_i + 1.
ENDWHILE.
ENDIF.

write: lv_str.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shankar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 06:29:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776881#M1585028</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-28T06:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve position and text from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776882#M1585029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anton,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the below example you can do this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Write Code as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
                  search string for '/RT-'.
                  clear lv_position.
                 ( sy-fdpos will give u the position of /RT )
                  lv_position = sy-fdpos + 7.    ( get the position of the text ZAR5000 into a variable called lv_position).
                  final_name  = w_t513s-stltx+lv_position. ( get the name into your desired variable like this )
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you still have any issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Guru.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 06:33:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776882#M1585029</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-28T06:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve position and text from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776883#M1585030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anton,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try beow code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: str TYPE string,
      str1 TYPE string.
DATA: result_tab TYPE match_result_tab,
      wa TYPE match_result.
DATA: len TYPE i,
      len1 TYPE i,
      cnt TYPE i VALUE 0,
      moff TYPE i.
DATA: final TYPE TABLE OF string,
      wa1 LIKE LINE OF final.

str = '14JUL-DO-HOU/CF-TEST/ST-1435/W-PROD 0601 VNDR 11195 HOLIDAY AUTOS S/DT-2035/RT-ZAR5000/TJ-54IMP'.
len = STRLEN( str ).

FIND ALL OCCURRENCES OF '/RT-' IN str RESPECTING CASE
RESULTS result_tab.

LOOP AT result_tab INTO wa.
  moff = wa-offset + 4.
  len1 = len - moff.
  wa1 = str+moff(len1).
  APPEND wa1 TO final.
ENDLOOP.

LOOP AT final INTO wa1.
  len = STRLEN( wa1 ).
  DO len TIMES.
    IF wa1+cnt(1) = '/'.
      wa1 = wa1+0(cnt).
      MODIFY final FROM wa1. " Final internal table containing all the texts
      EXIT.
    ENDIF.
    cnt  = cnt + 1.
  ENDDO.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 06:45:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776883#M1585030</guid>
      <dc:creator>awin_prabhu</dc:creator>
      <dc:date>2011-03-28T06:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve position and text from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776884#M1585031</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 managed to come right on my own using the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WORD = '14JUL-DO-HOU/CF-TEST/ST-1435/W-PROD 0601 VNDR 11195 HOLIDAY AUTOS S/NM-REDELINGHUIS ALETHAMRS/DT-2035/RT-ZAR5000/W-PROD 0601 '.
SPLIT WORD AT '/RT-' INTO FIRST_HALF SECOND_HALF.
SPLIT SECOND_HALF AT '/' INTO FIRST_HALF SECOND_HALF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIRST_HALF now contains the value "ZAR5000"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 07:00:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776884#M1585031</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-28T07:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve position and text from String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776885#M1585032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI check the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: v_st TYPE string VALUE '14JUL-DO-HOU/CF-TEST/ST-1435/W-PROD 0601 VNDR 11195 HOLIDAY AUTOS S/DT-2035/RT-ZAR5000/TJ-54IMP',
      str1 type string,
      str2 TYPE string,
      str3 TYPE string.
START-OF-SELECTION.

SPLIT v_st at '/RT-'  INTO str1 str2.

WRITE:/ str1,
      / str2.
SPLIT str2 at '/'  INTO str3 str1.
WRITE:/ str3.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2011 07:00:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-position-and-text-from-string/m-p/7776885#M1585032</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-28T07:00:53Z</dc:date>
    </item>
  </channel>
</rss>

