Hello,
I want automatic sales order to be posted while i post warehouse shipment for this order.
My sales order contains assigned item charge.
I post shipment but sales order stay. i should post it manualy.
Can sales order be automatic posted while posting shipment?
I use SetShipInvoice(TRUE, TRUE) function to autopost sales order and it works perfectly without Item Charge.
With item charge i get an error = "Qty. To Assign should be 0".
0
Comments
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
But Post Shipment post drops "Qty. to Ship" for Item Charges and then several line of code below rises error - because Qty. to Assign > Qty. To Ship.
If SalesLine.SHIP then Qty. To Ship := 0;
But i set Salesline.ship and SalesLine.invoice manually by code in the begining of the Post.
NAV 5.0 SP1
Then mimic that in your code.
Item charge has sub table where you are allocating the amount. Then on Sales line you populate qty to assign.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I see this is a very old post. I encountered this issue today and fixed it . Thought to share the solution with you guys.
First Solution to solve the error message "You cannot assign more than 0 units in Document Type = Order, Document No. [Document_Number], Line No. = [Line_Number]" is available in KB 960039
http://support.microsoft.com/kb/960039
All you have to do is
This Hotfix fixes the error message. Now you can post the Warehouse shipment, but the charge item will not get posted. you have to post it manually. :roll:
The reason for the Charge Item not getting posted while posting Warehouse shipment is codeunit 5763 - Whse.-Post Shipment.
This codeunit changes the "Qty. to Ship" of the Charge Item to 0, before calling Codeunit 80 - Sales-Post.
Solution
In function "InitSourceDocumentLines()" find the below code and make the changes as mentioned
Now, if you have the Charge Item assigned to the lines in the Sales Order, then when you post the warehsouse Shipment, the charge Item will also get posted. :thumbsup:
Hope, it will solve your problem, If you still have it.
Thanks
Libin D