Skip to Content

Can't read all rows of GuiGridView

Hi there,

if I try to read all rows of a specific column (containing Date + Time) my script receives after some rows (sometimes ~30, sometimes ~80 - seems like it depends on the window size) only blank values.

I guess SAP isn't loading all values outside the visible area...

Is there a way to receive all needed values?


Here some lines of my script (c#):

GuiGridView grid = (GuiGridView)SAP.session.FindById("wnd[0]/usr/cntlGRID1/shellcont/shell");
for (int i = 0; i < grid.RowCount; i++)
{
    string ticket_DateTime = grid.GetCellValue(i, "LTRMN").ToString() + " " + grid.GetCellValue(i, "LTRUR").ToString();
    
    DateTime dt_ticket = DateTime.ParseExact(ticket_DateTime, "dd.MM.yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
    DateTime dt_now = DateTime.Now;
    
    if (dt_now > dt_ticket)
    {
        dgv_monitor.Rows[1].Cells[2].Value = (int.Parse(dgv_monitor.Rows[1].Cells[2].Value.ToString()) + 1).ToString();
    }
}

After some rows (depends on the SAP window size) it first receive a value like "0000000047", and the next lines just blank.

Thanks for any help!

Kind regards

Kai

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 24, 2018 at 02:51 PM

    Hello Kai,

    it is necessary to actualize the grid. You can find here a solution which shows a code where each 32 lines the grid is actualized via scrolling after the operation. On this way the data will be reloaded and you can read them.

    Let us know your result.

    Cheers
    Stefan

    Add comment
    10|10000 characters needed characters exceeded

    • Hello Kai,

      I don't know another way to put the data in the grid. To reduce the data traffic the backend transfers only the visible data to the frontend, as far as I know. That was the reason why I use scrolling.

      Cheers
      Stefan