Thanks a lot!
I can add a delivery notes base on a pick list now. but though I had added many pick lists for one order, When I add a dilivery notes base on one of the pick lists, that all other pick lists had been closed! and I want to limited the any itemcode on lines's quantity,that the quantity must less than the order's,what can I do ?
As a pick list can contain orders from any number of customers, you will need to decide whether you want to merge orders for the same customer (and delivery address) to the same delivery document or keep them as separate deliveries.
As an example, here's what you'd need to do if you want a separate delivery for each sales order:
1) Query the PKL1 to get a recordset of the sales order lines that are on the pick list and the picked quantity.
2) For the first sales order in your recordset, retrieve the document details (either use a recordset for this or create an instance of sales order document in the DI API and use the GetByKey method to retrieve the data)
3) Create an instance of a delivery document in the DI API and copy the CardCode, CardName and any other fields you want to transfer from the order header to the delivery header.
4) For each line of this order that is in the pick list, create a new line in the delivery document. Set the BaseEntry, BaseLine and BaseType properties to link back to the originating sales order line. Set the delivery quantity to the picked quantity.
5) Add the delivery document.
6) [Optional] Print the delivery document (using Crystal or a similar reporting API) and any labels etc
7) Repeat steps 2 to 5 for all the sales orders in the picklist.
Dear Fu Guo,
You could implement the function by following steps by DI API:
1. Get the Keys of Sales Order from pick list:
by OrderEntry property of PickLists_Lines Object
2. Get the each Sales Order
3. Create Delivery based on the order get in step 2
SAP Business One Forum team