Application Development and Automation 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: 
Read only

Computation with currency

Former Member
0 Likes
1,218

Dear All,

My scenario is like this:

1. I have to do a computation based on 2 variables.

Data: V1 type WERTV7,    (CURR 13)

         V2 type UKURSP.    (Decimals 9)

2. The values across the above 2 variables are:

v1 = 11846153200.00.

v2 = 65.00000.

3. The Computation which has to be done is:

v1 = v1 * v2.

4. Now, I get a runtime error saying "Overflow during the arithmetical operation (type P) in program"

5. I tried many FMs mentioned in this FORUM like ROUND, CHAR_FLTP_CONVERSION, QSS0_FLTP_TO_CHAR_CONVERSION etc.

But, while moving the final value I face a runtime error.

Could you please help me in fixing this ?

Regards,

Deepu.K

Dear All,

My scenario is like this:

1. I have to do a computation based on 2 variables.

Data: V1 type WERTV7,    (CURR 13)

         V2 type UKURSP.    (Decimals 9)

2. The values across the above 2 variables are:

v1 = 11846153200.00.

v2 = 65.00000.

3. The Computation which has to be done is:

v1 = v1 * v2.

4. Now, I get a runtime error saying "Overflow during the arithmetical operation (type P) in program"

5. I tried many FMs mentioned in this FORUM like ROUND, CHAR_FLTP_CONVERSION, QSS0_FLTP_TO_CHAR_CONVERSION etc.

But, while moving the final value I face a runtime error.

Could you please help me in fixing this ?

Regards,

Deepu.K

2 REPLIES 2
Read only

Clemenss
Active Contributor
0 Likes
752

For type CURR fields you must know the number of decimals configured for the related currency key. So yu may have to muliply with /divide by multiples of 10.

Then you can put everything to a type F variable, no danger of overflow. Check the result and write back to currency variable again muliply with /divide by multiples of 10

to get correct result.

Regards

Clemens

Read only

nomssi
Active Contributor
0 Likes
752

The maximum value a field of data type WERTV7 can contain is 99999999999.99 (13 chars with 2  decimals). The result of operation 65 * 11846153200.00 = 769999958000.00 ( 14 chars) does not fit.

Use a variable with a larger range (e.g. WERTV8) for field V1.

JNN