‎2007 Mar 30 7:48 AM
Hi abap gurus,
I have a requirement where I have two radio buttons in one block and in other block I have the select-options where on selecting one radio button some of select options should be enabled and some greyed out and vice versa when i select the other radio button and in the block containing select-options some are obligatory...How to do this ?
Urgent plzzz..
Regards,
Rag
‎2007 Mar 30 7:51 AM
‎2007 Mar 30 7:51 AM
‎2007 Mar 30 7:51 AM
hi
You can assign all the select options under a group using a MODIF ID addition to the select option using the syntax:
SELECT-OPTIONS:
S_PTYPE FOR SAPLANE-PLANETYPE MODIF ID ABC.
While you use AT SELECTION-SCREEN OUTPUT, if the condition holds true, then check if the group1 equals the modif id and then make it invisible.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF condition is true.
LOOP AT SCREEN.
IF screen-group1 = 'ABC'. "<MODIF ID>
screen-output = 0.
screen-input = 0.
screen-invisible = 1.
Modify SCREEN.
ENDIF.
ENDLOOP.
ELSE.
<Do the converse>
ENDIF.
hopen it helps
regards
navjot
reward points accordingly
‎2007 Mar 30 7:52 AM
at selection screen output.
loop at screen.
if p_rad1 = 'X'.
check screen-group1 = 'mod1'. " This is ur select-option modif id
screen-active = 0.
.....
endif.
modify screen.
endloop.
‎2007 Mar 30 7:59 AM
hi,
you can use radio buttons with function codes for your requirement . if want some select-options to be intensified and disappear you can loop at screen statement for modifying the screen attributes.when you want to make some select-options obligatory you can use attribute "required" for modifying.The following code will you give you a idea about changing attributes dynamically.
LOOP AT SCREEN.
IF screen-group1 = 'MOD'.
IF flag = ' '.
screen-input = '0'.
ELSEIF flag = 'X'.
screen-input = '1'.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
regards,
veeresh
‎2007 Mar 30 8:07 AM
See the sample code below.
tables: mara.
selection-screen: begin of block b1.
select-options: p_matnr for mara-matnr modif id MAT.
select-options: p_matkl for mara-matkl modif id MAK.
parameters: r_b1 RADIOBUTTON group rd1,
r_b2 RADIOBUTTON group rd1.
selection-screen: end of block b1.
at selection-screen output.
loop at screen.
if screen-group1 = 'MAT'.
if r_b1 = 'X'.
screen-required = 1.
elseif r_b2 = 'X'.
screen-required = 0.
endif.
endif.
if screen-group1 = 'MAK'.
if r_b1 = 'X'.
screen-input = 0.
elseif r_b2 = 'X'.
screen-input = 1.
endif.
endif.
modify screen.
endloop.
‎2007 Mar 30 8:35 AM
Try this if your problem is not solved yet
REPORT YCHATEST.
TABLES : MARA , MAKT , SSCRFIELDS.
DATA : V_FLAG(1) VALUE '1',
V_FLAG1(1) VALUE '0'.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : R1 RADIOBUTTON GROUP RAD USER-COMMAND ABC,
R2 RADIOBUTTON GROUP RAD .
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR MODIF ID SE1 ,
S_MAKTX FOR MAKT-MAKTX MODIF ID SE2 .
SELECTION-SCREEN END OF BLOCK B2 .
AT SELECTION-SCREEN.
IF R1 EQ 'X'.
V_FLAG = '1'.
V_FLAG1 = ' '.
ELSE.
V_FLAG = ' '.
V_FLAG1 = '1'.
ENDIF.
CHECK SSCRFIELDS-UCOMM EQ 'ONLI'.
IF R1 EQ 'X' AND
S_MAKTX[] IS INITIAL.
MESSAGE E001(ZZ) WITH 'Maktx is mandatory'.
ENDIF.
IF R2 EQ 'X' AND
S_MATNR[] IS INITIAL.
MESSAGE E001(ZZ) WITH 'Matnr is mandatory'.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 EQ 'SE1'.
SCREEN-INPUT = V_FLAG1.
MODIFY SCREEN.
ENDIF.
IF SCREEN-GROUP1 EQ 'SE2'.
SCREEN-INPUT = V_FLAG.
MODIFY SCREEN.
ENDIF.
ENDLOOP.