2009 Jan 03 9:52 AM
Hi all,
The program uses packed decimals to declare a field WRBTR(G_WRBTR(7) TYPE P Decimals 2) but inside the program while computing it is accecpting 9 characters with 2 decimals.When I try to manipulate with 12 digits in debugging mode then it is going for dump.
Could you please clarify how it is working?
Thanks in advance.
2009 Jan 03 10:01 AM
The logic is very simple
for E;g
DATA :
w_p(9) TYPE p DECIMALS 2.
w_p = '0123456789012345.12'.
WRITE :
/ w_p.formula is 9 * 2 = 18 total
18-2 = 16 Number of digits before the decimal part begins
2009 Jan 03 10:08 AM
2009 Jan 03 10:11 AM
Avinash then what can be the output of the below snippet it is giving only One
DATA :
w_p TYPE c.
w_p = '12'.
WRITE :
/ w_p.
2009 Jan 03 10:11 AM
Avinash then what can be the output of the below snippet, the o/p is one
DATA :
w_p TYPE c.
w_p = '12'.
WRITE :
/ w_p.
2009 Jan 03 10:08 AM
Hi,
WRBTR domain is WERT7 which is a CURR data type with No of Char 13 and decimals 2
So thats why it must be taking values upto 9 digits also.
7 is only internal length for that domain.
Just check the domain of that field and any ref field assigned to it.
Correct me if i am wrong.
Regards
Bala Krishna
2009 Jan 03 2:01 PM
Hi Murugaperumal,
you may take a look at the special way ABAP is handling currency values: In dictionary database you are forced to link the curreny field (data type CURR) to a curreny key field (data type CUKY). CUKY carries the currency as USD, EUR and so on. This determines also the handlling of currencies with less than 2 (japanese yen, no decimals) or more than 2 decimals (i.e. EUR4 used in retail prices to cope with big quantities).
If the linkes currency key field is present, it will be considered for all input/output operations.
And then, a second useful information: Packed Decimals are a concept developed when storing space was expensive: 2 digits are stored in one byte because only 4 bits are used for each character. You will not notice that except in the data definition: A length of 7 bytes means it can store 13 digits and a sign (+/-).
The Packed Decimal consept is still used in databases becauses it can save a lot of space and the store values can still be easily read because the packing/unpacking is simple and is done on a very low (hardware) level.
Regards,
Clemens
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |