Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem Creating CreditMemo Through SDK

Hi All,

In SAP 9.0 PL 5 I have created an order and based on that order I have created delivery, Payment and Invoice. Now when I am trying to add Credit Memo for created invoice Via SDK it is giving the below error:

Quantity cannot exceed the quantity in the base document.

I am linking the document and line correctly and the BaseLine, BaseEntry, and BaseType match the ones on the source document. Also, the quantity is not more then on the source document.

Please Help me give suggestion.


Here's my code:

ReturnMat = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oCreditNotes)

                ReturnMat.Series = SAPSerie

                ReturnMat.CardCode = DTShipper.Rows(0).Item("Customer")

                ReturnMat.Comments = Shipper.ToString() & " " & Note.ToString()

                For x As Int32 = 0 To DTShipper.Rows.Count - 1

                    If x > 0 Then ReturnMat.Lines.Add()

                    ReturnMat.Lines.BaseEntry = DTShipper.Rows(x).Item("InvoiceDocEntry")

                    ReturnMat.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oInvoices

                    ReturnMat.Lines.BaseLine = DTShipper.Rows(x).Item("LineNum")


                    ReturnMat.Lines.Quantity = DTShipper.Rows(x).Item("SAPQuantity")



                    ReturnMat.Lines.BatchNumbers.BatchNumber = DTShipper.Rows(x).Item("Serial")

                    ReturnMat.Lines.BatchNumbers.Quantity = DTShipper.Rows(x).Item("SAPQuantity")



                oCompany.GetLastError(ErrCode, ErrMsg)

                If ErrCode <> 0 Then


                End If

Former Member
Not what you were looking for? View more on this topic or Ask a question