‎2016 May 04 3:36 PM
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...
‎2016 May 04 3:59 PM
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
‎2016 May 04 3:59 PM
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
‎2016 May 04 4:12 PM
Thanks Felipe,
I changed the Command DIV by bar (/) and the correct answer is appear..
‎2016 May 05 3:44 PM
That is great, Paulo.
Please mark the answer as correct so this thread will be defined as answered.
Regards,
Felipe