<?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: ABAP Substring function from right side in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215586#M1523161</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sume,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please see code below. just reuse function rsubstring according to your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  ZTEST99.

DATA str TYPE STRING.
DATA str2 TYPE STRING.

str = 'MyNameIsBush'.
WRITE: / str.

PERFORM rsubstring
    USING
        str
        4
        2
    CHANGING
        str2
.

WRITE: / str2.


FORM rsubstring
    USING
        str TYPE STRING
        offset
        len
    CHANGING
        out TYPE STRING
.
    DATA:
        strln TYPE i,
        l_offset TYPE i,
        l_len TYPE i
    .

    strln = STRLEN( str ).
    l_offset = strln - offset - len.
    l_len = len.
    out = str+l_offset(l_len).
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Aug 2010 02:52:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-08-04T02:52:18Z</dc:date>
    <item>
      <title>ABAP Substring function from right side</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215584#M1523159</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 want a substring function in ABAP, which starts from right instead of left to display some character out of a complete string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose there is a variable &lt;STRONG&gt;zdatavar&lt;/STRONG&gt; - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zdatavar = 'MyNameIsBush'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zdatavar = zdatavar+4(2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above will start from the left.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want some function which start from the right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your help will be greately appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;SC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 23:45:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215584#M1523159</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-03T23:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Substring function from right side</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215585#M1523160</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;there is no standad ABAP command which supports this. You need to get length of string with STRLEN and then convert it proper index. Another solution could be to reverse string and then use standard syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 23:51:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215585#M1523160</guid>
      <dc:creator>mvoros</dc:creator>
      <dc:date>2010-08-03T23:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Substring function from right side</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215586#M1523161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sume,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please see code below. just reuse function rsubstring according to your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  ZTEST99.

DATA str TYPE STRING.
DATA str2 TYPE STRING.

str = 'MyNameIsBush'.
WRITE: / str.

PERFORM rsubstring
    USING
        str
        4
        2
    CHANGING
        str2
.

WRITE: / str2.


FORM rsubstring
    USING
        str TYPE STRING
        offset
        len
    CHANGING
        out TYPE STRING
.
    DATA:
        strln TYPE i,
        l_offset TYPE i,
        l_len TYPE i
    .

    strln = STRLEN( str ).
    l_offset = strln - offset - len.
    l_len = len.
    out = str+l_offset(l_len).
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 02:52:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215586#M1523161</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-04T02:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Substring function from right side</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215587#M1523162</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;Please check if this is working.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  Z0804.

DATA str TYPE STRING.
DATA str2 TYPE STRING.

str = 'MyNameIsBush'.
WRITE: / str.

PERFORM rsubstring
    USING
        str
        2
    CHANGING
        str2
.

WRITE: / str2.


FORM rsubstring
    USING
        str TYPE STRING
        len
    CHANGING
        out TYPE STRING
.
    DATA:
        strln TYPE i,
        l_offset TYPE i,
        l_len TYPE i
    .

    strln = STRLEN( str ).
    if strln GE len.

    l_offset = strln - len.
    l_len = len.
    out = str+l_offset(l_len).

    endif.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;result:&lt;/P&gt;&lt;P&gt;MyNameIsBush&lt;/P&gt;&lt;P&gt;sh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Xiang Li&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 03:34:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215587#M1523162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-04T03:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Substring function from right side</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215588#M1523163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for sugegstions.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 18:15:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-substring-function-from-right-side/m-p/7215588#M1523163</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-04T18:15:44Z</dc:date>
    </item>
  </channel>
</rss>

