Delete the sales orders with no sales lines in X++ :
ttsbegin;
while select forupdate salesTable
where salestable.SalesType == SalesType::Sales
notexists join salesLine
where salesLine.SalesId == salesTable.SalesId
if(salesTable)
{
salesTable.delete();
info(strFmt("Sales order - %1 deleted", salesTable.SalesId));
}
else
{
info(strfmt("No sales orders available for deletion"));
}
ttscommit;
ttsbegin;
while select forupdate salesTable
where salestable.SalesType == SalesType::Sales
notexists join salesLine
where salesLine.SalesId == salesTable.SalesId
if(salesTable)
{
salesTable.delete();
info(strFmt("Sales order - %1 deleted", salesTable.SalesId));
}
else
{
info(strfmt("No sales orders available for deletion"));
}
ttscommit;
No comments:
Post a Comment