Greetings, I am trying to calculate tax rates for a Purchase
Order by operating as follows:
tables: ekko, ekpo, komv.
data: tax_rate type p decimals 2
... Appropriate looping
tax_rate = komv-kbetr / ( ekpo-netpr * ekpo-menge )
which means:
rate = tax amount / ( net price * quantity )
The value stored in tax_rate is always 0 after executing the code, regardless of the values stored in tables.
The currency type used is such that when I debug the program and visualize the values of kbetr and netpr the value shown is actually the real value divided by 100 and the quantity field has 3 decimal places.
Also when visualizing partial results I get things like this:
data: net_value type p decimals 2.
net_value = ekpo-netpr * ekpo-menge.
when netpr has a value of 97.00 and menge 2.000 the value stored in net_value is 194000.00
Could someone clarify this situation? How do I control the currency conversions and how do I manage P-type variables with different decimal places? Any help is much appreciated.