Skip to Content
Jan 16, 2019 at 02:24 PM

Cannot reference Return on Credit Memo DI API


I am trying to copy a Return (SO) to an AR Credit Memo (CreditNotes), but, I am getting the following message. Clearly, in B1, you can copy a Return to a CM and it will have reference to the Return. Am I missing something?

You cannot use this type of document as a base document [RDN1.BaseType][line: 1]

Here is the code for the CM lines

cDoc.Lines.ItemCode = Convert.ToString(sdr2.Fields.Item("ItemCode").Value);
cDoc.Lines.Quantity = Convert.ToDouble(sdr2.Fields.Item("Quantity").Value);
cDoc.Lines.ShipDate = oDoc.DocDueDate;
cDoc.Lines.BaseEntry = oDoc.DocEntry;
cDoc.Lines.BaseType = Convert.ToInt32(SAPbobsCOM.BoObjectTypes.oReturns);
oDoc.Lines.BaseLine = Convert.ToInt32(sdr2.Fields.Item("LineNum").Value);