Hi,
Try below sample code, I didn't check the syntax of the code
try {
if(!oCompany.inTransaction)
oCompany.StartTransaction();
retVal_1 = SO.Add(); // Before try set all field for SO
retVal_2 = PO.Add(); // Before try set all field for PO
retVal_3 = GRPO.Add(); // Before try set all field for GRPO
retVal_4 = DR.Add(); // Before try set all field for DR
if(reVal_1 <> 0 OR reVal_2 <> 0 OR reVal_3 <> 0 OR reVal_4 <> 0 )
throw new Exception(last error message);
ELSE
oCompany.EndTransaction(commit);
} catch(exception e) {
if(oCompany.InTransaction)
oCompany.EndTransaction(rollback);
}
Regards
Vibin Varghese