Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

No. of characters Decimal and Output length

karthick1608
Participant
0 Kudos

Hi All,

I have one small doubt.

Can anyone please help me to understand the maximum possible values for No. of characters :13, Dec: 3

and Output len:17.

Because, I am facing the dump issue.

Waiting for the quicker response.

Thanks

1 ACCEPTED SOLUTION

ArthurParisius
Contributor
0 Kudos

Just did a simple test with a DEC 13 Dec 2 and it looks like 13 characters including decimals. So max 11 before decimals. In your case I think that would be max 10 before the decimals.

5 REPLIES 5

ArthurParisius
Contributor
0 Kudos

Just did a simple test with a DEC 13 Dec 2 and it looks like 13 characters including decimals. So max 11 before decimals. In your case I think that would be max 10 before the decimals.

0 Kudos

Hi Arthur,

Thanks for your response.

So you are saying like this may be the possible value - 1234567890.99

If I am correct, for this one, what may be the output length. If wrong please correct me.

r010101010
Active Participant
0 Kudos

Hello Karthick,

The output length is calculated on the values, the decimal sign, the negative sign (if any) and also the thousands separaters.

:13, Dec: 3 and Output len:17.

Example for the a variable on the type that you declared, in your case with no sign negative values allowed you will have : 1,234,567,890.123

ArthurParisius
Contributor
0 Kudos

The value would be 12345678901.99 for my test. For yours it would probably be 1234567890.999 As for the output length see the answer from Deenesh Ramrekha.

former_member564522
Active Participant
0 Kudos

Hello Karthick,

Output length is dependent upon the data type that being used .

if you are using the curr type then No of characters = sign + 11 digits + dot/comma

Decimal = number of decimals

type CURR has min Value = -99999999999.99

If you are using type as P then value range: (-10^(2len-1) +1) / (10^(+dec)) to (+10^(2len-1) -1) /(10^(+dec)) in increments of 10^(-dec)

You can use the below code to check the max and min value for any type


DATA: pack   TYPE p LENGTH 15 DECIMALS 2,

      result TYPE REF TO data.



FIELD-SYMBOLS <result> TYPE ANY.

result = cl_abap_exceptional_values=>get_min_value( pack ).

IF result IS NOT INITIAL.

  ASSIGN result->* TO <result>.

  cl_demo_output=>write_data( <result> ).

ENDIF.

result = cl_abap_exceptional_values=>get_max_value( pack ).
IF result IS NOT INITIAL.

  ASSIGN result->* TO <result>.

  cl_demo_output=>write_data( <result> ).

ENDIF.
cl_demo_output=>display( ).