If two variables have different data types or lengths, the data is converted when it is moved. This is called an
. If the lengths of the sending and receiving variables do not match, an automatic
adjustment is performed. If the data types do not match, an automatic
adjustment is performed.
If the data types of the sending and receiving fields are the same but the lengths differ, a length adjustment is performed . The effect is shown in the table below where
1 report ztx0906.
2 constants >(3) value '==>'. "defines a constant named '>'
3 data: fc(10) type c value '-A1B2C3.4',
4 fn(10) type n,
5 fp type p,
6 fd type d,
7 ft type t,
8 fx(4) type x,
9 fc1(5) type c value '-1234',
10 fc2(5) type c value '1234-',
11 fp1 type p value 123456789,
12 fp2 type p value '123456789-',
13 fp3 type p value 1234567899,
14 fp4 type p value 12345678901,
15 fp5 type p value 12345,
16 fp6 type p value 0.
17
18 fn = fc. write: / fc, >, fn, 'non-numeric chars are ignored'.
19 fd = 'ABCDE'. write: / fd, 'date and time fields are invalid'.
20 ft = 'ABCDE'. write: / ft, ' when you load them with junk'.
21 fp = sy-datum. write: / sy-datum, >, fp, 'd->p: days since 0001/01/01'.
22 fp = sy-uzeit. write: / sy-uzeit, >, fp, 'd->t: secs since midnight'.
23 fx = 'A4 B4'. write: / 'A4 B4', >, fx, 'ignore all after invalid char'.
24 fp = fc1. write: / fc1, >, fp, 'allows leading sign'.
25 fp = fc2. write: / fc2, >, fp, 'also allows trailing sign'.
26 fc = fp1. write: / fp1, >, fc, 'rightmost byte reserved for sign'.
27 fc = fp2. write: / fp2, >, fc, 'only negative numbers use it, but'.
28 fc = fp3. write: / fp3, >, fc, '+ve nums that need it use it too'.
29 fc = fp4. write: / fp4, >, fc, 'overflow indicated by leading *'.
30 fc = fp5. write: / fp5, >, fc, 'leading zeros are suppressed'.
31 fc = fp6. write: / fp6, >, fc, 'zero in = zero out'.
32 fp = ' '. write: / ' ', >, fp, 'blanks in = zero out'.
OUTPUT:
-A1B2C3.4 ==> 0000001234 non-numeric chars are ignored
E ABCD date and time fields are invalid
ABCDE0 when you load them with junk
1998/02/22 ==> 729,443 d->p: days since 0001/01/01
14:57:05 ==> 53,825 d->t: secs since midnight
A4 B4 ==> A4000000 ignore all after invalid char
-1234 ==> 1,234- allows leading sign
1234- ==> 1,234- also allows trailing sign
123,456,789 ==> 123456789 rightmost byte reserved for sign
123,456,789- ==> 123456789- only negative numbers use it, but
1,234,567,899 ==> 1234567899 +ve nums that need it use it too
12,345,678,901 ==> *345678901 overflow indicated by leading *
12,345 ==> 12345 leading zeros are suppressed
0 ==> 0 zero in = zero out
==> 0 blanks in = zero out