cancel
Showing results for 
Search instead for 
Did you mean: 

PayToCode not set in invoice

Former Member
0 Kudos

Hello,

I create an new invoice, which is based on an existing order.

I add the orderlines to the invoice by using some code like this:

oInvoices.Lines.BaseEntry = OrderDocEntry

oInvoices.Lines.BaseLine = OrderPositionLineNum

oInvoices.Lines.BaseType = 17

The ShipToCode and the Address2-Field was filled with the correct values, also the Address-Field (BillToAddress), but the PayToCode-Field is still empty.

Trying to set oInvoices.PayToCode to the corresponding value from the order did not work.

Do I make something wrong or is there a error in DI API?!

Thanks for your help!

Sebastian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sebastian,

Which Version of Business One (including Patch Level) are you using?

It works fine for me in Version 2007A PL45. There is a very similiar issue related to creating Sales Orders based on Quotations, which will be fixed in a future patch. If you have access to the SAP Notes, see 1290487.

If it still happens for you in the latest patch available it does look like an application error to me and I would suggest to log a SAP message if you can.

In general the workaround is to set the PayToCode in the Addon. Example:

oInvoice.PayToCode = oOrder.PayToCode

Hope that helps.

Kind Regards,

Friederike Mundt

SAP Business One Forums Team

Former Member
0 Kudos

Hi Friederike,

thanks for your reply.

I am using SBO PL 45 but it does not work fine without using the workaround from SAP Note 1290487.

But there is one thing I didn't understand: Setting the PayToCode before adding the invoice doesn't work. After calling the Add()-Method it is required to get the added invoice, set the PayToCode and call Update() to change the invoice.

Now it works, but the error is still exists with PL 45.

Sebastian

Former Member
0 Kudos

Hi Sebastian,

I do not think the issue you are describing is the exact same as in the 1290487. In the Note the scenario is to copy a Sales Quotation to a Sales Order.

I could not reproduce the same issue when copying a Sales Order to an Invoice. Therefore I believe certain settings in the Database are relevant to reproduce.

As the scenario is slightly different the workaround described in the Note might work partly only for the scenario you described.

I would suggest to report the issue in a SAP Support Call to follow up and ensure it will be fixed if it is required.

Kind Regards,

Friederike Mundt

SAP Business One Forums Team

Answers (0)