Skip to Content

Currency divided by quantity

Hi,

I am trying to divide a currency field with quantity field and want to store the result in currency field or decimal field. I tried it as below...

DATA: l_field1 LIKE J_1IEXCDTL-EXBAS,

l_field2 LIKE j_1iexcdtl-menge,

l_field3 TYPE p DECIMALS 2.

l_field1 = ' 165915.00'.

l_field2 = ' 15.000'.

l_field3 = l_field1 / l_field2.

WRITE :/ l_field3.

I am getting the desired result (output is comming as 11061.00).

But same thing is not working, output is comming as 11.06 for below code...

l_field3 = it_excdtl-exbas / it_excdtl-menge.

Why? How to solve it.

Advance thanks.

Regards,

Balaji Viswanath.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 13, 2005 at 03:47 PM

    More details would help.

    Is it_excdtl-exbas defined the same as J_1IEXCDTL-EXBAS? Likewise for it_excdtl-menge and j_1iexcdtl-menge?

    What dictionary data element do they refer to?

    Do you have the Fixed Point Arithmetic flag set in the attributes of your program?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 13, 2005 at 04:10 PM

    Hello Balaji,

    one possible reason:

    fields it_excdtl-exbas and it_excdtl-menge are referred to currency and unit fields. They are filled in your 11.05-case. Behind currency decimal definition can be customized (e.g. US-dollar 2, Italian Lira 0). Behind unit decimals can be customized (e.g. kilogram 3, piece 0). So different 'real' amounts can be defined.

    Theses customizing is different to the number of default decimals, which is defined behind fields exbas and menge - which is used in debugger and SE16.

    Check, if your currency for exbas has 5 decimals (table TCURX) - then 11.06 is correct value.

    If you can't find a reason - just move value and amount into dummy-fields before calculation. Then it should work like i_fieldx-example.

    Regards,

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.