Hello, and thanks for any help,
we are inserting product orders programmatically via custom API calls. Our APIs are simple and just expose all the order fields that get filled.
Orders get inserted regularly and then for every order, many product lines are added.
We are in a multicompany environment. With "companies", hereon, I mean our companies, not the orders' ones, We switch company environment in BC and orders are programmatically inserted in the correct company environment by the software and API.
This works fine both on both sandbox and production environments, and for multiple companies, except for the following problem.
Any order line has a vatProdPostingGroup field set to the same constant value, but, only for some of our companies, for no apparent reason, after the insertion, this order field is left empty (for all the lines of all orders in that company envirnoment).
The same order line data gets inserted in two different ways depending on the company.envirnoment.
Company A, production, same order data -> vatProdPostingGroup filled
Company B, production, same order data -> vatProdPostingGroup empty
Company A, sandbox, same order data -> vatProdPostingGroup empty
As an example, connecting to the API and sending this payload data via Postman:
{
"documentNo":"21OV0036",
"documentType":"Order",
"type":"G\/L Account",
"no":"05.01.001",
"description":"N.10010 di YYY YYYYY",
"locationCode":"01",
"quantity":-2,
"unitPrice":2,
"lineDiscount":28.35,
"lineAmount":-2.866,
"qtyToShip":-2,
"qtyToInvoice":-2,
"plannedDeliveryDate":"2021-03-10",
"plannedShipmentDate":"2021-03-10",
"shipmentDate":"2021-03-10",
"shortcutDimension1Code":"FASU\/10",
"shortcutDimension2Code":"R01001",
"ShortcutDimCode3":"EIT",
"vatProdPostingGroup":"NI.A74C1",
"vatBusPostingGroup":"NAZ",
"lineNo":301
}
The order line is inserted, without any error, and the response given back by the API is:
"@odata.etag": "W/\"..........\"",
"id": "...........",
"documentType": "Order",
"lineNo": 301,
"documentNo": "21OV0036",
"vatProdPostingGroup": "",
"vatBusPostingGroup": "NAZ",
"type": "G/L Account",
"no": "05.01.001",
"description": "N.10010 di YYY YYYYY",
"locationCode": "01",
"quantity": -2,
"unitPrice": 2,
"lineDiscount": 28.25000,
"lineAmount": -2.87,
"qtyToShip": -2,
"qtyToInvoice": -2,
"plannedDeliveryDate": "2021-03-10",
"plannedShipmentDate": "2021-03-10",
"shipmentDate": "2021-03-10",
"returnQtytoReceive": 0,
"shortcutDimension1Code": "FASU/10",
"shortcutDimension2Code": "R01001",
"ShortcutDimCode3": "EIT"
}
As you can see by the sixth line of the response, "vatProdPostingGroup": "", the vatProdPostingGroup field is empty, and such is also in the order view in the BC program..
For some other company, the same payload, with the same coding, API included, and the same vatProdPostingGroup value, the value is preserved and inserted regularly in the order. Nothing is changed except the company, so it must be something in the setup of the company / environment that interferes with this field.
Any clues why this might happen?
Excluded options:
- We already excluded software problems (both program and api are the same and the vatProdPostingGroup is set by one simple constant assignment, and the example i showed is performed in Postman (an external API simulation program) so it is independent from our code.
- it is not a wrong value: a missing or wrong vatProdPostingGroup generates an error, so this is not the case. For example, removing the group code from the VAT Setup page causes the import to fail with an error. Instead, this succeeds, but silently sets the field to empty / null.
What else may I try?