SAP StackFICOHRMMSDPMPSABAPNetWeaverTablesTcodes ☰MENU

ABAP SHIFT statement for string , deleting leading and trailing additions

SHIFT keyword in ABAP is used for shifting the characters in a string to left , right or circular. There are many options like how many places should shift, and from which character should shift happen etc with this statement. We will get a clear idea by going through various usage of this keyword as follows.

Additions used with

Usage 1

DATA NUMBERSTRING(10) VALUE ‘0123456789’.
SHIFT NUMBERSTRING.

Result : Now the NUMBERSTRING will be ‘123456789’ ( by default it will shift to LEFT direction )

Usage 2

Result : NUMBERSTRING will be ‘012345678’

Usage 3

Result : NUMBERSTRING will be ‘1234567890’ ( now the missing left side character comes into the right end. That means it will shift circularly )

Usage 4

Result : NUMBERSTRING will be ‘9012345678’

Usage 5

Result : NUMBERSTRING will be ‘56789’ ( Here it specifies how many characters should shifted ) We can use the same RIGHT, LEFT, CIRCLAR additions with this type of shifting

Usage 6

Result : NUMBERSTRING will be ‘456789’ ( It will search the string 456 in main string and will do the shift till the searched string will be one left side )

Usage 6

Result : NUMBERSTRING will be ‘4567890123’

Other usages

DELETING LEADING addition can be used for deleting the leading blanks in a string.

SAP ALECRMSCMSRMSAP Solutions SAP ReferencesSAP BasicsPP ModuleWMSAP Partners
HomeContact & Privacy PolicyTwitter
All of the product names here are trademarks of their respective companies. The site sapstack.com is not affiliated with SAP AG.
©2024 sapstack.com