Skip to Content
avatar image
Former Member

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.

Thanks

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")

''Lines

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

''BatchNumbers

ReturnMat.Lines.BatchNumbers.Add()

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

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

Next

ReturnMat.Add()

oCompany.GetLastError(ErrCode, ErrMsg)

If ErrCode <> 0 Then

MessageBox.Show(ErrMsg)

End If

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Apr 04, 2016 at 08:56 AM

    Hi Brian,

    based on that order I have created delivery, Payment and Invoice

    Invoice that has been targeted for payment, can not be credit noted anymore.

    Regards

    Edy

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Brian,

      What if you create your AR CN as draft first and then try to add the draft manually.

      Do you have the same error ?

      And while you are at it, examine your draft if anything is wrong with your values.

      Regards

      Edy