Had been busy past couple of days as was involved in writing a complex API which looks onto the Inventory Cost Breakdown tree and writes the data into a custom table after doing some transformation of data on the go.
As I was developing, I bumped into this run time error:
Error executing code: The field with id 0 does not exist in table
As usual, I googled about this error and came across this blogpost here http://daxline.blogspot.com/2011/08/field-with-id-0-does-not-exist-in-table.html, It's the exact error but the circumstances were different, It talks about the missing field in map whereas in my case I was not using any Maps.
It didn't took me long to troubleshoot the issue as I figured out that the table buffer was getting populated incorrectly, meaning I was inheriting the standard AX InventSettlementTreeNodeCalc class for my API and internally, it was calling a method for calculating the adjustments which I didn't require at that stage in the process, and this adjustment call was populating the settlement table buffer and returning it to Inventtrans table buffer thereby giving a run-time error.
Corrected the table buffers and removed the extra call to calculate adjustments as I was doing it towards the end of the process in a separate routine,