cancel
Showing results for 
Search instead for 
Did you mean: 

Rows count in SAP

former_member766314
Discoverer
0 Kudos

Hello !

In view of counting how many rows I have in my table, I usually export it via `VBA` in excel then count the rows. Is there any way to get it directly from `SAP`? I tried to get it by `.VerticalScrollbar.Maximum`, but unless I don't use it properly, it didn't give me the right number...

ScrollBar = session.findById("wnd[0]/usr").VerticalScrollbar.Maximum
MsgBox ("ScrollBar= " & ScrollBar)

In other words: In this filed I have 316 rows (counted with the excel export); `.VerticalScrollbar.Maximum` gives me 267 rows. Where are the 49 rows left in my count ?

I also found out that that this "information" button make this window appear:

And these two numbers make the 316 I'm looking for: 395-79 = 316

So I tried to interact with this window while recording a macro and it only saves this interaction:

session.findById("wnd[1]/usr/sub/1[0,0]/sub/1/6[0,10]/sub/1/6/8[0,14]/lbl[28,14]").setFocus
session.findById("wnd[1]/usr/sub/1[0,0]/sub/1/6[0,10]/sub/1/6/8[0,14]/lbl[28,14]").caretPosition = 0

No way to copy these numbers...

Thanks for reading and have a good day!

former_member751591
Participant
0 Kudos

Welcome and thanks for visiting SAP Community to get answers to your questions. While you're waiting for help, check out our tutorial to get started in SAP Community.

For example, you can:

- outline what steps you took to find answers (and why they weren't helpful)

- share screenshots of what you've seen/done

- make sure you've applied the appropriate tags.

The more details you provide, the more likely it is that members will be able to help you. Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage readers to respond to your question. Learn more about your Profile here.

Sandra_Rossi
Active Contributor

Please use the right tag. It should be UI SAP GUI for Windows, not ABAP Development.

Sandra_Rossi
Active Contributor
0 Kudos

FYI I solicited the moderator to fix the tag.

Accepted Solutions (1)

Accepted Solutions (1)

stefan_schnell
Active Contributor
0 Kudos

babozo

Hello Houcem-Eddine,
the Maximum property delivers the maximum position of the scrollbar thumb in pixels - that is really what the documentation says. I assume in a context of an ALV list it is the maximum number of lines, without those that are already displayed. So add the PageSize property to the Maximum and you get the number of all lines in the ALV list.

And decrement one, maybe for the header.

Best regards
Stefan

Answers (1)

Answers (1)

matt
Active Contributor
0 Kudos

With ALV in SAPGui, not all data is loaded into the table on the screen. It only comes in when you scroll down. I'm wondering if this is something similar? I.e. you only ever see a window of the data.

former_member766314
Discoverer
0 Kudos
session.findById("wnd[1]/usr/sub/1[0,0]/sub/1/6[0,10]/sub/1/6/8[0,14]/lbl[28,14]").text


matt
Active Contributor
0 Kudos

I've no idea what your comment means.