📚 SAP Business One SDK Help

GetBusiness ObjectFromXML
See Also

Description

Using GetBusinessObjectFromXML, GetXMLelementCount, GetXMLobjectType methods.
Private Sub XMLRead(vCmp As SAPbobsCOM.Company, vBP As SAPbobsCOM.BusinessPartners)
    Dim FileName As String
    Dim Ecount As Long
    Dim ii As Long

    FileName = "c:\myXml.xml"
    'Get the number of Business object in the file ...
    Ecount = vCmp.GetXMLelementCount(FileName)
    'Run a loop through the objects and when the first
    'BusinessPartner object is found, load it and then stop.
    For ii = 0 To Ecount - 1
        If vCmp.GetXMLobjectType(FileName, ii) = oBusinessPartners Then
            'Read the Business object data
            Set vBP = vCmp.GetBusinessObjectFromXML(FileName, ii)
            Exit For
        End If
    Next ii