static void
OGSReleaseAllItemstoAnotherCompany(Args _args)
{
EcoResProduct ecoResProduct;
InventTable inventTable;
InventDimCombination inventDimCombination;
CompanyId compFrom, compTo;
int
success, errors;
//Enter the
company code where you want to release variants
compFrom = 'alma';
compTo = 'impb';
changeCompany(compTo)
{
while
select crossCompany
inventTable
join
ecoResProduct
where
inventTable.dataAreaId == compFrom
&&
ecoResProduct.DisplayProductNumber == inventTable.ItemId
{
try
{
EcoResProductReleaseManagerBase::releaseProduct(ecoResProduct.RecId,
CompanyInfo::findDataArea(compTo).RecId);
success++;
}
catch
{
errors++;
continue;
}
}
}
info(strFmt("Complete: %1 records success, %2
errors/skipped",success,errors));
}
No comments:
Post a Comment