As a part of a program, I fetch KBETR from KONP.

KBETR is defined as DEC length 11 and Decimals 2 but for calculation purposes I want the decimals to be 5 places. Hence I am declaring a variable of type P with decimals 5.

Questions:

1. At the data dictionary level, KBETR is based on the domain WERT6 with length 11 and decimals 2. The O/P length is 16....how is this? The max # of digits for a variable defined with reference to KBETR is '123456789.22'. This translates to 123,456,789.22 which is 15 character (including a sign)...so why is ths O/P length set to 16?

2. In order to define a variable in ABAP program of type P which resembles KBETR but with 5 decimals, what should be the length of this variable of type P. Based on SAP documentation, I see the below:

DEC1-310Packed number BCD formatp, length (m+1)/2

Hence, I declared:

DATA: var TYPE p LENGTH 6 [(m+1)/2] DECIMALS 5. (Length 6 since KBETR is of length 11). but with this declaration, I get an overflow when I assign the value 123456789.22 into my variable of type P.

Can you please help me understand the necessary conversion?

Thanks,

Vikram.M

## Add comment