0 Replies Latest reply: Jun 14, 2012 5:27 PM by Bruno F RSS

Query selection script

Bruno F
Currently Being Moderated

Hi all there guys,

 

I'm quite new on this incredible SAP vbscripting world, but have some knowleadge to try working with scripts. Since I've found the recording tool I was saving some actions to understand how it works.
So now I'm trying to select and open a Query in S_PH0_48000513 transaction by selecting it by name but I'm stuck with it.

 

As you can see, I just leave every action incluiding scrollbars movments (please don't laugh) till the problematic sentence that I need to choose by name wich is:

 

'session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").getAbsoluteRow(1070).selected = true' 

 

I would like to select this row by it's name, and I don't know if it is posible to add a "match or index action" to get the line position number. I also tried to write sesion.findByName but I get an error label saying that the object can't support this action.

 

Any help and ideas will be really apreciated... Thank you in advance!.

 

The Script:

 

If Not IsObject(application) Then

   Set SapGuiAuto  = GetObject("SAPGUI")

   Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

   Set connection = application.Children(0)

End If

If Not IsObject(session) Then

   Set session    = connection.Children(0)

End If

If IsObject(WScript) Then

   WScript.ConnectObject session,     "on"

   WScript.ConnectObject application, "on"

End If

session.findById("wnd[0]").maximize

session.findById("wnd[0]/tbar[0]/okcd").text = "S_PH0_48000513"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[1]/usr/cmbDYNP4100-DD_USERGROUP").setFocus

session.findById("wnd[1]/usr/cmbDYNP4100-DD_USERGROUP").key = "2"

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_FUNCAREAS").getAbsoluteRow(2).selected = true

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_FUNCAREAS/txtDYNP4100_TC_FUNCAREAS-NAME[0,2]").setFocus

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_FUNCAREAS/txtDYNP4100_TC_FUNCAREAS-NAME[0,2]").caretPosition = 0

session.findById("wnd[1]/tbar[0]/btn[0]").press

session.findById("wnd[0]/tbar[1]/btn[6]").press

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1001

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1004

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1001

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1004

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1007

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1010

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1013

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1016

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1019

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1022

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1025

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1031

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1034

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1043

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1052

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1055

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1061

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").verticalScrollbar.position = 1064

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES").getAbsoluteRow(1070).selected = true

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES/txtDYNP4300_TC_QUERIES-NAME[0,4]").setFocus

session.findById("wnd[1]/usr/tblSAPLAQ_INT_FUNCTIONSTCH_OPEN_QUERIES/txtDYNP4300_TC_QUERIES-NAME[0,4]").caretPosition = 0

session.findById("wnd[1]/tbar[0]/btn[0]").press

session.findById("wnd[0]").sendVKey 8

session.findById("wnd[0]/mbar/menu[0]/menu[3]/menu[2]").select

session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select

session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus

Actions