Showing results for 
Search instead for 
Did you mean: 

Load .NET Objects to SAPbouiCOM.Matrix

0 Kudos

Hi all,

the matrix object still doesn't support to "loadfromxml". We read the content of a matrix with the "serializeasxml" method but we can't write.

Is there any workaround / best practise to get for example list of .net objects to a matrix / grid?

Can we use a windows data table with a binding or is only a "sap data table" supported.

I know that there is a way with "ExecuteQuery" to load SQL data into matrix/grid, but if you want to display the result for example of an webrequest, is this no option.

Thank you for feedback!

Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

Hi Simon,

Displaying directly from .Net datatable to matrix is not possible.

But, if you bind the matrix to a SAPbouiCOM.DataTable that support serialize/ load from xml

Using this object you can :

1. Serialize the .Net datatable into xml.

2. Convert this .Net datatable XML into SAPbouiCOM.DataTable XML, either hand compose it, or using XSLT template.

3. Load the result XML into the SAPbouiCOM DataTable object.

4. Load the SAPbouiCOM DataTable into the matrix.



0 Kudos

Hi Edy,

thank you for the feedback. I'm sorry but this is really a hard way... omg...

Do you know if there are any ideas from SAP to improve that development part?



Active Contributor
0 Kudos

Hi Simon,

I'm working on an open project, where I've implemented something like that.

b1pp/DataTableExtensions.cs at master · pedromagueija/b1pp · GitHub

What it does is, it extends the DataTable to be able to load a strongly typed IEnumerable.

The "trick" is that the properties of the object should match the columns.

Usage is something like:

List<Warehouse> items = new List<Warehouse>();

... add items to list ...

dataTable.AppendValues(items, startIndex);

Have a look and see if it fits.

Feedback is welcome.

Best regards,

Pedro Magueija

View Pedro Magueija's profile on LinkedIn