Error: "Item identification cannot be changed when inventory transactions have been generated."

Hi All,

I want to create purchase order with myForm.

I am inserting data from a external tables, into
PurchTable and also 
to PurchLine. Inserting data into PurchTable is
working fine, but 
when inserting number of entries (items) to PurchLine
it throws 
error on InventDimId.

The error message as

"Item identification cannot be changed when inventory
transactions 
have been generated."

Can anyone please provide me the solution for this?

Thanks in advance
-satya

What is understood by your issue is that you trying to push purchase orders from external source to axapta. In this case, u can use AxPurchTable and AxPurchLine classes through .NET business connector. While creating the lines, first get the inventory dimension by findorcreate inventory dimension method and then pass it to purch line creation. Hope this helps u.

I got after use findorcreate inventory dimension method and also clear the purchline and inventdim by call purchline.clear() and invnetdim.clear() methods.

I got it.

Thank you.

this popic is fixed ?

Kevin -Viet Nam

Hi to everyone, I have the following code trying to insert multiple items to PurchLine from a temp Table and I also get message ‘Item identification cannot be changed when inventory transactions have been generated’. I have read the forum but I have not managed to find a solution. Please help. Code is :

While Select tmp
{

invnetdim.clear();
invnetdim.InventSiteId =“001”;
invnetdim.InventLocationId=“SPW100”;
purchline.clear();

purchLine.initFromPurchTable(purchTable);

axPurchLine = AxPurchLine::newPurchLine(purchline);

axPurchLine.parmInventDimId(InventDim::findOrCreate(invnetdim).inventDimId);

axpurchLine.parmItemId(tmp.ItemId);
axpurchLine.parmPurchQty(4);
axPurchLine.doSave();

}

Kind Reagrds,

john

Hi John,

I have tried the same code in my environment it is inserting the items which i have mentioned in the temp table for that single purchid multiple items in purchline.

So please check what are all the items which you have given in the tmp table those items required only the dimension site and ware house or else needs to give any other dimensions. Becoz while inserting data if we did not provide the mandatory data for that single transaction that time we can able to see that error.

So pls check the mandatory dimensions for that items.

Regards,

Abbas.I

Hi,

There is also InventDim.wMSLocationId filled. Do you have any idea how could I fill it for every itemId?

Site and WareHouse are always the same but Location differs.

Kind Regards,

John

Hi,

Already you have given the itemid in that temp table with this create the required fields and give the data. In that while loop give the dimension input call as like itemid.

Regards,

Abbas,I

Hi, It seems that problem has been solved by adding PurchLine=null; before PurchLine.clear();

Regards,

John