cancel
Showing results for 
Search instead for 
Did you mean: 

Internal Error when trying importing XML (Invoice)

Former Member
0 Kudos

Hi Experts.

The code below is returning the error: Internal Erro -5002.


int iCount = oCmp.GetXMLelementCount(@"c:\temp\teste di\ExportImportMode.xml");

                oInv = (SAPbobsCOM.Documents)oCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);

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

                {

                    if (oCmp.GetXMLobjectType(@"c:\temp\teste di\ExportImportMode.xml", i) == SAPbobsCOM.BoObjectTypes.oInvoices)

                    {

                        oInv = oCmp.GetBusinessObjectFromXML(@"c:\temp\teste di\ExportImportMode.xml", i);

                    }

                }

                oInv.DocNum = 0;

                if (oInv.Add() != 0) MessageBox.Show(oCmp.GetLastErrorDescription());

The xml used to import was generated starting this code:


oCmp.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode;

                oInv = (SAPbobsCOM.Documents)oCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);

                if (oInv.GetByKey(Convert.ToInt32(txtNumDoc.Text)))

                {

          oInv.SaveXML(@"c:\temp\teste di\ExportImportMode.xml");

                }

xml file is attached.

I am using SAP 9 PL 10.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Brian,

-5002 is an undocumented error code, which means that the structure of the data is incorrect.

By looking at the provided xml file, you have (at least!) to remove all the read-on valuee (DocEntry, DocNum, DocType, etc.).

Regards,

Eric

Former Member
0 Kudos

remove the tag? or I to set null or empty values​​?

Former Member
0 Kudos

Hi Brian,

Remove...

Regards,

Eric

Former Member
0 Kudos

Tanks.

Answers (0)