Skip to Content

Error -5002 Invalid Value [ODPO.Posted]


Try this sample available in SDK help center (returns an error.):

//Create DownPayment Invoice Object
//oDPM = (SAPbobsCOM.Documents) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDownPayments);
oDPM = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDownPayments);
//Set Down Payment Header Values
oDPM.CardCode = txtCardCode.Text;
oDPM.DocDueDate = DateDue.Value;
oDPM.DownPaymentPercentage = Convert.ToDouble(numPercent.Value);

oDPM.DownPaymentType = SAPbobsCOM.DownPaymentTypeEnum.dptRequest;

//Set Down Payment Line Values
oDPM.Lines.ItemCode = txtItemCode.Text;
oDPM.Lines.Quantity = Convert.ToDouble(txtQuantity.Text);
oDPM.Lines.Price = Convert.ToDouble(txtPrice.Text);

lRetCode = oDPM.Add(); // Try to add the invoice to the database
if (lRetCode != 0)
int temp_int = lErrCode;
string temp_string = sErrMsg;
oCompany.GetLastError(out temp_int, out temp_string);
MessageBox.Show(temp_int + " " + temp_string); // Display error message
Interaction.MsgBox("Down Payment Invoice Added to DataBase", MsgBoxStyle.Information, "Invoice Added");
// Enabling the next button in the process
cmdPayDownPayment.Enabled = true;
cmdCreateDownPaymentInv.Enabled = false;

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Apr 03, 2018 at 09:53 PM

    Add this property below. it seems there is some bug with this property that is not for all the localizations. ANKIT CHAUHAN

    oDPM.DownPaymentType = SAPbobsCOM.DownPaymentTypeEnum.dptInvoice;

    Add comment
    10|10000 characters needed characters exceeded

    • thanks Ankit

      I'm Brazil, my localization is Brazilian PT-br.

      I tested the "dptInvoice" option, it indicates an error that a client is required, that is, this option would be for down payment to clients.

      I'm working with version 9.2 pl 8 hf2

      Eduardo Gama