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

while divide the value..

Former Member
0 Likes
677

Hi,

DATA : L_KBETR TYPE P DECIMALS 2 VALUE 0.

BREAK-POINT. "TAX

SELECT single KBETR FROM KONP INTO G_KBETR

WHERE KSCHL = 'JIP6'

AND MWSK1 = 'V7'.

MOVE G_KBETR TO L_KBETR.

IF SY-SUBRC = 0.

L_KBETR = L_KBETR DIV 10.

ADD L_KBETR TO LTAX.

GV_TAX = GV_TAX + LTAX.

ENDIF.

here l_kbetr contain 125

after devide it contain 12 not 12.5..what is reason? could u suggest me..

4 REPLIES 4
Read only

Former Member
0 Likes
579

well it´s the div statement, it calculates only full values. try / instead.

div is an extra operator like MOD

Read only

Former Member
0 Likes
579

Hi,

'/' ->Division of the left by the right operand, it will give 12.50.

'DIV' ->Integer portion of the division of the left by the right operand , so this will return value 12.00 as per ur case.

Read only

Former Member
0 Likes
579

Hi

instead of

L_KBETR = L_KBETR div 10 .

use

L_KBETR = L_KBETR / 10 .

because if u use L_KBETR = L_KBETR div 10 . and l_kbetr = 125 ur equation

L_KBETR = L_KBETR div 10 . will give result 12 not 12.5 .

regards

Read only

Former Member
0 Likes
579

Hi

use '/' operator if u use DIV u will never get decimals

reward points to all helpful answers

kiran.M