Enter purchase order received quantity by code

Go To StackoverFlow.com

1

In purchase order form - Line - Tab Quantity, there is Received, Delivery Reminder and Ordered.

I want to be able to entry those field by X++ code, because currently our company still entry data into old system.

I can retrieve the arrival purchase order goods data from that old system, then I want to entry those retrieved data by code into Axapta.

What table and field should I consider when doing that? What functions available to easily update each PO lines received quantity? Sample Code is nice.

2012-04-05 00:25
by user733916


0

How to create a purchase orders?

Sample code for sales orders can be found in jinx's AX blog.

Skip or translate the German text, the code is at the bottom, the essential being the createLine method call. A global replace of "sales" to "purch" will do the trick for you.

Which fields to consider?

Lots and lots but start with the identity numbers, quantities and item units.

Quantities are in purchase units (PurchQty) and inventory units (QtyOrdered). You will have to set both, but one of the arguments to createLine will do it for you.

Update:

To update the received quantities you have to update a packing slip. Besides updating the quantities it updates/creates inventory transactions.

You can do this by updating the PurchReceivedNow and InventReceivedNow fields on the PurchLine table, the second field can be set by calling the setInventReceivedNow method.

Then you update the packing slip (you will need the purchase order and a packing slip id):

void postPackingSlip(PurchTable purchTable, PackingSlipId packingSlipId)
{
    PurchFormLetter letter = PurchFormletter::construct(DocumentStatus::PackingSlip, true);    
    letter.update(purchTable, packingSlipId, letter.transDate(), PurchUpdate::ReceiveNow);
}
2012-04-05 06:59
by Jan B. Kjeldsen
Did I get you wrong? Is the purchase already created, and you just want to update a packing slip - Jan B. Kjeldsen 2012-04-05 07:07
Line already created, I just want to update the qty received which I get the data from the old system. Problem is I do not know which field should I update, or what function should I use to better update it... because as I trace the display field is function receivedInTotal() in PurcLineType class.. - user733916 2012-04-07 01:34
Answer updated - Jan B. Kjeldsen 2012-04-08 05:58
The value on PurchReceiveNow and InventReceiveNow is the same as our received goods quantity - user733916 2012-04-09 01:37
I would think so - Jan B. Kjeldsen 2012-04-09 07:16
I've just tried but got error: Account number for transaction type Purchase, packing slip purchase does not exist. Account number for transaction type Purchase, packing slip purchase offset does not exist. Posting has been canceled. Operation cancele - user733916 2012-04-16 08:09
You will have to debug to locate the exact cause. If you search for the error message, then press "Used by" the likely spot of error is: \Classes\LedgerVoucherTransObject\chec - Jan B. Kjeldsen 2012-04-16 11:36
The accounts receivable parameter "Post delivery note in ledger" is set. But posting accounts for inventory posting of packing slips has not been set. This is a setup error - Jan B. Kjeldsen 2012-04-16 11:41
Could you please guide me exactly where is the parameter should I check? Because I can not locate where is the "post delivery note in ledger" and where is "posting accounts for inventory posting of packing slips - user733916 2012-04-17 05:43
Look in Account Receivables\Setup\Parameters and Inventory\Setup\Postings - Jan B. Kjeldsen 2012-04-17 06:33
Hi there is no "Parameters and Inventory" in my axapta? I'm using AX 2009. On "AR - Setup" there is only menu for "Parameters" and NO "Parameters and Inventory", is there I've done wrong here - user733916 2012-04-18 07:28
There are two menu items separated by the word "and", so look in "Account Receivables\Setup\Parameters" and "Inventory\Setup\Postings". Easy - Jan B. Kjeldsen 2012-04-18 08:05
Ok on AR\Setup\Parameters\Updates I found Packing Slip in Ledger is SET, then I look into Inventory\Setup\Posting\Posting then look into tab Inventory within the form, there is selection of Fixed Received Price Profit, etc. Which should I setup and how please - user733916 2012-04-25 04:29
If testing only: deselect "Post delivery note in ledger". Otherwise consult whoever is responsible for the setup - Jan B. Kjeldsen 2012-04-25 10:33
Ads