PO Splitting


Splitting Purchase line in AX:
Suppose we are purchasing one item with 10 qty.At the time of receiving the the item we should consider each qty as one asset.So before doing the GRN we should split the item and post the GRN.So 10 assets will be created in the fixed asset table.

Here we go.

Add one butten in Purch table form in line level.In click method of the button add below code.

void clicked()
{

PurchLine purchlinelocal;
int i = 1;
;
if(purchline.PurchQty>1)
{
while(i<=purchline.PurchQty)
{
purchlinelocal.clear();
purchlinelocal.initFromPurchTable(purchTable);
purchlinelocal.PurchId=purchline.PurchId;
purchlinelocal.initFromPurchLine(purchline,true,false,false,false,1);
purchlinelocal.PurchQty = 1;
purchlinelocal.QtyOrdered = 1;
purchlinelocal.CurrencyCode = purchline.CurrencyCode;
purchlinelocal.PurchPrice = purchLine.PurchPrice;
purchlinelocal.InventDimId = purchLine.InventDimId;
purchlinelocal.PurchReqId = purchline.PurchReqId;
purchlinelocal.PurchReqLineRefId = purchline.PurchReqLineRefId;
purchlinelocal.PurchStatus = purchtable.PurchStatus;
purchlinelocal.LineDisc = purchline.LineDisc;
purchlinelocal.LineAmount = purchlinelocal.PurchPrice – purchlinelocal.LineDisc;
purchlinelocal.AssessableValue_IN = purchlinelocal.LineAmount + ((purchlinelocal.LineAmount *1)/100);
purchlinelocal.createLine(0,0,0,0,0,0);
i++;
}
purchline.delete();
}
PurchLine_ds.executeQuery();
PurchLine_ds.refresh();
}

Advertisements

2 responses to “PO Splitting

  1. Hi Sanju,

    This solution was almost the exact one I was looking for. How much of a change above code require if I have to give the user the decision to select the quantity he want’s to split? Is it simple enough to be done within couple of hours?

  2. Can you please elaborate? Customizing the above one will not take much time.
    Above code:
    If PO line has 10 qty – At the time of splitting 10 PO lines will be created with 1 qty.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s