on 05-18-2010 4:10 PM
Hello Experts,
How do I capture whether a radio button or check box is selected in a particular screen.
Example : In display Master Inspection Character (txn QS24). There are several check boxes and radio buttons under control indicator push button. I would like to capture those indicators in excel sheet.
I tried c1= session.findById("wnd[1]/usr/radRQMST-ESTUKZ5").text--> this line was capturing the field name and not whether the field was selected (radio button)
Thanks in advance!!
Then you should try it like this:
c1= session.findById("wnd[1]/usr/radRQMST-ESTUKZ5").value
should work fine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Set fso = CreateObject("Scripting.FileSystemObject")
Set TextFile = fso.CreateTextFile("C:\Documents and Settings\user\Desktop\Conc1.txt",True)
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/nqs23"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[13]").press
session.findById("wnd[1]/tbar[0]/btn[0]").press
c1 = session.findById("wnd[1]/usr/radRQMST-RZWANG4").select
TextFile.WriteLine (c1)
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/tbar[0]/btn[11]").press
TextFile.Close
Edited by: sshugar on May 20, 2010 5:20 PM
Can you read ?! scnr
I wrote clearly
.selected
just let you Prompt a Messagebox like this:
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
'Set fso = CreateObject("Scripting.FileSystemObject")
'Set TextFile = fso.CreateTextFile("C:\Documents and Settings\user\Desktop\Conc1.txt",True)
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/nqs23"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn13").press
session.findById("wnd[1]/tbar[0]/btn[0]").press
msgbox session.findById("wnd[1]/usr/radRQMST-RZWANG4").selected
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/tbar[0]/btn11").press
If you do this there should appear a Messagebox that says False or True (/whether the Checkbox / RadioButton is selected)
PS if you want to write a "Boolean" to a Textfile you should Change it to text ->
c1 = CStr(session.findById("wnd[1]/usr/radRQMST-RZWANG4").selected)
PS here a code where its running Excelent
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/txtP_SERNR").text = radsatzserial
session.findById("wnd[0]/usr/chkP_AKTU").setFocus
session.findById("wnd[0]").sendVKey 8
session.findById("wnd[1]").sendVKey 5
'Here are the checkboxes !
session.findById("wnd[1]/usr/tblZIIS_EXEC_ECODETC_ECODE/chkLS_IHSTUFE-MARK[0,9]").selected = false
session.findById("wnd[1]/usr/tblZIIS_EXEC_ECODETC_ECODE/chkLS_IHSTUFE-MARK[0,7]").selected = false
session.findById("wnd[1]/usr/tblZIIS_EXEC_ECODETC_ECODE/chkLS_IHSTUFE-MARK[0,7]").setFocus
session.findById("wnd[1]").sendVKey 7
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.