When Add Document get this error "Base document card and target document card do not match"
SAPbobsCOM.Documents oPDPMRequest = (SAPbobsCOM.Documents)fmCo.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDownPayments); if (oPDPMRequest.GetByKey(int.Parse(FldVal))) SAPbobsCOM.Documents oPDPMInvoice = (SAPbobsCOM.Documents)fmCo.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDownPayments); //Set Down Payment Header Values oPDPMInvoice.CardCode = oPDPMRequest.CardCode; oPDPMInvoice.DocDueDate = DateTime.Now; oPDPMInvoice.DownPaymentPercentage = oPDPMRequest.DownPaymentPercentage; oPDPMInvoice.VatPercent = oPDPMRequest.VatPercent; oPDPMInvoice.DiscountPercent = 0; oPDPMInvoice.DocTotal = oPDPMRequest.DocTotal; oPDPMInvoice.DocRate = oPDPMRequest.DocRate; oPDPMInvoice.GroupNumber = oPDPMRequest.GroupNumber; oPDPMInvoice.DeferredTax = oPDPMInvoice.DeferredTax; //Set Down Payment Type oPDPMInvoice.DownPaymentType = SAPbobsCOM.DownPaymentTypeEnum.dptInvoice; //Set Down Payment Line Values oPDPMInvoice.Lines.BaseType = 22; oPDPMInvoice.Lines.BaseEntry = oPDPMRequest.DocEntry; if (oPDPMInvoice.Add() != 0) { Application.SBO_Application.MessageBox(fmCo.GetLastErrorDescription()); return; } else { Application.SBO_Application.MessageBox("Purchase Invoice [" + fmCo.GetNewObjectKey() + "] created!"); } }