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: 

Conversion

Former Member
0 Kudos
102

Hi,

I have two variables A and B, A is referring data element NTGEW_15 and B is referring data element NETWR

I declared C variable of type BRGEW_15.

In my program I am doing C = A* B.

The values of A and B are coming 151.000 and 100.00 at runtime.

After multiplying these two variables the variable c contains 1510000.000 but it should be 15100.000.

Please tell me where I did mistake.

My user settings contains in 1.234.567,89 format.

Please help me I will give points.

Thanks a lot in advance.

9 REPLIES 9

Former Member
0 Kudos
59

Make sure you have 'fixed point arithmetic' checked in the attibutes.

Rob

Former Member
0 Kudos
59

Hi,

change your decimal notations to '1,234,567.89' in ur user profile using Tcode SU3.

make sure that after changing you have to logoff and login again.

then test the same it will work.

find the sample code below.

data: l1 type NTGEW_15 value '151.000',

l2 type NETWR value '100.00',

res type BRGEW_15.

res = l1 * l2.

write:/ res.

Reward if useful.

Thanks,

Sreeram.

0 Kudos
59

Hello,

After changing also it is not working.

Thanks.

0 Kudos
59

Hi,

have you logged off after changing the setting in SU3, logoff first and then login again then only the changes will get effected.

Reward if useful,

Thanks,

Sreeram.

0 Kudos
59

I have the same decimals representation, and i had made a report with the multiplication and the result is correct. Perhaps the B variable don´t have 100.00, perhaps it is 10000.

How do you store the dates in the variables?

0 Kudos
59

it_item1-tot = vbdpr-ntgew * vbdpr-netwr.

vbdpr-ntgew contains the value 151.000

vbdpr-netwr contains 100.00

in development i also tested it is working fine but in quality it is giving problem but in both the cases user setting format is same.

former_member191735
Active Contributor
0 Kudos
59

my user settings are in other way but still coming up 1510000.000.

Copy all of them into char fields and then do your calculations.

Otherwise

c= c / 100.

Former Member
0 Kudos
59

hi ,

replace all occurences of ',' by space in A.

replace all occurences of ',' by space in b.

replace all occurences of ',' by space in c.

condense a.

condense b.

condense c.

c = a* b

0 Kudos
59

Hi,

try this

Data: w_a type p decimals 2,

w_b type p decimals 2,

w_c type p decimals 2.

move a to w_a.

move b to w_b.

w_c = w_a * w_b.

move w_c to c.

Regards..

FC