cancel
Showing results for 
Search instead for 
Did you mean: 

How add data from user table to the Matrix?

Former Member
0 Kudos

Hallo all. sorry for my english

question: how add data from user table (sample @TABLE) into then matrix?

Please give the programm code

Very Thanks from Moscow, Russia

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Artem,

try this codes in VB6:

Public Sub BindDataToForm()

'//********************************************************

'// binding data to the Form items will set the connection

'// between the requested DB table field and the item

'//********************************************************

Dim oMatrix As SAPbouiCOM.Matrix

Dim oColumns As SAPbouiCOM.Columns

Dim oColumn As SAPbouiCOM.Column

'// getting the form's matrix object

Set oMatrix = oForm.Items.Item("Matrix1").Specific

Set oColumns = oMatrix.Columns

'// getting the matrix columns by the UID

Set oColumn = oColumns.Item("UserName")

'// bindidng the data

oColumn.DataBind.SetBound True, "OUSR", "U_NAME"

Set oColumn = oColumns.Item("UserEmail")

oColumn.DataBind.SetBound True, "OUSR", "E_Mail"

Set oColumn = oColumns.Item("UserPhone")

oColumn.DataBind.SetBound True, "OUSR", "PortNum"

Set oColumn = oColumns.Item("Remarks")

'//************************************************

'// to Data Bind an item with a user Data source

'// the table name value should be an empty string

'//************************************************

oColumn.DataBind.SetBound True, "", "Remarks"

End Sub

Public Sub GetDataFromDataSourec()

Dim oDBDataSource As SAPbouiCOM.DBDataSource

Dim oUserDataSource As SAPbouiCOM.UserDataSource

Dim oMatrix As SAPbouiCOM.Matrix

Dim i As Long '// to be used as counter

'// getting the data sources from the form

Set oDBDataSource = oForm.DataSources.DBDataSources.Item("OUSR")

Set oUserDataSource = oForm.DataSources.UserDataSources.Item("Remarks")

'// getting the matrix from the form

Set oMatrix = oForm.Items.Item("Matrix1").Specific

oMatrix.Clear

'// Querying the DB Data source

oDBDataSource.Query

'// setting the user data source data

oUserDataSource.Value = "Your remarks here ..."

For i = 0 To oDBDataSource.Size - 1

oDBDataSource.Offset = i

oMatrix.AddRow

Next i

oMatrix.AutoResizeColumns

End Sub

Hope this helps.

Former Member
0 Kudos

Hi Gilbert

I need code for SBO version 2004.

How quick will work this example if in user table more than 20000 record?

Thanks

Former Member
0 Kudos

hi

Can u tell me how to save data from matrix and form to userdefined table i have binded all the column to field in udt

Former Member
0 Kudos

Just give databound to true in XML like this....


<column uid="colUID" type="16" title="Item Description" description="" visible="1" AffectsFormMode="1" width="133" disp_desc="0" editable="0" right_just="0" val_on="Y" val_off="N" backcolor="-1" forecolor="-1" text_style="0" font_size="-1">
<databind databound="1" table="@DetailTableName" alias="U_FieldName"/>
<ExtendedObject/>
</column>

Former Member
0 Kudos

Thanks Sudhir

Former Member
0 Kudos

Hello Artem,

You can create a DBDatasource object in DI API to bind the User Defined Table into the matrix. Try to look on the examples provided by SBO. Hope this helps.