10-17-2011 12:13 PM
Hello,
I ran this statement: DATA x(2) TYPE i value 234.
I thought the value of x should be 23, because i defined it with the lenght of 2 bytes.
In the sap help i found that the lenght of an integer is 4. But i can define DATA x(5).
I am little confused.
Thanks,
Efren
10-17-2011 12:18 PM
Just perform a syntax check (not an activation) and you will get the answer "Length specification not allowed with type "I".", Here the editor allows you an invalid input, only raising a warning. As integer length is always 4 bytes, your (2) or (5) are ignored by compiler. (if you want to give a length use a TYPE "N" where you get one byte per digit, what you were wrongly expecting for integer which are stored in binary)
Regards,
Raymond
10-17-2011 12:18 PM
Just perform a syntax check (not an activation) and you will get the answer "Length specification not allowed with type "I".", Here the editor allows you an invalid input, only raising a warning. As integer length is always 4 bytes, your (2) or (5) are ignored by compiler. (if you want to give a length use a TYPE "N" where you get one byte per digit, what you were wrongly expecting for integer which are stored in binary)
Regards,
Raymond
10-17-2011 12:29 PM
Right.
But when i define DATA x TYPE i value 23231234, the value of x shouldn't be 2323? Because the lenght if 4 no?
Thanks.
10-17-2011 12:34 PM
No you confuse between type "I" integer, stored binary mode, and type "N" stored in character mode
23231234 is stored
- "01627B02" in binary/integer - TYPE I
- "23231234" in numc/char non-unicode - TYPE N on a non-Unicode system
- "0031003200330034" in numc/char unicode - TYPE N on a Unicode system
Remarks :
- TYPE N allows a length declaration.
- TYPE I allows a range from -2147483648 to +2147483647 (4294967296 different values 2^32, minus sign)
Regards,
Raymond
10-17-2011 12:35 PM