Skip to Content
author's profile photo Former Member
Former Member

Total in order documents


Im trying to add an order document using the DI API.My problem is that i can't display the DocTotal and the LineTotal ...i select these properties after the add() , and it displays 0 always ...

here is my code:

long RetVal;

int ErrCode;

string ErrMsg;

SAPbobsCOM.Documents vOrder;

vOrder = (Documents)vCmp.GetBusinessObject(BoObjectTypes.oOrders);

vOrder.CardCode = (string)list.SelectedItem;


vOrder.HandWritten =BoYesNoEnum.tNO;

vOrder.PaymentGroupCode = -1;

vOrder.DocDate = System.DateTime.Parse(postingDate.Text);




vOrder.Lines.ItemCode = (string)listItems.SelectedItem;

vOrder.Lines.ItemDescription = descItem.Text;

vOrder.Lines.Price= Convert.ToDouble(priceItem.Text);

vOrder.Lines.Quantity = Convert.ToDouble(quantityItem.Text);

vOrder.Lines.Currency = "Eur";


//'Add the Order

RetVal =vOrder.Add();

//Check the result


if (RetVal != 0 )


vCmp.GetLastError (out ErrCode,out ErrMsg);

mess.Text=ErrCode + " " + ErrMsg;



mess.Text="Commande Rajoutée Avec Succès:d";

//here i consult the totals i have 0 as a result




Another question how to get the DocEntry of this document so i can do a GetByKey afterward, because when i consult it in this code i got 0 also...

Thanks you in advance...


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2005 at 02:30 PM

    After you call the Add method, the vOrder object will no longer contain the data you specified - it will just be a new blank order object.

    You can get the reference for the Order you have just added by calling the GetNewObjectKey method of the Company object. The result of this function can be used with the GetByKey function.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.