DTW Administration / Setup / Business Partners / Business Partner Priorities
API BP Priorities / Save XML
Save XML Method


Saves the object data to XML formatted data.


Visual Basic
Public Sub SaveXML( _
   ByRef pbstrFileName As String _



Specifies the path and file name of the XML data.


You can use this method to save a business object to an XML file. Then, call the GetBusinessObjectFromXML method to load this object into memory again, for example, to copy customers from one database to another. To enable this operation, set the XmlExportType property of the Company object to xet_ValidNodesOnly.

To use ReadXML method, set the XmlExportType to xet_ExportImportMode (3).

For more information, see Exchanging Data Using the DI API XML Capabilities.


The following sample shows how to save data of an object to an XML file. Use this sample as a basis to all business objects (both document and master data types).
Invoice Document - SaveXML Method Sample (Visual Basic)
Dim vInvoice As SAPbobsCOM.Documents Set vInvoice = vCmp.GetBusinessObject(oInvoices) 'Retrieve an invoice document from the database RetVal = vInvoice.GetByKey("1023") If RetVal <> 0 Then vCmp.GetLastError ErrCode, ErrMsg MsgBox "Failed to Retrieve the record " & ErrCode & " " & ErrMsg Exit Sub End If 'Save the object as an xml file vInvoice.SaveXML ("C:\Program Files\SAP\XML\Invoice.xml") 'Retrieve the object back from the XML file Set vInvoice = vCmp.GetBusinessObjectFromXML("C:\Program Files\SAP\XML\Invoice.xml", 0)

See Also

SAP® Business One is the trademark(s) or registered trademark(s) of SAP AG in Germany and in several other countries. Contact
This website is not affiliated with, maintained, authorized, endorsed or sponsored by SAP AG or any of its affiliates