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)
purchTable = PurchTable::find("PO-0001");
while select forUpdate purchLine
where purchLine.PurchId == purchTable.PurchId && purchLine.PurchQty > 1
qty = purchLine.PurchQty;
while (qty > 1)
qty -= 1;