Usage of Operator +n and (n) to pass data in ABAP


If my date format is in the form DDMMYYYY then Z_Period(4) equals DDMM so (4) means first four characters.

If my date format is in the form DDMMYYYY then Z_Period +4 equals YYYY so +4 means after the first four characters.

So If I say Z_PERIOD+2(2) then this would result MM- i.e. 2 characters after first 2.

Let us see how to use them in a program −

\Sample program to understand use of +n and n bit operators

data: lv_text(10) type c.
lv_text = "World".
write: / lv_text+2(2).

Output of this code would be “rl”
“+n” specifies a string offset
“n” specifies length of the string



Updated on: 13-Feb-2020

175 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements