Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

BAPI_CONTRACT_CREATE handling more decimals than 2

0 Kudos

Dear all, I'm facing a task in which I have to create a contract in ECC from an external template.

The custom report runs fine as far the contract is in a currency that allows up to 2 decimal places, but when the currency has an higher number of allowed decimal digits I'm stuck on a technical issue.

Basically, from the FM interface I see that values such as the Target Value at header level are defined as CURR 11 2, that means, it allows decimals up to 2 digits. The same limit occours also on prices at item level.
According to what I see from the database tables backend side, values are stored as "multiplied" by a 10 factor in case of currency with three decimals.
An example: from the ME33K I see a price like "123,345" for an item in LYD currency (3 decimal places). But on the DB, I see the value stored as "1233,45".

So far, so good. It seems that a 10^x factor is applied in order to handle physically the value on the CURR11 2 field for currencies allowing more than 2 decimals.

The problem is: how to handle this with the BAPI_CONTRACT_CREATE function module?

I tried to multiply prices in input in order to make them fit in the dataelement CURR11 2, hoping that an auto-calculation inside the FM would automagically recognize that the currency LYD has 3 decimal digits and hence adjust the value in output (ME33k).

But this is not the case: if I pass 1233,45 LYD to the FM, the contract created reports effectively 1233,45 LYD and not 123,345.

I'm sure I'm missing something, can't think the BAPI_CONTRACT_CREATE FM cannot be used in such cases. Any guidance would be highly appreciated.