on 11-10-2010 8:04 AM
Hello,
If I scroll through a relatively large grid in script, my computer's memory flows completely over (Over 2 GB visible in taskmanager, only 1 GB available physically).
Now I understand that the grid's values are read into memory while getting visible on the screen. But it of course also slows down my computer considerably.
Is there a way to free up the memory used by the rows I already scrolled passed?
This is the code:
Set grd = Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell")
With grd
'Cellen vullen
For Iy = 0 To .rowcount - 1 Step .VisibleRowCount
.firstVisibleRow = Iy
Next Iy
End With
Regards, bas.
These memory problems were caused by SAP GUI 710 patchlevel 11.
Problem solved by installing patch level 17.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And to add to that:
The memory doesn't get freed up untill I completely close the SAP GUI, including logon-pad.
Leaving the grid doesn't free up memory.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bas,
I have found that this phenomenon has nothing to do with the script. This can also manually create in the grid. One of the possible solutions to the problem is that it sorts the grid in between again.
For example:
ly_ = 0
set grd = Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell")
With grd
For ly = 0 to .rowcount - 1 step .VisibleRowCount
.firstVisibleRow = ly
if ly / 5000 > 1 + ly_ then
.selectColumn "ORDER_NR"
.pressToolbarButton "&SORT_ASC"
.selectColumn "ORDER_NR"
.pressToolbarButton "&SORT_DSC"
ly_ = ly_ + 1
end if
Next
End With
Of course, the parameter ORDER_NR must be adjusted.
Regards,
ScriptMan
Hi Scriptman,
Thanks for your answer. Yes, I noticed it is not the script causing this. Scrolling a grid manually has the same effect. It's just the SAPgui not freeing up memory space. Even when the grid is not on the screen anymore the data will stay in memory. Opening the grid again and scroll through it, just adds up to what's already in memory.
I'am sorry to say, but your solution didn't work.
I even tried deleting rows from top while I was scrolling down. But that also didn't free up any memory.
Regards, Bas.
Hi Bas,
I am sorry that I have not expressed myself correctly. The grid should not be scrolled. It is to sort. The best in the first column first descending and then ascending. After that, the memory must be freed.
The above example sorts the scrolling grid to every 5,000 new rows.
Regards,
ScriptMan
Edited by: ScriptMan on Nov 12, 2010 1:24 PM
Okay,
I'm in IW39 (maintenance workorders), but step to workorder operations from there. The system will tell that I'm still in IW39, but the overview will look like IW49.
The grid has 15 columns and 5847 rows. (I set the interval for sorting in your earlier proposal to 1000 instead of the 5000)
Regards, Bas.
Hi Bas,
Unfortunately I do not have access to the transaction IW39. Suppose you have at least 2 layouts for the report, you can try, to switch between this.
For example:
. . .
if ly / 1000 > 1 + ly_ then
.pressToolbarButton "&MB_VARIANT"
session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").setCurrentCell 8,"TEXT"
session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").selectedRows = "8"
session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").clickCurrentCell
.pressToolbarButton "&MB_VARIANT"
session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").setCurrentCell 7,"TEXT"
session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").selectedRows = "7"
session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").clickCurrentCell
ly_ = ly_ + 1
end if
. . .
The commands after you press the button "MB_Variant" you must create itself.
Regards,
ScriptMan
Well, thanks again Sriptman,
I tried your suggestion manually, not in code. But changing layout doesn't help. Also again, it even adds some more MB in memory.
I am starting to wonder if there's something wrong with my gui (710 with patch 11) or PC. A user shouldn't have to run into memory problems just by scrolling a list, isn't it?
Regards, Bas.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.