Error executing code: Purchtotal Object not Initialized."

Hi All,

I am gettind an error as “Error executing code: Purchtotal Object not Initialized.”

Kindly help…

The method is

AmountMST sumAllTaxForUnpostedPO(purchID _purchID,
Qty _qty)
{
PurchTable purchTable = purchTable::find(_purchId);
PurchTotals purchTotals;
Tax tax;
Map accountTypeMap;
TmpTaxWorkTrans tmpTaxWorkTrans;
TaxTable taxTable;

;
purchTotals = purchTotals::construct(purchTable,purchUpdate::All);

tax = purchTotals.tax();
tmpTaxWorkTrans = tax.tmpTaxWorkTrans();

if (!accountTypeMap)
accountTypeMap = new Map(Types::String, Types::Enum);

select sum(TaxAmount) from tmpTaxWorkTrans;

return tmpTaxWorktrans.TaxAmount * _qty;
}

Initilise the purchtotal class either in run or main() of the class.