cancel
Showing results for 
Search instead for 
Did you mean: 

Binding column matrix to field of user table

Former Member
0 Kudos

Dear all,

I created a new user table "CONTR_EXT".

It has 2 fields:

Contr_No: unique number of associated contract

Type: my special numeric field

I added a new folder in the Service Contract form.

I 'd like to add a matrix in this new folder.

As first step, the matrix should have only one column: "type" bound to the CONTR_EXT.Type field.

What SDK commands do I need to use to create the matrix and in particular to add the type column bound to the user table fields.

For the moment I added this code:


        ...
        ...
        oMatrix = oItem.Specific
        oColumns = oMatrix.Columns

        '//***********************************
        '// Adding Column items to the matrix
        '//***********************************

        oColumn = oColumns.Add("#", SAPbouiCOM.BoFormItemTypes.it_EDIT)
        oColumn.TitleObject.Caption = "#"
        oColumn.Width = 30
        oColumn.Editable = False

        '// Add a column for BP Card Code
        oColumn = oColumns.Add("U_Type", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
        oColumn.TitleObject.Caption = "Type"
        oColumn.Width = 120
        oColumn.Editable = True
        ...
        ...
        

Can someone help me please?

Following the SDK SAP B1 samples I cannot find a solution.

Regards

Emanuele

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Emanuele,

Try This....


      ocolumn = ocolumns.Add("Qua(matrix Column name)", SAPbouiCOM.BoFormItemTypes.it_EDIT)
        ocolumn.Editable = True
        ocolumn.Width = 60
        oitem.FromPane = 51
        oitem.ToPane = 51
        ocolumn.TitleObject.Caption = "Quantity"
        'For data bind
        ocolumn.DataBind.SetBound(True, "@CONTR_EXT(Table Name)", "U_Type(Field Name)")

Thanks

Shafi

Former Member
0 Kudos

Dear Shafi,

I tried:

'// Add a column for Type field

oColumn = oColumns.Add("U_Type", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)

oColumn.TitleObject.Caption = "Tipo"

oColumn.Width = 120

oColumn.Editable = True

'// Add user data sources to the "type" column in the matrix

oColumn.DataBind.SetBound(True, "@CONTR_EXT", "U_Type")

but I have an error message:

cannot find this table

How can bind the matrix column to a user table field?

Regards

Emanuele

Answers (5)

Answers (5)

Former Member
0 Kudos

This message was moderated.

0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Emanuele,

Here you can use normal table

i.e. NO Object

For normal table two fields will come by default i.e. Code and Name

After creating the table of No Object .Bind ur matrix to this table

After This


   omatrix.LoadFromDataSource()

Thanks

Shafi

Former Member
0 Kudos

Dear Shafi,

In the past I created a new form with some edit-boxes placed in the header, and a matrix for the rows.

Header elements were bound to a Document user table,

matrix column were bound to Row document user table.

In this way, when I pressed the "Add" button in the form, a new row were added in the Document user table and new rows were added in the Row Document user tables.

The two tables joined each other using the DocEntry field.

But now, the situation is different, I need to connect Service Contract header to a matrix bound to a user table.

What kind of user table do I have to use to connect the Contract form (header element) and the new matrix containing new row information?

How can SDK understand to visualize the rows with U_ContractID=1 in the matrix of Service Contract with ContractID=1?

i.e., the fields of new No Object user table are:

Code, Name, U_ContractID, U_Type, ...

Regards

Emanuele

Edited by: Emanuele Croci on May 9, 2011 3:55 PM

former_member689126
Active Contributor
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Emanuele,

Try This

After binding the fields


  'Enter some data in the table which u have created "@CONTR_EXT"
                'odbdatasource.Query()
                omatrix.LoadFromDataSource()

Thanks

Shafi

Former Member
0 Kudos

Dear Shafi,

I used your command but nothing happes...

If I go to the first Contract element, the matrix remains empty.

Do I have to implement a specific query?

Do I have to use the command odbdatasource.Query() ?

How can SDK understand to visualize the rows with DocEntry=1 in thematrix of Contract with ContractID=1?

What kind of user table can I use (normal user table, Document, Document Row, Master data, master data row)?

With normal user table I intend the user table composed by:

Code, Name and other user fields

Another point...

In the past I created a new form with some edit-boxes placed in the header, and a matrix for the rows.

Header elements were bound to a Document user table,

matrix column were bound to Row document user table.

In this way, when I pressed the "Add" button in the form, a new row were added in the Document user table and new rows were added in the Row Document user tables.

The two tables joined each other using the DocEntry field.

What kind of user table do I have to use to connect the Contract form (header element) and the new matrix containing new row information?

Regards

Emanuele

Edited by: Emanuele Croci on May 9, 2011 3:21 PM

Former Member
0 Kudos

Hi Emanuele,

I Think There is a problem with the user defined table.Check whether the table is created or not

If Table is Not Created Then Create a Table

then

Try This......


  Dim odbdatasource As SAPbouiCOM.DBDataSource
  odbdatasource = oForm.DataSources.DBDataSources.Add("@CONTR_EXT")
 ocolumn = ocolumns.Add("Qua(matrix Column name)", SAPbouiCOM.BoFormItemTypes.it_EDIT)
        ocolumn.Editable = True
        ocolumn.Width = 60
        oitem.FromPane = 51
        oitem.ToPane = 51
        ocolumn.TitleObject.Caption = "Quantity"
        'For data bind
        ocolumn.DataBind.SetBound(True, "@CONTR_EXT(Table Name)", "U_Type(Field Name)")

Thanks

Shafi

Former Member
0 Kudos

Dear Shafi,

Thank you for the help.

I added these commands:

Dim odbdatasource As SAPbouiCOM.DBDataSource
odbdatasource = oForm.DataSources.DBDataSources.Add("@CONTR_EXT")

The error has disappeared.

Ok... but now... the matrix is always empty.

In the user table, now, I have some rows, i.e.

DocEntry LineId U_Type

... ... ...

1 1 A

1 2 B

... ... ...

How can I visualize these two rows in the matrix of the Contract with ContractID = 1?

Regards

Emanuele

Edited by: Emanuele Croci on May 9, 2011 2:41 PM

Former Member
0 Kudos

Hi

Try this



oColumn = oColumns.Add("#", SAPbouiCOM.BoFormItemTypes.it_EDIT)
        oColumn.TitleObject.Caption = "#"
        oColumn.Width = 30
        oColumn.Editable = False
 
        '// Add a column for BP Card Code
        oColumn = oColumns.Add("U_Type", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
        oColumn.TitleObject.Caption = "Type"
        oColumn.Width = 120
        oColumn.Editable = True
 Dim oUDSTransID As SAPbouiCOM.UserDataSource
 oUDSTransID = objForm.DataSources.UserDataSources.Add("dDocNo", SAPbouiCOM.BoDataType.dt_LONG_TEXT, 100)

  Dim objColumn As SAPbouiCOM.Column
 Dim objUDMatrix As SAPbouiCOM.Matrix

            objColumn = objUDMatrix.Columns.Add("eDocNo", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            objColumn.DataBind.SetBound(True, "", "dDocNo")
            objColumn.Editable = True
            objColumn.Width = 75

Just a sample code which may help you

Thanks

Kevin