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

"Update quantity in purchase orders" ???

Hi,

at the moment I'm developing an interface solution for a customer, where cash receipts from a POS are to be transferred into SAP Business One, Version 6.5.

For this purpose I'm using the SDK.

For another customer, using SAP Business One 6.2 the following code did work perfectly:

oI is an oInvoice.

oI.Series = 0;

oI.CardCode = "K00001"; // Anonymous customer

oI.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO;

.

.

.

then, I create the lines:

foreach (DataRow row in tableLines)

{

oI.Lines.Add();

oI.Lines.ItemCode = row["Number"].ToString();

// etc... (ItemDescription, PriceAfterVAT, Quantity and Currency are set as well)

}

oI.DocTotal = double.Parse(row["Total"].ToString());

if (oI.Add() != 0)

{

// ERROR: -5002 / "Update quantity in purchase order?"

}

In 6.2 this code works, for another company, perfectly, they are transferring about 2000 lines per day without problems.

It also does not matter if I use oQuotation instead of oInvoice - the same error occurs.

Is this a bug in 6.5 or am I doing something wrong?

Thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 07, 2004 at 06:40 PM

    Two things to try:

    #1. The first line is already instantiated for you in a 6.5 Document. Not sure if this was the case in 6.2. The result is that you always have one too many Lines in your existing code. You could try something like this instead:

    int index = 0;

    foreach (DataRow row in tableLines){

    if(index >= oI.Lines.Count){

    oI.Lines.Add();

    }

    oI.Line.SetCurrentLine(index);

    oI.Lines.ItemCode = row["Number"].ToString();

    // etc... (ItemDescription, PriceAfterVAT, Quantity and Currency are set as well)

    index++;

    }

    #2. If the code above is in a loop, make sure your oI is newly instantiated for each loop. If you re-use the object, I've seen trouble where Lines from a previous loop linger and create big trouble in the next.

    Hope this helps.

    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.