Skip to Content
0
May 05, 2022 at 06:42 AM

SHIFT UP TO RIGHT statement return whole words

66 Views Last edit May 05, 2022 at 06:45 AM 3 rev

If I understand correctly (By read the SAP Documentation and many example code from the website). The SHIFT <string> UP TO <needle> RIGHT statement will find needle in string. If it find out it will return the substring start from the first letter of the needle to the begining of the word. So I coding like this:

DATA text TYPE string.

text = `12345`.
SHIFT text UP TO `3`.
write / `UP TO = ` && text. text = `12345`. SHIFT text UP TO `3` CIRCULAR. write / `UP TO CIRCULAR = ` && text. text = '12345'.
SHIFT text UP TO '3' RIGHT.
write / `UP TO RIGHT = ` && text.
text = `12345`.
SHIFT text UP TO `3` RIGHT CIRCULAR.
write / `UP TO RIGHT CIRCULAR = ` && text.

2022-05-05-13-37-20-test-create-abap.jpg

Why did it output like this? Not 123.