Tuesday, 26 January 2016

Can not post a purchase invoice

We have come across some scenarios where it was not possible to complete purchase invoicing, for example:
  • There is pending invoice in AX that is not visible in invoicepool. It can be seen only from purchase order side. It blocks many orders.
  • A Pending Invoice is not appearing in PL>common>Pending Supplier Invoices however when you go to the PO and look at the invoice tab, the Pending Invoice is still highlighted and when you select this you can see the detail of the pending invoice but we cannot do anything with it
  • When trying to post a purchase invoice you get an error message that says: Invoice %1 could not post because it contained matching errors which must be approved.
  • While selecting Pending vendor invoice gets an error as “One or more pending invoices cannot be displayed because they are in use” and the invoice is not displayed.
It may happen that if AOS gets stopped suddenly or the client loses connection with the AOS, some records stay in specific tables that causes these kind of situations. In other cases we or Partners could not find repro steps to get those scenarios.
I found a list of the SQL tables where the ‘pending’ record may exist. If the record is found in any of the following tables, the recommendation is to remove it when you have no users accessing AOS (and take normal precautions first of backing up the data). Also test the procedures in a test/development environment before applying it to a live enviroment. Then, check to see if you are able to properly invoice update the PO.
Of course, you can also delete these records going through Forms, these are the ones I used (ensure no users besides you are working in the application):
1. Firstly checking PurchParm tables when looking History forms (Account Payable/ Inquiries/ History/ Purchase orders), and delete those records where the status is “Waiting”.
2. The next step is to check VendInvoiceInfo tables where you found the wrong records, You can access those records in the list page: Accounts payable module > Places > Pending Purchase Order Invoices. Here you can delete it as well. Note: pending invoice of your case will be in this list page.
Hope it’s helpful


Friday, 15 January 2016

Unreserved "Physical Reserved" Qty in Ax 2009 thru x++

To remove a reservation (just reverse the sign on the qty):
In the code below, ‘inventTransParent’ is the inventTransId of the record that has the reservation (e.g. salesline.inventTransId)
You probably will want to modify the ‘where’ clause a bit to make sure you get the reservation records only, but this is just an example.
//Remove any existing reservations
InventTrans            inventTransReserve    ;
InventMovement         inventMovement        ;
InventUpd_Reservation  inventUpd_Reservation ;
while select inventTransReserve where inventTransReserve.InventTransId == inventTransParent
   Inventmovement = inventTransReserve.inventmovement(true);
   inventUpd_Reservation = InventUpd_Reservation::newInventDim(inventmovement,inventTransReserve.inventDim(), -1 * inventTransReserve.Qty ,false);    inventUpd_Reservation.updatenow();