Skip to Content
0
Former Member
Jul 29, 2014 at 07:22 PM

Internal Error when trying importing XML (Invoice)

23 Views

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.

Attachments