cancel
Showing results for 
Search instead for 
Did you mean: 

How to Store large value decimal data

Former Member
0 Kudos

Hi,

I need to do a numeric(divide) operation with larger decimal value. I have given the example below.

var1 = 12345678 ( 8 digits )

Var2 = 98765432 ( 8 digits )

I want to store the above numbers in a variable,

CONCATENATE var1 "." Var2 INTO var3.

var3 = "12345678.98765432"

var4 = var3 / 1000 ( this 1000 is variable between 1 to 100000000 )

var4 = "12345.67898765432"

and then I need to pick 4 digits before decimal and 5 digits after decimal and Post IDoc for Exchange Rate.

Final output needed = "2345.67898"

I am stuck in this place, TYPE P data store only 16 characters.

Please suggest a solution in this case.

Thanks,

Sivanandham.P

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

u can maintain one character type variable then move the values into the type p variable.try this it will work out.i had an exp. on this

thanks

Vinod_Chandran
Active Contributor
0 Kudos

Hi,

Try type F (Float). Declare all variable of type float.

Thanks

Vinod

Former Member
0 Kudos

Hi,

Thanks for your suggesstion, But TYPE F saves the data as "123.34000E+02" format.

But i want to store the data in the exact format as mentioned below, please suggest a idea on how to proceed with this, I am really stuck at this point

Data to be stored : "12345678.98765432"

Thanks,

Sivanandham.P

Vinod_Chandran
Active Contributor
0 Kudos

Hi,

Do you want to store this value in a table or only display? If you want to display the decimals use the following option.

WRITE var DECIMALS 20. "output: 1.25456000000000E+04

Thanks

Vinod

athavanraja
Active Contributor
0 Kudos

you could try FM

MURC_ROUND_FLOAT_TO_PACKED to convert the float.

data: a type float ,
      b type p decimals 10 .

      a = '123.34000E+02' .

CALL FUNCTION 'MURC_ROUND_FLOAT_TO_PACKED'
  EXPORTING
    if_float                    = a
   IF_SIGNIFICANT_PLACES       = 10
 IMPORTING
   EF_PACKED                   = b
 EXCEPTIONS
   OVERFLOW                    = 1
   OTHERS                      = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Regards

Raja