cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Creating CreditMemo Through SDK

Former Member
0 Kudos

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

0 Kudos

Hello

Were you able to solve the problem, I have the same issue when create a CreditNote based on an invoice, without delivery it works fine but when a Delivery exist y receive the error: Quantity cannot exceed the quantity in the base document and the quantity is the same as the base document.

Any help will be greatly appreciated!

Accepted Solutions (0)

Answers (2)

Answers (2)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Refer to the thread https://answers.sap.com/questions/13081357/sdk-cant-create-credit-note-based-on-invoice-if-de.html for a solution.

Use ActualBaseEntry and ActualBaseLine properties of Document_Lines Object while creating the A/R Credit Memo via DI API.

These properties are used to create Credit Memos for delivered items on Reserve Invoices.

Refer to the SDK Help File for the same.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

edy_simon
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Edy,

Thanks for your answer. But i can create the credit note from the SAP interface, why i can't From SDK?

edy_simon
Active Contributor
0 Kudos

Hi Brian,

Can you tell us more :

What is the quantity and Amount of SO

What is the quantity and amount of SO copied over to DO

What is the quantity and amount of DO copied over to AR Invoice

What is the amount of AR Invoice has been created as Payment.

And finally, what is the quantity you are trying to create as CN ?

Regards

Edy

Former Member
0 Kudos

Hi Edy,

SO:  Quantity=50  Amount= $18.00  TotalLine=$900.00

AR Invoice: Quantity=50  Amount= $18.00  TotalLine=$900.00

DO: Quantity=50  Amount= $18.00  TotalLine=$900.00

Payment Amount: $720.00

CN: Quantity=10 Amount= $18.00 TotalLine=$180.00

edy_simon
Active Contributor
0 Kudos

Hi Brian,

I followed this exact steps and added the CN without problem in SBO 9.0 PL16

Create SO Qty = 50, UnitPrice = $18

Create DO Qty = 50, UnitPrice = $18

Create Inv Qty = 50, UnitPrice = $18

Create Payment, Amount=  720$

Create CN Qty = 10, UnitPrice = $18.

Your codes looks ok.

I wonder why you create AR Invoice first then DO after that.

May I know what is your SBO version ?

Regards

Edy

Former Member
0 Kudos

Hi Edy,

Sorry about that, am using A/R Reserve Invoice thats why i create the invoice first.

And my SBO version is 9.0 PL5



edy_simon
Active Contributor
0 Kudos

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