‎2008 Mar 19 4:46 PM
Hi all,
i have a requirement where i have to multiply 3 fields, and get that result into fourth field.
example:
data: f1 type dec, [Data type - Decimal; length 7]
f2 type dec, [Data type - Decimal; length 7]
f3 type quan. [Data type - Quantity; length 17]
data: f4 type ??
f4 = f1 * f2 * f3.
what will the data type of field f4?
Will field f4 be of decimal type. If yes, then what is the declaration syntax of f4.
can i declare it as:
data: f4 type dec.
When i do this, i get an error saying type DEC is unknown.
NOTE: For your information.I AM IMPLEMENTING THIS IN A method inside a BADI.
Points will be rewarded.
Thanks in advance.
‎2008 Mar 19 5:02 PM
Hi
There's not a real difference beetween a quan and decimal number, because both number are decimals number, anyway the quan is a decimal number with a dimension: the unit of measure.
So your fourth number should be a quan number too: if you multiply a number and quantity u'll obtain a quantity.
It's very important the size of that number because you need to prevent a dump for overflow, probably it can quan number of the same size of f3.
Max
‎2008 Mar 19 5:08 PM
Hi Max,
thanks for your answer. That was really helpful. The data type of the fourth field will be quan, and i will keep in mind the size of the quan field(f4).
‎2008 Mar 19 5:15 PM
Hi Max,
can you give me the syntax for declaring the field using a quan data type.
‎2008 Mar 19 5:29 PM
Hi
U need to use a reference to a dictionary field (like MSEG-MENGE) because there isn't an abap type to be used, the data type are only these:
C Character
N Numeric string
D Date (YYYYMMDD)
T Time: HHMMSS)
X Byte (hexadecimal)
I Integer
P Packed number
F Floating point number
STRING String Variable empty string
If there isn't a dictionary field good for you, u can only use the type P.
So or:
DATA F4 TYPE MSEG-MENGE. (this field has 3 decimals)
or
DATA F4(16) TYPE P DECIMALS 2.
Max