on 01-04-2016 3:40 PM
Hi , Im trying to find a way to count the row index within a GuiBox Object. For instance I´m using T-code FF68
Each column have an unique index [ i ,0] Amount ; [i,15] Check no ;[i,26] Issue ..etc .
and the Row index start with 0 and ends in 24 = (25 visible Lines only)
My problem is that I need to input hundreds of lines using an excel application where i = 3 To Last Active Row while in the GuiBox Object I can input 25 rows only then Index needs to be set back to 0 again time after time.
.FindById("wnd[0]/usr/sub:SAPMF40S:8000/txtFEBSCA-KWBTR [" & i - 3 & ",0]
Is there a way to count the Row Index within a GuiBox Object so I can use this value to set for example an If statement
If a = 24 Then (To include 25 lines again)
.FindById("wnd[0]/tbar[1]/btn[5]").Press
.FindById("wnd[0]/tbar[1]/btn[5]").Press
.FindById("wnd[0]/usr").VerticalScrollbar.Position = 25
If a => 24 Then n = 25 To set the row index back to 0
[" & i - 3 -n & ",0]
Here is my code
Thanks in advance
Kind Regards
Alan
Does your code throw an error when you progress past the visible rows?
if so you could error handle it and use the error as a trigger to scroll down and capture the current I value to be used as an offset
e.g.
Ehandler1:
err.clear
Session.FindById("wnd[0]/usr").VerticalScrollbar.Position = I + OffsetI
OffsetI = I
Resume Ehandler1rentry:
there is probably got a much better way of doing this but it should work
Cheers,
Robin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Robin
Thanks for the suggestion but I have just realized that rows displayed can vary due to screen resolution or SAP Theme selected ; With SAP Enjoy Theme I can see 25 rows and with SAP Signature Theme I can see 27 rows available . For me the best would be to find a method to count all rows available in a GuiBox and define two variables. i to count rows in the spreadsheet and a to count rows in GuiBox
Cheers
Alan
I believe something similar is the case in tables.
Where the number of visible rows can vary based on your screensize, and where scrolling does not affect the cell coordinates.
In that case I scroll through the table after each entry (update of verticalposition), without updating the cell coordinates.
Below is a part from an Excel VBA-script where in the loop only the scrollbar position is updated.
Maybe something similar can be used in your case.
Set TABLE1 = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D") 'Tabel met artikels
cntCols = TABLE1.Columns.Count
visRows = TABLE1.VisibleRowCount
cntRows = TABLE1.RowCount
barMax = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D").verticalScrollbar.Maximum
barMin = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D").verticalScrollbar.Minimum
barPage = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D").verticalScrollbar.Pagesize
r = 0
Do While barPos <= barMax
Worksheets("Reservatie").Cells(startrow + 1 + r, 1).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-ZRES_RSPOS[0,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 2).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-MATNR[1,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 3).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-MAKTX[2,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 4).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-ERFMG[3,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 5).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-ERFME[4,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 6).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-WERKS[5,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 7).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-LGORT[6,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 8).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-ENMNG[7,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 9).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/chkLS_ITEMS_ACTIVE-KZEAR[8,0]").Selected
Worksheets("Reservatie").Cells(startrow + 1 + r, 10).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/chkLS_ITEMS_ACTIVE-XLOEK[9,0]").Selected
Worksheets("Reservatie").Cells(startrow + 1 + r, 11).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-ZRES_REPPOS[10,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 12).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-ZRES_MVT_TXT[11,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 13).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-SGTXT[12,0]").Text
Worksheets("Reservatie").Cells(startrow + 1 + r, 14).Value = Session.findById("wnd[0]/usr/tblSAPMZMM_RES_MMPM01TC_TAB_ITEMS_D/txtLS_ITEMS_ACTIVE-BDTER[13,0]").Text
r = r + 1
barPos = barPos + 1
If barPos <= barMax Then
TABLE1.verticalScrollbar.Position = barPos
End If
Loop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.