cancel
Showing results for 
Search instead for 
Did you mean: 

Read check boxes and radio buttons from display transaction

0 Kudos

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!!

Accepted Solutions (1)

Accepted Solutions (1)

thomas_brutigam2
Active Participant
0 Kudos

Then you should try it like this:


c1= session.findById("wnd[1]/usr/radRQMST-ESTUKZ5").value 

should work fine

0 Kudos

I tried .vlaue >>

c1 = session.findById("wnd[1]/usr/chkRQMST-STICHPR").value

But it gives an error.

Error "Object doesn't support this property or method: 'session.findById(...).value' - "

Thank you!

thomas_brutigam2
Active Participant
0 Kudos

got it ->

it has to be like this:


c1 = session.findById("wnd[1]/usr/chkRQMST-STICHPR").checked

c1 can be FALSE or TRUE

Edited by: Thomas Br on May 19, 2010 7:26 PM

0 Kudos

Tried .checked

An error message was displayed - Object doesn't support this property or method: 'session.findById(...).checked' -

Appreciate your time and effort.

thomas_brutigam2
Active Participant
0 Kudos

well

than i don't know -

at my work .checked is doing it ... ?!

maybe anotherone has an idea ?!

0 Kudos

Thomas,

I was wondering if you could paste your program that is working ..here in the form.

I appreciate your help in this regard.

thomas_brutigam2
Active Participant
0 Kudos

This will not be necessary...

found out this was working only in Dialogs

your Problem should be solved like this ->


a1 = session.findById(wnd[0])...selected   'checkbox and Radiobutton

returns FALSE if not and TRUE if selected (checked)

0 Kudos

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

0 Kudos

I posted the script ..Its not writing text or true or false text in txt file.

Please help me fix this script.

Thank you!

thomas_brutigam2
Active Participant
0 Kudos

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

0 Kudos

Thank you Thomas!

It worked.

Answers (0)