Skip to Content

SELECTION-SCREEN BASED ON RADIO BUTTON

Hi Folks,

I want to get a selection screen based on the radio buttons.

I mean,

I have two radio buttons r1 and r2.

if the user clicks r1 he has to selection-screen1 else

selection-screen 2.

Can anyone here please let me know how to achieve this.

Thanks,

K.Kiran.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Jul 25, 2007 at 06:48 AM

    Hi kiran,

    Give the default values for obligatory fields.

    Thanks,

    CSR.

    **reward If helpful.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 25, 2007 at 05:03 AM

    Hi

    See the sample code and do accordingly

    REPORT zextest595 .

    *--- Radiobuttons

    PARAMETERS: p_up RADIOBUTTON GROUP a DEFAULT 'X' USER-COMMAND rb,

    p_list RADIOBUTTON GROUP a.

    PARAMETERS: p_pcfile LIKE rlgrap-filename OBLIGATORY DEFAULT 'C:\'

    MODIF ID ccc,

    p_pctype LIKE rlgrap-filetype OBLIGATORY DEFAULT 'ASC'

    MODIF ID ccc,

    p_unix LIKE rlgrap-filename OBLIGATORY DEFAULT '.\'

    MODIF ID ccc.

    PARAMETERS: p_dir LIKE rlgrap-filename OBLIGATORY DEFAULT '.'

    MODIF ID ddd,

    p_fp LIKE rlgrap-filename

    MODIF ID ddd.

    *----


    • AT SELECTION-SCREEN

    *----


    AT SELECTION-SCREEN OUTPUT.

    IF p_up = 'X' .

    LOOP AT SCREEN.

    CASE screen-group1.

    WHEN 'CCC'.

    screen-input = 1. "Enable

    screen-invisible = 0. "Disable

    MODIFY SCREEN.

    WHEN 'DDD'.

    screen-input = 0.

    screen-invisible = 1.

    MODIFY SCREEN.

    ENDCASE.

    ENDLOOP.

    ENDIF.

    IF p_list = 'X'.

    LOOP AT SCREEN.

    CASE screen-group1.

    WHEN 'CCC'.

    screen-input = 0.

    screen-invisible = 1.

    MODIFY SCREEN.

    WHEN 'DDD'.

    screen-input = 1.

    screen-invisible = 0.

    MODIFY SCREEN.

    ENDCASE.

    ENDLOOP.

    ENDIF.

    Reward points for useful Answers

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 25, 2007 at 05:04 AM

    hi

    <b>copy this code. it will solve ur purpose</b>

    SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE title.
    
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    PARAMETER:rad1 RADIOBUTTON GROUP rad USER-COMMAND frad1 DEFAULT 'X',
              rad2 RADIOBUTTON GROUP rad .
    SELECTION-SCREEN END OF BLOCK b1.
    
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
    
    PARAMETER: mtr AS CHECKBOX MODIF ID g3 USER-COMMAND chk1,
               p_matnr TYPE eban-matnr MODIF ID g1,
               sloc AS CHECKBOX MODIF ID g3 USER-COMMAND chk2,
               str_loc TYPE eban-lgort MODIF ID g4.
    
    SELECTION-SCREEN END OF BLOCK b2.
    
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
    SELECT-OPTIONS: matnr1 FOR eban-matnr MODIF ID g2.
    SELECTION-SCREEN END OF BLOCK b3.
    SELECTION-SCREEN PUSHBUTTON /20(10) name USER-COMMAND UCOM.
    
    
    SELECTION-SCREEN END OF SCREEN 100.
    
    
    
    name = 'FETCH'.
    title = 'Test Report'.
    CALL SELECTION-SCREEN '100'.
    
    
    TYPE-POOLS slis.
    
    AT SELECTION-SCREEN OUTPUT.
    
    
    
      IF rad1 = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'G1' OR screen-group1 = 'G4'.
            screen-active = '1'.
            screen-input = 0.
          ELSEIF screen-group1 = 'G2'.
            screen-active = '0'.
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
    
      ELSEIF rad2 = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'G1'  OR screen-group1 = 'G4' OR screen-group1 = 'G3' OR screen-group1 = 'G5'.
            screen-active = '0'.
          ELSEIF screen-group1 = 'G2'.
            screen-active = '1'.
    
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    
      IF mtr = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'G1'.
            screen-input = 1 .
    
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    
      IF sloc = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'G4'.
            screen-input = 1 .
    
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    
    clear sy-ucomm.
    *  iflag = 1.
    

    regards

    ravish

    <b>plz dont forget to reward points if useful</b>

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 25, 2007 at 06:46 AM

    Hi Folks,

    Thanks a ton for the replies.I am getting the desired output.But

    one small problem is that it is working fine only once.It is not

    allowing me to switch from r1 to r2 and vice versa after executing once.

    Only if I come out of the program completely, it is working.

    What I have to do if I have to switch between these two radio buttons

    without coming out of the program.

    SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE MIGO.

    PARAMETERS: R1 RADIOBUTTON GROUP G1 USER-COMMAND KK1 DEFAULT 'X',

    R2 RADIOBUTTON GROUP G1.

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

    SELECT-OPTIONS: S_BUKRS1 FOR MSEG-BUKRS OBLIGATORY MODIF ID K1,

    S_PLANT FOR MSEG-WERKS MODIF ID K1,

    S_DATE FOR MKPF-BUDAT OBLIGATORY MODIF ID K1,

    S_LIFNR1 FOR LFA1-LIFNR MODIF ID K1.

    SELECTION-SCREEN END OF BLOCK B1.

    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

    SELECT-OPTIONS:S_EBELN FOR MSEG-EBELN MODIF ID K2,

    S_LIFNR2 FOR LFA1-LIFNR MODIF ID K2,

    S_BUKRS2 FOR MSEG-BUKRS MODIF ID K2,

    S_WERKS FOR MSEG-WERKS MODIF ID K2.

    SELECTION-SCREEN END OF BLOCK B2.

    SELECTION-SCREEN END OF SCREEN 100.

    CALL SELECTION-SCREEN 100.

    AT SELECTION-SCREEN OUTPUT.

    IF R1 = 'X'.

    LOOP AT SCREEN.

    IF SCREEN-GROUP1 = 'K1'.

    SCREEN-ACTIVE = '0'.

    SCREEN-INPUT = '0'.

    ENDIF.

    MODIFY SCREEN.

    ENDLOOP.

    ENDIF.

    IF R2 = 'X'.

    LOOP AT SCREEN.

    IF SCREEN-GROUP1 = 'K2'.

    SCREEN-ACTIVE = '0'.

    SCREEN-INPUT = '0'.

    ENDIF.

    MODIFY SCREEN.

    ENDLOOP.

    ENDIF.

    Thanks,

    K.Kiran.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 25, 2007 at 06:49 AM

    check this

    selection-screen begin of block entry with frame title text-007.

    parameters: choose radiobutton group a user-command c1 default 'X',

    choose1 radiobutton group a ,

    choose2 radiobutton group a .

    selection-screen skip 1.

    selection-screen begin of block entry1 with frame title text-001.

    parameters:so_werks type marc-werks modif id shw.

    select-options:so_dispo for marc-dispo modif id shw,

    so_fevor for marc-fevor modif id shw.

    parameters: s_budat type mkpf-budat modif id dat.

    select-options:sw_budat for mkpf-budat no-extension modif id wek.

    parameters: month(2) type n modif id mth.

    parameters: yr(4) type n modif id yr.

    selection-screen end of block entry1.

    selection-screen end of block entry.

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

    initialization.

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

    flg = 0.

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

    at selection-screen output.

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

    if choose = 'X'.

    flg = 1.

    loop at screen.

    if screen-group1 = 'MTH'.

    screen-active = '0'.

    modify screen.

    elseif screen-group1 = 'YR'.

    screen-active = '0'.

    modify screen.

    elseif screen-group1 = 'WEK'.

    screen-active = '0'.

    modify screen.

    else.

    endif.

    endloop.

    elseif choose1 = 'X'.

    flg = 3.

    loop at screen.

    if screen-group1 = 'MTH'.

    screen-active = '0'.

    modify screen.

    elseif screen-group1 = 'YR'.

    screen-active = '0'.

    modify screen.

    elseif screen-group1 = 'COM'.

    screen-active = '0'.

    modify screen.

    elseif screen-group1 = 'DAT'.

    screen-active = '0'.

    modify screen.

    else.

    endif.

    endloop.

    elseif choose2 = 'X'.

    flg = 2.

    loop at screen.

    if screen-group1 = 'DAT'.

    screen-active = '0'.

    modify screen.

    elseif screen-group1 = 'COM'.

    screen-active = '0'.

    modify screen.

    elseif screen-group1 = 'WEK'.

    screen-active = '0'.

    modify screen.

    else.

    endif.

    endloop.

    endif.

    use at selection-screen output

    and modify the screen

    donot forget to give modif id in selection screen fields

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 25, 2007 at 09:32 AM

    Thanks a ton.

    K.Kiran.

    Add comment
    10|10000 characters needed characters exceeded