2020 Nov 02 8:05 AM
Hi, everyone.
We have problem with accounting of invoices (VK) by BAPI BAPI_ACC_DOCUMENT_POST.
Sometimes (I don't know when) when I use this BAPI, my invoices have amounts a hundred times greater (18000 instead of 180 and 15678 instead of 156.78) in FB02. After few minutes without accounting everything works fine again - the same invoices may be good accounted in SAP by this script. I don't know where is problem. What should I do to fix this? Now, I have to verify every invoice after accounting to check if that problem appeared.
2020 Nov 02 8:10 AM
Hello piotr.widliski
It must be a problem with decimal point handling within your script. You haven't described the details of the script or how BAPI_ACC_DOCUMENT_POST is called.
If it's an online SAP Gui scripting then it runs with a user id and user's settings of the user that calls the script. Decimal point (period or comma) is defined in user settings in SU3 transaction. It's perfectly possible the your script doesn't handle the user settings correctly, hence the problems.
Best regards
Dominik Tylczynski
2020 Nov 02 8:27 AM
Thank you, 3a9e4ce873a94034b33dc62b0ce600ee for your answer.
I use C# library and yes - it runs with a user id. I checked user settings and every user has comma as decimal point. Can I force decimal point by BAPI attribute?
2020 Nov 02 8:58 AM
Hi piotr.widliski
To my knowledge BAPI as such takes amounts in a internal representation i.e. with period as decimal point - see the data dictionary definition of BAPIACCR09-AMT_DOCCUR "Amount in Document Currency" or other amount fields.
Your C# script needs to read the data from somewhere, maybe Excel script or flat text file. Maybe the problem is over there with decimal point?
BR, Dominik Tylczynski
2020 Nov 02 10:15 AM
My C# script get data from XML. I have this XML and it's data was correct (there was amounts with commas). My SAP settings are the same like earlier but now, when I modify data manually (commas to dots) my BAPI works correctly.
It's strange. My question is: from where BAPI knows what type of decimal point is correct, because in SU3 i have comma, on my Windows regional settings I have comma, I send amounts with commas in my user context and SAP converts data to dots.