Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Read Radio Button Value from Excel using OLE

Former Member
0 Kudos

Hi Experts,

I Need to retrieve the radio button value (Which radio button is selected) from excel and code in ABAP program.

I am trying this using OLE automation.

Below is my Macro coding

'PO Status
If (Sheet6.OptionButton1.Value = True) Then
POStatus = "Ack"
ElseIf (Sheet6.OptionButton2.Value = True) Then
POStatus = "Rejected"
End If

How to convert the above to OLE. I used the coding as below, but I am not getting any value.

CREATE OBJECT e_button 'EXCEL.OPTIONBUTTON'.

CALL METHOD OF e_button 'OPTIONBUTTONS' = e_option1.

CALL METHOD OF e_option1 'NAME'
EXPORTING
#1 = 'OPTIONBUTTON1'.

GET PROPERTY OF e_option1 'Value' = p_val.

Kindly help on this.

By the way, Is there any other way to get the radio button value from Excel ??

Thanks.

1 REPLY 1

Former Member
0 Kudos

hey sri,

suppose there are 5 radio button in 5 rows , so for those 5 radio button only 1 radio button will be selected automatically ,

now acc to the logic

FORM SUB_SELECT_CELL USING P_ROWID TYPE ANY
P_COLID TYPE ANY.
CALL METHOD OF WA_EXCEL 'CELLS' = WA_SCELL
EXPORTING
#1 = P_ROWID
#2 = P_COLID.
* Handle error
PERFORM ERR_HDL.
ENDFORM.

****************************************************************************************************

PERFORM SUB_SELECT_CELL USING OP_SIDE E.
SET PROPERTY OF WA_SCELL 'Value' = 1.

****************************************************************************************************

in op_side select your row no. acc to the logic then set value to 1 for that particular row and coloumn.