Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

SP01: UI - Change DataTable with Grid

Hi,

i have a code that adds a DataTable to a form and then links this to a Grid.

this works fine.

the problem is even when i change the DataTable after it is created, the Grid only get cleard and shows the correct headers but the data it self is not shown.

any idea regarding the reson?

my code is:

'Create the DT and link to Grid

form.DataSources.DataTables.Add("DataTable")

form.DataSources.DataTables.Item("DataTable").ExecuteQuery("select * from OITM")

oGrid.DataTable = form.DataSources.DataTables.Item("DataTable")

'change the DataTable or just use the same one

form.DataSources.DataTables.Item("DataTable").ExecuteQuery("select * from OITM")

'which clears the Grid instead of updating it

Thanks

MM

replied

Hi,

The problem has been reported to support.

In the meanwhile a workaround has been proposed:

oForm.Freeze(True)

oGrid.DataTable = Nothing 'detach Grid and DataTable

oForm.DataSources.DataTables.Item("MyDataTable").ExecuteQuery(...)

oGrid.CollapseLevel = 0

oForm.Freeze(False)

Hope it helps

Trinidad.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question