cancel
Showing results for 
Search instead for 
Did you mean: 

Error -5002 Invalid Value [ODPO.Posted]

0 Kudos

Hello,

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
}
else
{
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;
}

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member233854
Active Contributor
0 Kudos

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

oDPM.DownPaymentType = SAPbobsCOM.DownPaymentTypeEnum.dptInvoice;

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Danilo Kasparian,

The Help File already mentions that it is relevant for Czech, Slovak, Hungary, and Poland localizations. Please help to clarify what are you expecting from me?

Eduardo Gama which localization you are working in? Do you guys have some steps to reproduce this issue? And can this sample be used directly without having any base document?

Kind regards,

ANKIT CHAUHAN

SAP SME Support

former_member233854
Active Contributor
0 Kudos

I just mentioned that it might be a bug, I used the same code as him in an american localization and it is asking to fill this field. So no matter the localization is, if you use the same code to reproduce the error you have an error.

When I filled up the property it worked.

I tagged you because I thought you would know about it, in case it is a bug I don't know what is the procedure with SAP but you probably would know.

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi Danilo Kasparian ,

Thanks for the information!

I will give it a try my side and will let you guys know about it.

Kind regards,

ANKIT CHAUHAN

SAP SME Support

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Danilo Kasparian and Eduardo Gama,

Unfortunately, I could not reproduce this issue in DEMO Database (UK Localization) on SAP Business One Version 9.2 PL09 and 9.3 PL03.

Would you please help to provide more details to me so that I could reporduce this my side?

Kind regards,

ANKIT CHAUHAN

SAP SME Support

former_member233854
Active Contributor
0 Kudos

Tks for the feedback ankit.chauhan1 . I would say that the problem is in old versions then, I tested in 9.2 PL 07 (US Localization)

Anyway there is a workaround just by filling the property. It is not a big deal

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi Danilo Kasparian and Eduardo Gama,

Indeed, the issue occurs in DEMO Database (US Localization) on SAP Business One Version 9.2 PL07 however it is not reproduced in SAP Business One Version 9.2 PL09 and 9.3 PL03.

I will create a SAP Note about it soon and will inform you about the same.

Kind regards,

ANKIT CHAUHAN

SAP SME Support

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Danilo Kasparian,

Could you please help to double confirm what will work in SAP Business One Version 9.2 PL07 and what will not in the same version and patch? I would require the sample code using which you are able to reproduce. And the workaround is also needed.

So that the workaround can also be included in the SAP Note.

Kind regards,

ANKIT CHAUHAN

SAP SME Support

former_member233854
Active Contributor

I think the code could be the same you used to test or the code provided by yplom.

What will not work is "Adding a DownPayments"

The workaround is to set the property DownPaymentType as below

oDPM.DownPaymentType = SAPbobsCOM.DownPaymentTypeEnum.dptInvoice;
ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Danilo Kasparian,

I have checked this issue more in details and found that US Localization does not has an option to create "A/P Down Payment Request". You will not find the menu in SAP Business One Client too.

However, the UK Localization has this option and probably, last time I have checked the issue as below:

  • A. Issue reproduced in SAP Business One Version 9.2 PL07 US Localization
  • B. Issue not reproduced in SAP Business One Version 9.2 PL09 and 9.3 PL03 UK Localization. Because of that, I confirmed that the issue is not reproduced.

Now, we come to the DI API part, and it seems correct because Metadata has both the enumeration available (dptInvoice and dptRequest) that is why you get both the enumeration option to select while creating Down Payment in US Localization and it is correctly stopping you to create Down Payment Request.

Please let me know in case you have any concern on this!

Kind regards,

ANKIT CHAUHAN

SAP SME Support

former_member233854
Active Contributor
0 Kudos

Hi ankit.chauhan1,

I think for DI API it should not ask for this property because it is not used for all localizations.

Maybe it should be default dptInvoice.

0 Kudos

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