cancel
Showing results for 
Search instead for 
Did you mean: 

Saving all the records of SAP table as XML

Former Member
0 Kudos

Hi Curtis..

Thanks for ur immediate reply..

I m in ETL project to access data from SAP to Access and vise versa.

I want to know some more details..

1.We usually retrieve the Business Partners List by using GetBPList() method and we traverse record by record and save it as a XML.(XML contains a single recordset)

Is there a way to retrieve full Business Partner Records in a single XML?

Please reply immediately

Thanks in Advance

Sooriyakala.P

Accepted Solutions (1)

Accepted Solutions (1)

jaccomoolenaar
Participant
0 Kudos

Following code works for me (in VB .NET):

Dim rs As SAPbobsCOM.Recordset

Dim query As String

Try

query = "SELECT * FROM OCRD"

rs = oCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

rs.DoQuery(query)

Console.WriteLine("aantal regels ", rs.RecordCount) If rs.RecordCount > 0 Then Dim file As String = "c:\temp\bp.xml" Console.WriteLine("file: ", file)

rs.SaveXML(file)

End If

Catch e As Exception

Dim message As String = _

e.[GetType].ToString + ":" + vbCrLf + _

e.Message + vbCrLf + _

e.StackTrace

Console.Error.WriteLine(message)

MsgBox(message, MsgBoxStyle.Critical)

End Try

Regards,

Jacco

Answers (1)

Answers (1)

jaccomoolenaar
Participant
0 Kudos

Hi,

You can select data from SBO with a query and save the recordset as XML (recordset.saveXML). In this way you can select all records from a table (or add conditions of course) and get a XML-file containing all selected records in XML format. The XML is a bit different than the XML saved from the business object, but most of the time this is not a real problem. Hope this helps.

Kind regards,

Jacco

Former Member
0 Kudos

EmployeesInfo empInfo=company.GetBusinessObjectBoObjectTypes.oEmployeesInfo);

empInfo.SaveToFile("d:
employee.xml");

Can anybdy help me out to find why its not saving all the records into XML?(If i use getbykey() it saves single record only)