2009 Apr 24 2:54 PM
Code Snippet:
REPORT ZMKTEST6.
data : f1(2) type c,
f2(2) type c,
f3(10) type n value '12345'.
clear: f1 with 'X',
f2 with f1,
f3 with '3'.
write 😕 f1 ,f2, f3.
Process Error:
The field "F1" must have the length 1.
2009 Apr 24 3:01 PM
Whenever you use CLEAR..WITH val, the length of val must be 1
Code Snippet:
REPORT ZMKTEST6.
data : f1(2) type c,
f2(2) type c,
f3(10) type n value '12345'.
clear: f1 with 'X',
f2 with f1,
f3 with '3'.
write 😕 f1 ,f2, f3.
Process Error:
The field "F1" must have the length 1.
2009 Apr 24 2:57 PM
hi ,
ther is not syntax with clear with 'X".
but you can do one thing to get the one character.
REPORT ZMKTEST6.
data : f1(2) type c,
f2(2) type c,
f3(10) type n value '12345'.
clear: f1 with 'X', "Comment this
f1 = f1+0(1). "write this
f2 with f1,
f3 with '3'.
write :/ f1 ,f2, f3.
now f1 containd one charater instead of 2.
now you can display as usuall
2009 Apr 24 3:01 PM
Whenever you use CLEAR..WITH val, the length of val must be 1
2009 Apr 24 3:23 PM
A variant of this snippet was given in SAMS Teach yourself ABAP in 21 days.
(Listing 9.5)
I was told that this book is flawless.
He gives this output for the code for f2 as XX
2009 Apr 24 3:29 PM
REPORT YSAT_TEMP1.
data : f1(1) type c, " -- F1 length should be 1 char type
f2(2) type c,
f3(10) type n value '12345'.
clear: f1 with 'X',
f2 with f1,
f3 with '3'.
write :/ f1 ,f2, f3.Result:
X XX 3333333333Thanks
~Satya
2009 Apr 27 7:31 AM
Thank You Very much.
The Literature I was referring to was for release 4.1.
Hence I had these doubts. Now it is clear.
Thanks Everyone!
2009 Apr 24 3:11 PM
addition to Das's code :
data : f1(2) type c,
f2(2) type c,
f3(10) type n value '12345'.
clear: f1 with 'X'.
f2 = f1+0(1).
clear : f3 with '3'.
write :/ f1 ,f2, f3.
2009 Apr 24 3:18 PM
But this is showing only one X in f2. What about the other character? length of f2 has been defined as 2.
2009 Apr 24 3:23 PM
data : f1(2) type c,
f2(2) type c,
f3(10) type n value '12345'.
clear: f1 with 'XX'. " IF YOU NEED TWO
CELAR: f2 WITH f1.
clear : f3 with '3'.
write :/ f1 ,f2, f3.
or
clear: f1 with 'X'.
f2+0(1) = f1.
F2+1(1) = F1.
clear : f3 with '3'.
write :/ f1 ,f2, f3.
2009 Apr 24 3:27 PM
Try:
DATA : f1(2) TYPE c,
f2(2) TYPE c,
f3(10) TYPE n VALUE '12345'.
CLEAR: f1 WITH 'X',
f2 WITH 'X',
f3 WITH '3'.
WRITE :/ f1 ,f2, f3.Rob
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |