<?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: Reverse a string using shift in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265622#M1529471</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Oct 2010 04:44:16 GMT</pubDate>
    <dc:creator>deepak_dhamat</dc:creator>
    <dc:date>2010-10-02T04:44:16Z</dc:date>
    <item>
      <title>Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265617#M1529466</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;A quick search could not provide me with an answer whether in ABAP we can reverse a string using the SHIFT keyword alone? I am not supposed to use the function or the offset and length. Also, my data object is a string type, not a character type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In which ever way I tried, I am breaking the code when characters repeat successive in the string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Oct 2010 19:05:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265617#M1529466</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-01T19:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265618#M1529467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;shift circular comes to mind...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you could get the length and shift circular up to lv_length places?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In NetWeaver 7.02, I think there's a statement that does....At least, I think I saw that in Thomas Jung's presentation on the future of ABAP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Oct 2010 19:18:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265618#M1529467</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-01T19:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265619#M1529468</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;&lt;/P&gt;&lt;P&gt;You can use code below as a FORM in your code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  x_string(50) TYPE c VALUE 'ABCDE',
  x_length     TYPE i,
  x_revert(50) TYPE c,
  x_index      TYPE i.


 x_length = strlen( x_string ) + 1.


 DO x_length TIMES.
    x_index = sy-index - 1.
    CONCATENATE x_string+x_index(1) x_revert INTO x_revert.
 ENDDO.

 WRITE x_revert.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Oct 2010 00:49:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265619#M1529468</guid>
      <dc:creator>former_member214857</dc:creator>
      <dc:date>2010-10-02T00:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265620#M1529469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The circular shift just shifts the first character tot he last and so on. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The catch is not to use the offset and length. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We could have acheived by using a combination of left right shift, but then the STRING data type will always contain all the characters however shifted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Oct 2010 01:36:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265620#M1529469</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-02T01:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265621#M1529470</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;&lt;/P&gt;&lt;P&gt; use function  STRING_REVERSE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Pass String  'Deepak'&lt;/P&gt;&lt;P&gt;  Language  keep blank it will take default  .&lt;/P&gt;&lt;P&gt; it will show output kapeed &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;Deepak.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Oct 2010 04:22:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265621#M1529470</guid>
      <dc:creator>deepak_dhamat</dc:creator>
      <dc:date>2010-10-02T04:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265622#M1529471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Oct 2010 04:44:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265622#M1529471</guid>
      <dc:creator>deepak_dhamat</dc:creator>
      <dc:date>2010-10-02T04:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265623#M1529472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use FM  &lt;STRONG&gt;CALL FUNCTION 'STRING_REVERSE'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ZSTRINGREV .

Parameters: p_string(200).
Data: r_string(100).

CALL FUNCTION 'STRING_REVERSE'
  EXPORTING
    STRING          = p_string
    LANG            = 'E'
 IMPORTING
   RSTRING          = r_string
 EXCEPTIONS
   TOO_SMALL        = 1
   OTHERS           = 2
          .
IF SY-SUBRC &amp;lt;&amp;gt; 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

*Inputted String.

Write:/ 'Inputted String', p_string.
SKIP.

*The reverse string.
Write:/ r_string.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: kk.adhvaryu on Oct 2, 2010 6:54 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Oct 2010 04:54:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265623#M1529472</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-02T04:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265624#M1529473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys, thanks for posting. But I guess you overlooked my question. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am supposed to use only the SHIFT and its variants. No offset, no function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Oct 2010 07:57:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265624#M1529473</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-02T07:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265625#M1529474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are allowed to use STRLEN keyword. You can try like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: gv_text      TYPE STRING VALUE 'Hello. How are you?',
      gv_text_temp TYPE STRING .

DATA: gv_length TYPE i,
      gv_index  TYPE i.

DATA: gt_char  TYPE TABLE OF c,
      gwa_char TYPE c.

gv_length = STRLEN( gv_text ).

gv_text_temp = gv_text.

DO gv_length TIMES.

  gv_index = gv_length - sy-index.

  SHIFT gv_text BY gv_index PLACES.

  gwa_char = gv_text.

  APPEND gwa_char TO gt_char.

  gv_text = gv_text_temp.

ENDDO.

LOOP AT gt_char INTO gwa_char.
  WRITE: gwa_char.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Oct 2010 09:05:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265625#M1529474</guid>
      <dc:creator>asik_shameem</dc:creator>
      <dc:date>2010-10-02T09:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265626#M1529475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Oct 2010 15:30:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265626#M1529475</guid>
      <dc:creator>sunojmichael1</dc:creator>
      <dc:date>2010-10-02T15:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265627#M1529476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A combination of SHIFT LEFT and SHIFT RIGHT CIRCULAR can do the trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PARAMETERS in_str TYPE string.

DATA : length TYPE i,
      index TYPE i,
      rev_str LIKE in_str,
      buf_str LIKE in_str.

length = STRLEN( in_str ).
index = length - 1.
buf_str = in_str.

DO length TIMES.
  SHIFT buf_str BY index PLACES.
  CONCATENATE rev_str buf_str INTO rev_str.
  buf_str = in_str.
  SHIFT buf_str BY sy-index PLACES RIGHT CIRCULAR.
ENDDO.

WRITE / rev_str.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Oct 2010 14:23:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265627#M1529476</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-06T14:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string using shift</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265628#M1529477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I thought you weren't supposed to use length.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Oct 2010 16:51:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reverse-a-string-using-shift/m-p/7265628#M1529477</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-06T16:51:48Z</dc:date>
    </item>
  </channel>
</rss>

