Skip to Content
0
Former Member
Oct 07, 2011 at 01:48 PM

Ordered Quantity does not get copied to Invoice by DIAPI

22 Views

Hi All,

I am stuck with an issue in Invoice creation using DI API by code.The field Ordered Qty (DB Filed INV1.OrderedQty) does not gets copied to Invoice line from delivery lines. But while we add invoice from delivery >Copy To > AR Invoice , it gets copied to Invoice lines. This OrderedQty field is not exposed through DI API, so we cant set that field throgh code. What I do in Invoice creation code is as follows.

SAPbobsCOM.Documents oINV;

oINV = (SAPbobsCOM.Documents)

modups.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);

oINV.CardCode = oDLN.CardCode;

for (int i = 0; i < oDLN.Lines.Count; i++)

{

oDLN.Lines.SetCurrentLine(i);

string str = oDLN.Lines.ItemCode;

if (i != 0)

{

oINV.Lines.Add();

}

//oINV.Lines.ItemCode = oDLN.Lines.ItemCode;

//oINV.Lines.Quantity = oDLN.Lines.Quantity;

oINV.Lines.BaseType = Convert.ToInt32(SAPbobsCOM.BoObjectTypes.oDeliveryNotes);

oINV.Lines.BaseEntry = oDLN.DocEntry;

oINV.Lines.BaseLine = oDLN.Lines.LineNum;

taxcode = oDLN.Lines.TaxCode;

}

if (DeliveryExpenseCount > 0)

{

for (int i = 0; i < DeliveryExpenseCount; i++)

{

oDLN.Expenses.SetCurrentLine(i);

if (i != 0)

{

oINV.Expenses.Add();

}

//oINV.Expenses.ExpenseCode=i;

oINV.Expenses.ExpenseCode = oDLN.Expenses.ExpenseCode;

oINV.Expenses.LineTotal = oDLN.Expenses.LineTotal;

oINV.Expenses.TaxCode = oDLN.Expenses.TaxCode;

oINV.Expenses.BaseDocEntry = oDLN.DocEntry;

oINV.Expenses.BaseDocLine = oDLN.Expenses.LineNum;

oINV.Expenses.BaseDocType = 15;

}

}

int retVal = oINV.Add();

if (retVal != 0)

{

int lErrCode; string sErrCode;

modups.oCompany.GetLastError(out lErrCode, out sErrCode);

}

Any help will be appreciated..

Deepesh