I'm using VBA to extract the 'Total' value from SAP COOIS and paste it into Excel. Everything works fine except capturing the Total value, because the position of the Total changes every time, and I can't figure out how to dynamically locate and copy it into Excel.
SAP GUI Scripting is enabled and working.
Filters, resizing, and navigation all work fine.
I can reach the Total manually, but it doesn’t have a fixed row or cell position.
How can I programmatically capture the Total value from the SAP ALV grid (where the Total is calculated after summing a column) and copy it to Excel even when its position changes?
Attached is the working script up to the Total display, but I need help with the part that extracts the value.
Thanks in advance!
To dynamically read ALV grid data in SAP using scripting, you may need to loop through visible rows in the grid using:
Set grid = session.FindById("grid_id")
value = grid.GetCellValue(rowIndex, "columnKey")