cancel
Showing results for 
Search instead for 
Did you mean: 

Error Adding SalesOrder using SDK 6v5

kurt_huwiler
Participant
0 Kudos

In SDK 6v2 adding a salesorder works fine.

Doing the same unter 6v5 produces an error message:

"Update quantity in purchase order?[RDR1.Quantity][line: 2]

Does anyone have an idea whats going wrong ?

This are the lines of Code I use to add an order:

                        Dim sap_so As SAPbobsCOM.Documents

    Set sap_so = sbo_cx.GetBusinessObject(Object:=oOrders)

    With sap_so

        .DocDueDate = VBA.Date

        .CardCode = "C00001"

        With .Lines

            .ItemCode = "SP-2010.082"

            .Quantity = 10

            .ShipDate = VBA.Date

            .WarehouseCode = "01"

            .Price = 50

            .Add

        End With

        .DocTotal =10

        lReturnCode = .Add

    End With

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

The 6.5 API automatically creates a line (Document_Lines object) when the business object is created.

This means, you must not "Add" the line you have just filled. Instead, this creates a second (empty !) line.

Regards,

Frank

kurt_huwiler
Participant
0 Kudos

Hi Frank

Thanks a lot. It works now.

Regards

Kurt

Former Member
0 Kudos

My pleasure!

Regards,

Frank

PS: Please use - as long as this is the only "SAP Business One" forum in SDN - a prefix for your posts like "UI: ", "DI: " etc. whenever suitable. This makes monitoring and searching perhaps somewhat easier when the number of posts will be heavily increasing  😉

Thank you in advance!