cancel
Showing results for 
Search instead for 
Did you mean: 

AR Invoice add through DI API

former_member458725
Active Participant
0 Kudos

Hi,

I am trying to add AR Invoice using DI API, which have Batch and Freight in the Line in INV1.

I attached the Code I am using for DI API.

I am getting an Error while adding the DI API

Invoice Not Add : Internal error (-5002) occurred  [الرسالة 131-183]

Please Help me with this, I serched this in SCN, but didnt get any solution.

Thnank You

Accepted Solutions (1)

Accepted Solutions (1)

maik_delly
Active Contributor
0 Kudos

Hi Vibin,

5002 normally means something is wrong with your data. From what I see you are adding always an empty line for every line object:

Add a new line in the beginning - BUT only if it is not the first element ( this already exists ).


for (int i = 0; i < 10; i++)

{

   if (i > 0)

       oInvoice.Lines.Add();

    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders;

    oInvoice.Lines.BaseEntry = strDocEntry

    oInvoice.Lines.BaseLine = oRecodSet_2.Fields.Item("LineNum").Value;

   ....

}

I don't think this is your problem here but could be .

Apart from that a minimal error reconstruction in DemoDB would make it much easier to help you. Also before adding the document use SaveToFile to see get the BO XML data -> add the same data in SBO client, get the XML of that document and compare.

regards,

Maik

Answers (1)

Answers (1)

daroy_alvin
Active Participant
0 Kudos

Hi,

Please check on the following SAP B1 SDK samples.

C:\Program Files\SAP\SAP Business One SDK\Samples\COM DI\VB.NET\05.OrderAndInvoice

Thanks & Regards,

Alvin