When trying to post manual cost allocations with BAPI_ACC_MANUAL_ALLOC_POST I encountered the error message BK048 “Enter amount”.
As I filled all amounts and currencies in the line items table doc_items I was quite puzzled about this message.
Since trying to shed some light on this issue using google and SCN search was not successfull I started debugging and finally found the problem and to help others who might have the same problem I decided to write this blog post.
The error originates in the function module CURRENCY_AMOUNT_BAPI_TO_SAP.
In this function module the amounts are converted into the SAP internal format. For every currency there is a definition on how many decimal places are allowed.
If you call the BAPI with amounts which have more decimal places filled (with values <> 0) a message is raised which is unfortunately not forwarded to the caller.
This is the call stack:
This is the function module with the error location:
This was an amount I gave to the BAPI:
As you can see, the value I gave to the BAPI was 6.3440. Since currency EUR has 2 decimal places, 6.34 or 6.3400 was expected.
This is what has led to the error.
In this case the function is terminating with a message raising, so the exporting parameter sap_amount is not filled, which means 0.0.
This finally results in the amount being 0.0 in the internal table DOC_ITEMS of the function module.
This in turn leads to the subsequent error BK048 “Enter amount” which makes sense here if you know how it occured.
I hope this can be helpful to anyone. If so, please leave your comments!