web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

Split Purchase order lines

Muhammad Afsar Khan Profile Picture Muhammad Afsar Khan 2,676
Sometime we need to split purchase order line into multiple lines with Quantity = 1, here is a piece of code through which you can split purchase order line into multiple lines. You can easily alter the below code based on your Quantity factor.

static void SplitPurchLine(Args _args)
{
    PurchQty    qty;
    PurchTable  purchTable;
    PurchLine   purchLine;
    
    purchTable = PurchTable::find("PO-0001");
    
    while select forUpdate purchLine
        where  purchLine.PurchId == purchTable.PurchId && purchLine.PurchQty > 1
    {
        qty = purchLine.PurchQty;

        while (qty > 1)
        {
            PLPurchLineSplit::update(purchLine, 1);
            qty -= 1;

        }
    }
}


This was originally posted here.

Comments

*This post is locked for comments