Application Development and Automation 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 only

handling Radiobutton

Former Member
0 Likes
763

Hi,

I have a requirement where I have 2 radio buttons R1 and R2 and 2 select-options fields field1 and field2 in a report scelection screen.

IF the user clicks the radio button R1, the select option field field1 should be disabled. only field2 should be able to take entries.

Similarly when radio button R2 is clicked, field 2 should be disabled and field1 should be abled.

How can we acheve this?

Regards,

Rajesh

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
740

You can do something like this. This has been answered many times before, next time, you may want to search the forums first. You will get your answer quicker.

PARAMETERS: p_rad1 RADIOBUTTON GROUP grp1 DEFAULT 'X' USER-COMMAND chk,
            p_rad2 RADIOBUTTON GROUP grp1.
SELECT-OPTIONS s_datum1 for sy-datum MODIF ID da1.
SELECT-OPTIONS s_datum2 for sy-datum MODIF ID da2.

at selection-screen OUTPUT.
  loop at screen.
     if screen-group1 = 'DA1'
        and p_rad1 = space.
       screen-input = 0.
       modify screen.
     endif.
     if screen-group1 = 'DA2'
        and p_rad2 = space.
       screen-input = 0.
       modify screen.
     endif.
  endloop.

Regards,

Rich Heilman

Hi,

I have a requirement where I have 2 radio buttons R1 and R2 and 2 select-options fields field1 and field2 in a report scelection screen.

IF the user clicks the radio button R1, the select option field field1 should be disabled. only field2 should be able to take entries.

Similarly when radio button R2 is clicked, field 2 should be disabled and field1 should be abled.

How can we acheve this?

Regards,

Rajesh

4 REPLIES 4
Read only

bpawanchand
Active Contributor
0 Likes
740

Hi

Regards

Pavan

Read only

Former Member
0 Likes
740

Write this logic in

AT SELECTION-SCREEN OUTPUT.

IF R1 = 'X'.

LOOP AT SCREEN.

IF screen-name = 'FIELD1'

screen-invisible = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

IF screen-name = 'FIELD2'

screen-invisible = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Thanks & Regards,

Vivek Gaur

ENDIF.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
741

You can do something like this. This has been answered many times before, next time, you may want to search the forums first. You will get your answer quicker.

PARAMETERS: p_rad1 RADIOBUTTON GROUP grp1 DEFAULT 'X' USER-COMMAND chk,
            p_rad2 RADIOBUTTON GROUP grp1.
SELECT-OPTIONS s_datum1 for sy-datum MODIF ID da1.
SELECT-OPTIONS s_datum2 for sy-datum MODIF ID da2.

at selection-screen OUTPUT.
  loop at screen.
     if screen-group1 = 'DA1'
        and p_rad1 = space.
       screen-input = 0.
       modify screen.
     endif.
     if screen-group1 = 'DA2'
        and p_rad2 = space.
       screen-input = 0.
       modify screen.
     endif.
  endloop.

Regards,

Rich Heilman

Read only

0 Likes
740

Hi,

Thank you.

I tried to implement the code.

It works fine.

But when I try to put some validations on the 2 fields (select-options fields), the code is not working properly.

Please see the code below.

data : begin of itab occurs 0,

vbeln like vbak-vbeln,

end of itab.

PARAMETERS: p_rad1 RADIOBUTTON GROUP grp1 DEFAULT 'X' USER-COMMAND chk1,

p_rad2 RADIOBUTTON GROUP grp1.

SELECT-OPTIONS s_datum1 for sy-datum MODIF ID da1.

SELECT-OPTIONS s_datum2 for sy-datum MODIF ID da2.

at selection-screen OUTPUT.

loop at screen.

if screen-group1 = 'DA1'

and p_rad1 = space.

screen-input = 0.

modify screen.

endif.

if screen-group1 = 'DA2'

and p_rad2 = space.

screen-input = 0.

modify screen.

endif.

endloop.

AT SELECTION-SCREEN.

IF P_RAD1 = 'X'.

IF S_DATUM1 IS INITIAL.

MESSAGE ID 'ZZ' TYPE 'E' NUMBER '002' WITH text-305.

ENDIF.

ELSE.

IF S_DATUM2 IS INITIAL.

MESSAGE ID 'ZZ' TYPE 'E' NUMBER '002' WITH text-318.

ENDIF.

ENDIF.

start-of-selection.

select vbeln from vbak into table itab

where erdat LE s_datum1

or erdat le s_datum2.

if sy-subrc = 0.

loop at itab.

write : itab-vbeln.

endloop.

endif.

How can I further go with that?

Regards,

RAjesh