03-03-2020 12:34 PM
My basic requirement is to automate the process of saving the entries of a particular configuration(Eg: SPRO) into a TR. When I recorded the process and changed the code, the place where I stucked was, the script is recording the row number also. How to capture the row number dynamically? Can anyone please help?
03-05-2020 8:13 AM
To access a given cell in a GuiTableControl object, by its row and column numbers, use the method GetCell.
To access the cells of one or more columns in a GuiTableControl object, use the property Columns (collection of GuiTableColumn object). mytablecontrol.Columns.ElementAt(0) = first column. To iterate the cells of one column object, use the method ElementAt: mytablecontrol.Columns.ElementAt(0).ElementAt(2) = cell at third row of first column.
But don't forget that you can only access the rows currently displayed. If you need to access the previous or next page of rows, you have to scroll up or down.
03-03-2020 12:41 PM
Hello,
not sure to understand you need...
Do you use SAPGuiScripting to record the process ?
What is result and where do you want to improve "dynamically" ?
03-03-2020 1:19 PM
Hi Stanislas,
Yes, I'm talking about SAP GUI Scripting. I have attached a screenshot. when I'm recording, I need to select a row and include that row in a TR. The row number in the script is dynamic right. So my question is, how to record it.
Thanks in advance.
03-03-2020 1:52 PM
ok, when you record, selected row is hardcoded accordingly in script.
If you want to change it dynamically, you have to use VBScript code in script.
For sentence, you can include your script in a VBA macro and use Excel to populate data as you want.
03-03-2020 4:21 PM
So, what? Here's what the SAP recorder generates when I select the third line of maintenance dialog for V_TITOBPROF and I click transport...:
session.findById("wnd[0]/usr/tblSAPLITO0CUSTTCTRL_V_TITOBPROF").getAbsoluteRow(2).selected = true
session.findById("wnd[0]/mbar/menu[0]/menu[5]").select
session.findById("wnd[1]/usr/btnSPOP-OPTION2").press
...
Please clarify your question.
03-05-2020 7:11 AM
Hi Sandra,
Thanks for your reply. To be precise, my question is after recording, we change the code in the script by opening it in notepad, so that if we open an excel, the script will run automatically. In this context, I would like to know how can we pass the row number in the following statement dynamically.
session.findById("wnd[0]/usr/tblSAPLITO0CUSTTCTRL_V_TITOBPROF").getAbsoluteRow(2).selected = true
Thanks in Advance.
03-05-2020 7:27 AM
You mean, a variable instead of 2? Like this:
variable = 2
session.findById("wnd[0]/usr/tblSAPLITO0CUSTTCTRL_V_TITOBPROF").getAbsoluteRow(variable).selected = true
Or do you mean that you want to scan the table to search a given value and get the line number where it's located?
03-05-2020 7:52 AM
Exactly. I want to scan the table and identify the row where it is located and give the line number. Because, after selecting that row only, system will be able to include that line data into a TR. Is there a way?
Thanks in advance.
03-05-2020 8:13 AM
To access a given cell in a GuiTableControl object, by its row and column numbers, use the method GetCell.
To access the cells of one or more columns in a GuiTableControl object, use the property Columns (collection of GuiTableColumn object). mytablecontrol.Columns.ElementAt(0) = first column. To iterate the cells of one column object, use the method ElementAt: mytablecontrol.Columns.ElementAt(0).ElementAt(2) = cell at third row of first column.
But don't forget that you can only access the rows currently displayed. If you need to access the previous or next page of rows, you have to scroll up or down.