cancel
Showing results for 
Search instead for 
Did you mean: 

Matrix Row Non Editable

Former Member
0 Kudos

Dear All Experts,

I have generated my user defined form. There is matrix in this form. Also there is a column 'LineStatus'.

And one field in header is 'Status'.

Now I want if some line's LineStatus is 'Close' then that lines should be non editable in OK Mode. the other should be editable.

And if all linestatus is Close then Status in header should be close and whole form should be noneditable.

How to do this ?

Plz reply.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kuldeep,

As counting Row by Row will consume more time. You can try it as follows:

SAPbouiCOM.Form oForm = (SAPbouiCOM.Form)SBO_Application.Forms.GetForm("FormTypeEx", 1);

                                        SAPbouiCOM.DBDataSource _dBDataSourceMaster, _dBDataSourceChild;

                                        _dBDataSourceChild = oForm.DataSources.DBDataSources.Item("@DETAILTABLE");

                                        SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtrix").Specific;

                                        try

                                        {

                                            if (oMatrix.VisualRowCount > 0)

                                            {

                                                oMatrix.FlushToDataSource();

                                                int count = _dBDataSourceChild.Size;

                                                for (int i = count - 1; i >= 0; i--)

                                                {

                                                    string str = _dBDataSourceChild.GetValue("LINESTATUS", i).ToString();

                                                    if (str == "Close")

                                                    {

                                                        oMatrix.CommonSetting.SetRowEditable(i + 1, false);

                                                    }

                                                    else

                                                    {

                                                        oMatrix.CommonSetting.SetRowEditable(i + 1, true);

                                                    }

                                                }

                                                oMatrix.LoadFromDataSource();

                                            }

                                        }

                                        catch

                                        {

                                            throw;

                                        }

Hope it helps.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi,

Thanks for the reply. I am getting the Invalid Datasource error. I am using your given code.

Regards

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kuldeep,

Make sure that you are using the correct Table Name with @.

Also need to use the field same as in Database with U_FieldName.

Hope it helps.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi,

Thanks. I was not using U_.

It is solved now.

Regards

Answers (1)

Answers (1)

Former Member
0 Kudos

hi.

it is possible.

  Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD

                    If BusinessObjectInfo.ActionSuccess Then

Dim omat1 As SAPbouiCOM.Matrix

                    omat1 = frmContractOrder.Items.Item("944").Specific

                    For i1 As Integer = 1 To omat1.VisualRowCount

            

                        ' If (omat1.Columns.Item("V_3").Cells.Item(i1).Specific.value = oUsername) Then

                        Dim ousname As String = oCompany.UserName

                        If (omat1.Columns.Item("V_4").Cells.Item(i1).Specific.value = oCompany.UserName) Then

                            If (omat1.Columns.Item("V_2").Cells.Item(i1).Specific.value = "Pending") And (Doc_Status = "Draft") Then

                                'If (omat1.Columns.Item("V_2").Cells.Item(i1).Specific.value = "Pending") Then                        'Cell Editable ......

                                omat1.CommonSetting.SetCellEditable(i1, 3, True)

                                'Row Editable.....

                                omat1.CommonSetting.SetRowEditable(i1, True)

                                'omat1.CommonSetting.SetCellEditable(i1, 5, True)

                            Else

                                omat1.CommonSetting.SetCellEditable(i1, 3, False)

                            End If

                        Else

                            omat1.CommonSetting.SetCellEditable(i1, 3, False)

                        End If

                    Next

----------

your second question is

all the fields are disabled mode on non editable mode.

if docstatus="closed" then

        oForm.Mode = SAPbouiCOM.BoFormMode.fm_VIEW_MODE

end if