Skip to Content
0

Conversion of DB type DEC to ABAP type P

Oct 04, 2017 at 05:55 PM

81

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Sandra Rossi Oct 05, 2017 at 06:36 AM
-1

There are hundreds of questions and answers in the forum about KONP-KBETR, can't you find the answer ?

Share
10 |10000 characters needed characters left characters exceeded
Horst Keller
Oct 05, 2017 at 05:50 AM
0
Share
10 |10000 characters needed characters left characters exceeded