I’m trying to automate some SAP processes and I’m having a wierd issue with a large table. I’m trying to find the first empty row, so I used Get text and had it loop through the column index with the selector:
"<"wnd app=‘saplogon.exe’ cls=‘SAP_FRONTEND_SESSION’ title=‘Change Contract : Item Overview’ /><“sap id=‘usr/tblSAPMM06ETC_0220’ tableCol=‘3’ tableRow=’” + rowindex.ToString + “’ />”
(I put some extra quotation marks in the bracket to make it show up in the preview)
To speed up the process I made it jump in 1000, 100, 10 and 1 step increments, resetting one step and using a smaller increment when it finds and empty cell or if the selector doesn’t work. The process ends when it has worked its way down to one step increments and found the first empty cell.
This works fine in all tables so far, except for one. The table has 2907 rows and the first empty row is row 2873. The script I’ve written reads a cell on row 2800 and then tries to read a cell on row 2900. This cell is empty, but Get Text returns the same text I got from row 2800. It then tries to read 3000 and gets an error, resseting it to 2900 where it works its way through rows 2900 to 2907 returning the same value from row 2800, before finally stopping on row 2908 where it gets and error.
I put a write line, with the row index and text output from get text after every get text call and this was the output:
I used Get Text directly on an empty cell, and then it returnd an empty string. It also worked if I rewrote the code to check each row, the problem is that it takes over 5 minutes for the process to complete.
Thanks for reading, this became a little longer then I intended it to be. Any other quick method of finding the first empty row would be lovely.