‎2007 May 08 10:17 AM
Hi all,
I am new to ABAP.
I want select first 4 char of variable.
Example:
X = '627128891'.
i want first 4 char of X save to Y.
Y= '6271'.
How can I do it with ABAP statement?
Thanks
Shiva.
‎2007 May 08 10:19 AM
‎2007 May 08 10:19 AM
‎2007 May 08 10:20 AM
DATA : X(10) TYPE C VALUE '627128891',
Y(4).
Y = X+0(4).
WRITE : / Y.
REGARDS
SHIBA DUTTA
‎2007 May 08 10:21 AM
You can also do the following in this way..
Data: x(9) type c value '627128891',
y(4) type c.
x = y.
so when you do this assignment then automatically only the first four value will onlu come bz it is of lenght 4.
I hope that it solves your query.
Regards,
Jayant
‎2007 May 08 10:21 AM
‎2007 May 08 10:21 AM
hi,
data x(10) type c value '1234567'.
data y(4) type c.
y = x0(4). " xn(m) n is the starting position and m no of character from n.
output y = 1234.. first four characters
y = x+2(2).
output y = 34 ..
rewards if understood..
regards,
nazeer
‎2007 May 08 10:21 AM
hi,
data:
x(10) type c,
y(10) type c.
x = '123456767'.
y = x+0(4).
write: y.
regards,
Naresh.
‎2007 May 08 10:22 AM
‎2007 May 08 10:24 AM
X = '627128891'
to get first 4 chars
X(4) this gives first 4 characters
concatenate X(4) Y into Y.
data X(10).
data y(10) value '6271'.
X = '627128891'.
concatenate X(4) Y into Y.
write : / Y.