2008 Aug 11 4:37 PM
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
2008 Aug 11 4:45 PM
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
2008 Aug 11 4:41 PM
2008 Aug 11 4:43 PM
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.
2008 Aug 11 4:45 PM
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
2008 Aug 12 10:38 AM
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