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

command DIV

paulo_caiana
Explorer
0 Likes
1,543

Hi experts,

Iam using the command DIV, but my result is wrong. The result should be 0.001898, but the result is 0.000.

See the code bellow:

DATA: wa_bseg_dmbtr TYPE bseg-dmbtr,

           l_dmbtr_t          TYPE bseg-dmbtr,

           l_valor              TYPE bseg-dmbtr.

*

wa_bseg_dmbtr = '9939.74'.

l_dmbtr_t = '18.87'.

l_valor =  l_dmbtr_t DIV wa_bseg_dmbtr.

*

WRITE l_valor.

any suggestions?

thanks,

Paulo...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
883

Hi Paulo,

Statement DIV returns only the integer part of the division, while MOD returns the reminder of the division.

You can learn more here: Arithmetic Calculations - ABAP Programming (BC-ABA) - SAP Library

In your case, using a bar for the division would be the best solution:

l_valor =  l_dmbtr_t / wa_bseg_dmbtr.

Regards,

Felipe

3 REPLIES 3
Read only

Former Member
0 Likes
884

Hi Paulo,

Statement DIV returns only the integer part of the division, while MOD returns the reminder of the division.

You can learn more here: Arithmetic Calculations - ABAP Programming (BC-ABA) - SAP Library

In your case, using a bar for the division would be the best solution:

l_valor =  l_dmbtr_t / wa_bseg_dmbtr.

Regards,

Felipe

Read only

0 Likes
883

Thanks Felipe,

I changed the Command DIV by bar (/) and the correct answer is appear..

Read only

0 Likes
883

That is great, Paulo.

Please mark the answer as correct so this thread will be defined as answered.

Regards,

Felipe