Skip to Content
0

How can I scroll to the bottom of a page with VBS script recording?

Jun 30, 2017 at 10:26 PM

451

avatar image
Former Member

I am writing a program that utilizes VBScript in order to grab data from SAP. When I load the large table of data, select it, and then copy it, I am getting a message saying that not all data is copied to the clipboard. If I scroll down before selecting the data the rows that were not copied become populated. So in my script I want the page to scroll down before selecting all the data and copying it.

I have looked into using the "sendkey" methods for the page down key but my research has led me to believe that this type of command does not actually work for SAP. The macro recorder also does not pick up my action of scrolling down manually.

Is there another way of doing this? Or am I am I mistaken about my previously attempted methods being wrong.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Stefan Schnell
Jul 01, 2017 at 04:33 AM
1

Hello Alexander,

you can find a solution for your problem here. We discuss the same problem in the context to load any table as CSV file from a grid. In this case we actualize all 32 lines the grid until we get the bottom of the table.

Let us know your result.

Cheers
Stefan

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

I have read through this a few times and understand the purpose. It is a very well written post; However, I believe that it is too complicated of a solution for what I need to do. Could you please explain why I would need to do that over using other simpler approaches? I currently have been trying a few other things.

1. Using the firstVisibleRow property I can have the scrollbar move but I cannot figure out how to set the firstVisibleRow to be the last row in the table. Is there not an easy way to do this?

2. Going into the ScrollBar object and setting its position. This has not worked for some reason. I try to set the position to the property "Maximum" that I found in the Scripting help documentation but this does not do anything.

Is there a reason that these methods cannot work? Thank you so much for your valuable time!

0

Hello Alexander,

as far as I know the SAP data provider loads only the visible rows, to minimize data traffic between back end and front end, that is the reason to load the rows successive. If you jump to the end of the table, it also doesn't loads the whole table.

Here I jump to the end of a table and go up a step, you can see the data provider reloads the data.

1. Try this to jump to the end of an ALV Grid

Rows = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").RowCount
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").firstVisibleRow = Rows - 1

2. It seems that the scroll bar isn't supported by the GridView control. If you record you activities and change the position of the scroll bar, the recorder delivers settings of firstVisibleRow.

Cheers
Stefan

alv-grid-reload.jpg (334.4 kB)
1
Former Member

This solution has worked for me I cannot thank you enough! I can finally move on with my project!

1

Hello Alexander,

great to hear this.

Cheers
Stefan

0