Delete lines from purch line table based on specific criteria
Delete lines from purch line table based on specific criteria we will write this code inside function or event for example clicked :
void clicked()
{
PurchLine _purchline;
int Counter=0;
;
try
{
ttsbegin;
while select forupdate _purchline where(_purchline.PurchReceivedNow==0 && _purchline.DIST==noyes::No)
{
if(_purchline.receivedInTotal()==0 && substr(_purchline.PurchId,5,-5)!='ERSDX')
{
_purchline.delete(); Counter++;
}
}
ttscommit;
info(strfmt("Number of Lines Deleted : %1",Counter));
}
catch
{
info(_purchline.PurchId);
}
}
void clicked()
{
PurchLine _purchline;
int Counter=0;
;
try
{
ttsbegin;
while select forupdate _purchline where(_purchline.PurchReceivedNow==0 && _purchline.DIST==noyes::No)
{
if(_purchline.receivedInTotal()==0 && substr(_purchline.PurchId,5,-5)!='ERSDX')
{
_purchline.delete(); Counter++;
}
}
ttscommit;
info(strfmt("Number of Lines Deleted : %1",Counter));
}
catch
{
info(_purchline.PurchId);
}
}
Comments