Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Character String and Byte String Processing →  Statements for Character String and Byte String Processing 


Short Reference

Other versions: 7.31 | 7.40 | 7.54


SHIFT dobj [ {[places]
[direction]} | deleting ] 
           [IN {CHARACTER|BYTE} MODE].




This statement shifts the content of a variable dobj. In places, you can specify the number of places to be shifted and in direction the direction of the shift. In deleting, you can specify which characters to delete from the data object by the shift. If you use no addition at all, then the content is shifted to the left by one place.

By default, free places created by the shift are filled with blanks or hexadecimal 0 for data objects of fixed length, depending on the kind of processing. Data objects of type string or xstring are shortened by the number of shifted places when shifted to the left, and lengthened by the number of shifted places when shifted to the right.

When the character string is processed, the closing blank characters are considered for data objects dobj of fixed length.


To shift a string in an operand position, shift functions that cover part of the functionality of the SHIFT statement can be used.




The optional IN {CHARACTER|BYTE} MODE addition determines whether character string or byte string processing is carried out. If the addition is not specified, character string processing is carried out. Depending on the processing kind, dobj, substring and mask must be character-like or byte-like.


SHIFT - places

SHIFT - direction

SHIFT - deleting