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

FLOAT SUM

Former Member
0 Likes
704

HI GEMS,

WHEN I AM EXECUTING THIS CODE THE GRAND TOTAL IS COMING LIKE 2.0079591000000000E+05

BUT THE ACTUAL TOTAL SHOULD BE 200795.91.

HOW TO GET THIS TOTAL.BOTH ARE SAME BUT DIFFERENCE IN DECIMALS.

TAKE VALUE FOR HKONT AS-0000334551 AND TRY

DATA: BEGIN OF ITAB OCCURS 1,

HKONT LIKE BSIS-HKONT,

DMBTR LIKE BSIS-DMBTR,

END OF ITAB.

PARAMETERS :P_HKONT(10) TYPE C.

DATA : SUM TYPE F.

SELECT HKONT DMBTR

FROM BSIS

INTO TABLE ITAB

WHERE HKONT = P_HKONT AND

SHKZG = 'H'.

WRITE 😕 ITAB-HKONT.

loop at itab.

AT NEW DMBTR.

sum = SUM + ITAB-DMBTR.

ENDAT.

AT LAST .

WRITE 😕 'GRAND TOTAL IS :', SUM.

ENDAT.

endloop.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
598

Hi Amit,

try SUM like BSIS-DMBTR.

Regards, Dieter

4 REPLIES 4
Read only

Former Member
0 Likes
598

write:/ sum exponent 0. "this will do.

P.s: your logic seems to be flawed though.

Read only

Laxmana_Appana_
Active Contributor
0 Likes
598

Hi,

Declare the SUM like :

DATA : SUM like BSIS-DMBTR.

Regards

Laxman

Read only

Former Member
0 Likes
599

Hi Amit,

try SUM like BSIS-DMBTR.

Regards, Dieter

Read only

Former Member
0 Likes
598

use the function module 'QSS0_FLTP_TO_CHAR_CONVERSION'

CALL FUNCTION 'QSS0_FLTP_TO_CHAR_CONVERSION'

EXPORTING

i_number_of_digits = 16

i_fltp_value = TOTAL

i_value_not_initial_flag = 'X'

i_screen_fieldlength = 16

IMPORTING

e_char_field = char_field.

-Kiran

*Please reward useful answers