Skip to Content
0
May 27, 2016 at 08:53 AM

Document_LinesAdditionalExpenses on alternative item line

123 Views

Hi experts,

on a sales quotation document i calculate additional expenses for each line in the FORM_DATA_ADD event.

     ......
     oExpenses = oLines.Expenses;
     oExpenses.SetCurrentLine(0);
     oExpenses.GroupCode = 0;
     oExpenses.ExpenseCode = dataList.Data.ExpnsCode;
     oExpenses.LineTotal = dataList.Data.LineTotal;
     oExpenses.Add();
     .....
     ret = oDocument.Update();
     ....

This works fine on regular item lines but if there is alternative item line i got the error -5002 "There is a difference between the document total and its components. [OQUT.DocTotal][line: 0]"

I don't set neither the oDocument.DocTotal nor the oDocument.oLines.LineTotal.

I tried several things, switch the alternative line to a regular line, update the document, switch back, update again - but nothing works.

Is this a bug or am I missing something?

Regards,

Rico