如何在 SAP 中使用 C# 将 Grid.DataTable 列值设置为不可编辑

How to set Grid.DataTable column values to not editable using C# in SAP

我使用 C# 在 SAP 中创建了一个简单的数据表,并用查询填充 table。之后我可以毫无问题地显示 table 。但是用户可以编辑列值,这不是很好。我找不到让它们不被 editable 的方法。有没有像 oGrid.Datatable.Columns.readonly()... 这样的简单方法?我知道在 C# "DataGridView" 中你可以做到这一点。有哪位 SAP 专家可以帮助我吗?提前致谢!

***我的代码可以在下面看到

            private SAPbouiCOM.Grid oGrid;
            ....
            //  Set the grid data
            oGrid = ((SAPbouiCOM.Grid)(oItem.Specific));

            oForm.DataSources.DataTables.Add("MyDataTable");
            oForm.DataSources.DataTables.Item(0).ExecuteQuery("....");
            oGrid.DataTable = oForm.DataSources.DataTables.Item("MyDataTable");
            GridCount = oGrid.DataTable.Rows.Count;
            //  Set columns size
            oGrid.Columns.Item(0).Width = 50;
            oGrid.Columns.Item(1).Width = 60;
            oGrid.Columns.Item(2).Width = 130;

发现这是一件非常容易做的事情。但是没有办法只将整个 table 设置为 not editable。您已将每一列设置为 not editable,如下所示。

oGrid.Columns.Item(0).Editable = false;