05-17-2006 5:08 PM
Hi,
I declared a variable in this manner
<b>data : w_zkprs(15) type p decimals 4.</b>
My guess is the total length is 15 of which 4 are for decimals and 1 for dot and rest for the number . Is that right ?
Regards,
Ben.
05-17-2006 5:09 PM
05-17-2006 5:09 PM
05-17-2006 5:11 PM
Hi Rich,
The 15 include decimal position and dot ? AM I right ?
Regards,
Ben.
05-17-2006 5:15 PM
Hi Rich,
IN the case of P if the output length is 31 then what is the need to specify the number 15 ? It should give an error, right ?
Regards,
Ben.
05-17-2006 5:17 PM
05-17-2006 5:52 PM
Hi,
THe following si from SAP Help on PAcked numbers.. hope this will clarify your cinfucion..
"Type P data allows digits after the decimal point. The number of decimal places is generic, and is determined in the program. The value range of type P data depends on its size and the number of digits after the decimal point. The valid size can be any value from 1 to 16 bytes. Two decimal digits are packed into one byte, while the last byte contains one digit and the sign. Up to 14 digits are allowed after the decimal point. The initial value is zero. When working with type P data, it is a good idea to set the program attribute Fixed point arithmetic.Otherwise, type P numbers are treated as integers."
Regards,
Suresh Datti
05-17-2006 5:10 PM
05-17-2006 5:11 PM
hi daniel,
15 is for the whole number including the '.' and decimals 4 is 4 digits after the decimal point.
hope this helps,
priya.
05-17-2006 5:11 PM
Hi Daniel,
Nope, its 4 for decimals and the rest 11 for the non-decimal part of the number. Look at the output length for clues on how the entire number will look after formatting.
Regards,
Anand.
05-17-2006 5:13 PM
Yes, the 15 includes the decimal positions, I'm really not sure about the '.'.
For example, say we are talking about a TYPE P(15) decimals 4, the output length is actually 31. So knowing that a TYPE P field will give us 2 for 1, then gives us 30, which is one less than 31, which leads me to believe that the extra character is for the ".".
So, I think the correct assumption is that the 15 includes the decimals places, not the ".".
Regards,
Rich Heilman