Skip to Content
author's profile photo Former Member
Former Member

DI: Import XML

Hi All, I have tried to import various business objects via XML without success. I have read all the related postings on this site and none seems to work for me. I am new to the SDK so the problem is most probably quite simple. My other big problem is that I'm also new to VB as Delphi doesn't always work with the SDK. My code is as follows in VB.Net 2002

Dim aSO As SAPbobsCOM.Documents

oCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ValidNodesOnly

aSO = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)



aSO = Nothing

aSO = oCompany.GetBusinessObjectFromXML("c:\SO1.xml", 0)

In the last line I get an error "An unhandled exception of type System.Runtime.InteropServices.COMException occurred. Additional Information: <ErrorList><Error>System Id = 9317472, Line Number = 1, Column Number = 108, Description = Unknown Element 'DocEntry'

<ErrorList><Error>System Id = 9319936, Line Number = 1, Column Number = 168, Description = Unknown Element 'CANCELED'...

The list goes on and on. Your advise is appreciated.

Thanks in advance,


Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 09, 2004 at 01:45 PM

    I guess the problem is your XML-file. You cannot

    import exactly the same as you export. There are unique keys.

    With your code I got the same problem as you. Using

    a small XML-importfile it works at my computer.

    Try to make your own simple XML-order like this,

    remeber to save as unicode and change <cardcode> and

    <itemcode> to something that exists on your system:

    <?xml version="1.0" encoding="UTF-16" ?>


















    <OSRI />

    <OIBT />

    <RDR2 />

    <RDR3 />



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 04, 2004 at 08:09 AM

    Hi Adele,

    This problem has happen to me once. I used to have a user field in the marketing documents header. The problem guide me to see that the column which was cousing the error was this user field. I only delete it from the marketing documents and it worked properly.

    Looking to your message error, I could not tell you if it is the same error. Do you have any user defined fields on the marketing documents header?

    Just try to open the xml, and go to the involved columns, and watch out for something strange.

    Hope helps,

    Ibai Peñ

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 04, 2004 at 01:35 PM

    Hi Adele,

    I think your problem is that you have forgot to set the object. Your statement should look like:

    set aSO = oCompany.GetBusinessObjectFromXML("c:\SO1.xml", 0)

    best regards


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for the reply. If I add the "set" at the beginning of the line it just disappears when I move my cursor to the next line. I have also tried this with some code I copied off this forum. The code is...

      Private Function XMLRead(ByVal oCompany As SAPbobsCOM.Company, ByVal vOrder As SAPbobsCOM.Documents)

      Dim ret As Long

      Dim FileName As String

      Dim Ecount As Long

      Dim ii As Long

      Dim i As Long

      vOrder = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)

      FileName = "C:\SO1.xml"

      Ecount = oCompany.GetXMLelementCount(FileName)

      For ii = 0 To Ecount - 1

      If oCompany.GetXMLobjectType(FileName, ii) = SAPbobsCOM.BoObjectTypes.oOrders Then

      'Read the Business object data

      <b>vOrder = oCompany.GetBusinessObjectFromXML(FileName, ii)</b>

      Exit For

      End If

      Next ii

      ret = vOrder.Add

      End Function

      I get the same error as shown in my first post. It gets the error on the line marked in bold.

  • Posted on Dec 15, 2004 at 02:48 PM

    Try to use the option

    diCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode

    It worked for me.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.