on 2024 Oct 16 7:32 AM
Hi,
Just wanted to ask how to fetch data rows from SAP table (type of GuiTableControl).
I want to fetch the values for the highlighted/selected rows only and save it to a DataTable.
Example of the reference SAP Table where I only want to grab the data for row 2 & 3 (the selected rows).
But I don't know what property to achieve the "IsHighlighted" logic below.
using System;
using System.Data;
using SAPFEWSELib;
class Program
{
static void Main()
{
GuiTableControl SapTable = (GuiTableControl)session.FindById("your_tablecontrol_id");
DataTable selectedRowsTable = new DataTable();
selectedRowsTable.Columns.Add("Column1", typeof(string));
selectedRowsTable.Columns.Add("Column2", typeof(string));
for (int rowIndex = 0; rowIndex < SapTable.RowCount; rowIndex++)
{
if (IsHighlighted(rowIndex)) // Todo: How to detect if highlighted
{
DataRow newRow = selectedRowsTable.NewRow();
newRow["Column1"] = SapTable.GetCellValue(rowIndex, "Column1");
newRow["Column2"] = SapTable.GetCellValue(rowIndex, "Column2");
selectedRowsTable.Rows.Add(newRow); // Add only highlighted rows
}
}
foreach (DataRow row in selectedRowsTable.Rows)
{
Console.WriteLine($"{row["Column1"]}, {row["Column2"]}");
}
}
}
Request clarification before answering.
Hi,
GuiTableControl organizes the rows in a collection of objects of type GuiTableRow.
See also:
https://help.sap.com/docs/sap_gui_for_windows/b47d018c3b9b45e897faf66a6c0885a8/ce1d9e64355d49568e5de...
Each of the rows is an object in this collection and has properties like "Selected". See also: https://help.sap.com/docs/sap_gui_for_windows/b47d018c3b9b45e897faf66a6c0885a8/5341bac75c8d428eb8460...
Best regards,
Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
65 | |
10 | |
8 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.