📚 SAP Business One SDK Help

GetDataInterfaceFromXMLFile Method
See Also  Example
bstrFileName

Specifies the path and file name of the XML data.

Specifies the path and file name of the XML data.

Description

Creates a data structure from a specified XML file.

Syntax

Visual Basic
Public Function GetDataInterfaceFromXMLFile( _
   ByVal bstrFileName As String _
) As Object

Parameters

bstrFileName

Specifies the path and file name of the XML data.

Specifies the path and file name of the XML data.

Example

How to get an Openning Balance Account from an XML file
GetDataInterfaceFromXMLFile (Visual Basic)Copy Code
Dim oCmpSrv As SAPbobsCOM.CompanyService
Dim oOpenBalanceAccount As SAPbobsCOM.OpenningBalanceAccount
Dim oOpenBalanceAccountXmlFile As SAPbobsCOM.OpenningBalanceAccount
Dim oBpAccounts As SAPbobsCOM.BPCodes

'get company service
oCmpSrv = oCompany.GetCompanyService

'get account service
oBusinessPartnersService = oCmpSrv.GetBusinessService(ServiceTypes.BusinessPartnersService)

'get Accounts Service Data Interface
oOpenBalanceAccount = oBusinessPartnersService.GetDataInterface(AccountsServiceDataInterfaces.asdiOpenningBalanceAccount)

'set the account code (account name = Common Stock (HO, USA, GA )) 'for the opening balance account
oOpenBalanceAccount.OpenBalanceAccount = "_SYS00000000078"

'save data to xml file
oOpenBalanceAccount.ToXMLFile("c:\OpenningBalanceAccount.xml")

'create OpenBalanceAccount from xml file
oOpenBalanceAccountXmlFile = oBusinessPartnersService.GetDataInterfaceFromXMLFile("c:\OpenningBalanceAccount.xml")

Shows how to get an Openning Balance Account from an XML file.
GetDataInterfaceFromXMLFile (Visual Basic)Copy Code
Dim oCmpSrv As CompanyService
Dim oAccountsService As AccountsService
Dim oOpenBalanceAccount As SAPbobsCOM.OpenningBalanceAccount
Dim oOpenBalanceAccountFrmFile As SAPbobsCOM.OpenningBalanceAccount

'get company service
oCmpSrv = oCompany.GetCompanyService

'get account service
oAccountsService = oCmpSrv.GetBusinessService(ServiceTypes.AccountsService)

'get OpenBalanceAccount Data Interface
oOpenBalanceAccount = oAccountsService.GetDataInterface(AccountsServiceDataInterfaces.asdiOpenningBalanceAccount)

'set the account number for the opening balance account
oOpenBalanceAccount.OpenBalanceAccount = "_SYS00000000078"

'save data to xml file
oOpenBalanceAccount.ToXMLFile("c:\MyAccount.xml")

'create OpenBalanceAccount from xml file
oOpenBalanceAccountFrmFile = oAccountsService.GetDataInterfaceFromXMLFile("c:\MyAccount.xml")

See Also