Skip to Content
author's profile photo Former Member
Former Member

Radio buttons

Hi all ,

I have two radio buttons in my code ,

1) r1

2 ) r2

if i select r1 radio button , in select options

s_vgart for rbkp-vgart default value must be 'RS' and if i

select r2 radio button default value must be 'RD' .

My code :

PARAMETERS : r1 RADIOBUTTON GROUP rg1,

r2 RADIOBUTTON GROUP rg1 DEFAULT 'X'.

SELECT-OPTIONS : s_vgart for rbkp-vgart DEFAULT 'RD'.

Plz give code for this .

Points will be given soon .

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 07:12 AM

    Please try below code:

    tables: rbkp.
    
    parameters: p_rd1 radiobutton group rad1 default 'X' user-command ABC,
                p_rd2 radiobutton group rad1.
    
    select-options: s_vgart for rbkp-vgart.
    
    data: l_value type vgart.
    
    at selection-screen output.
       if not p_rd1 is initial.
          l_value = 'RS'.
       else.
          l_value = 'RD'.
       endif.
       read table s_vgart index 1.
       if sy-subrc ne 0.
          s_vgart-sign = 'I'.
          s_vgart-option = 'EQ'.
          s_vgart-low = l_value.
          append s_vgart.
       else.
          s_vgart-low = l_value.
          modify s_vgart index 1.
       endif.
    

    Note that above code has limitations for index 1 and Sign = 'EQ'.

    If only one value is expected i would advice to go for parameter instead of select-options.

    Kind Regards

    Eswar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 07:14 AM

    Hi

    same requirment

    &----


    *& Report ZNNR_REPORT

    *&

    &----


    *&

    *&

    &----


    REPORT ZNNR_REPORT NO STANDARD PAGE HEADING MESSAGE-ID ZNNR LINE-SIZE 100 LINE-COUNT 65(4).

    ******DATA DECLARATIONS**********

    DATA : BEGIN OF IT_PLANT OCCURS 0,

    MATNR LIKE MARA-MATNR,

    WERKS LIKE MARC-WERKS,

    PSTAT LIKE MARC-PSTAT,

    EKGRP LIKE MARC-EKGRP,

    END OF IT_PLANT.

    DATA : BEGIN OF IT_PONO OCCURS 0,

    EBELN LIKE EKKO-EBELN,

    EBELP LIKE EKPO-EBELP,

    MATNR LIKE EKPO-MATNR,

    WERKS LIKE EKPO-WERKS,

    LGORT LIKE EKPO-LGORT,

    END OF IT_PONO.

    TABLES EKKO.

    ********END OF DATA DECLARATIONS*********

    ********SELECTION SCREEN DESIGN ***********

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

    PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1.

    SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.

    SELECTION-SCREEN END OF BLOCK B1.

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

    SELECTION-SCREEN BEGIN OF LINE.

    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X'.

    SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.

    SELECTION-SCREEN END OF LINE.

    SELECTION-SCREEN BEGIN OF LINE.

    PARAMETERS : R2 RADIOBUTTON GROUP G1.

    SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.

    SELECTION-SCREEN END OF LINE.

    SELECTION-SCREEN END OF BLOCK B2.

    ******END OF SELECTION SCREEN DESIGN****************

    *********INITIALIZATION OF SELECTION SCREEN ELEMENTS.*****

    INITIALIZATION.

    P_WERKS = '1000'.

    S_EBELN-LOW = '4500016926'.

    S_EBELN-OPTION = 'EQ'.

    S_EBELN-SIGN = 'I'.

    APPEND S_EBELN.

    CLEAR S_EBELN.

    ************END OF INITIALIZATION***********************

    ***********SCREEN MODIFICATIONS*******************

    AT SELECTION-SCREEN OUTPUT.

    LOOP AT SCREEN.

    IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.

    SCREEN-INPUT = 0.

    MODIFY SCREEN.

    ENDIF.

    IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.

    SCREEN-INPUT = 0.

    MODIFY SCREEN.

    ENDIF.

    ENDLOOP.

    ********END OF SCREEN MODIFICATIONS*****************

    ***************SCREEN VALIDATIONS *****************

    at selection-screen.

    SELECT SINGLE *

    FROM EKKO

    INTO EKKO

    WHERE EBELN IN S_EBELN.

    IF SY-SUBRC <> 0.

    SET CURSOR FIELD 'S_EBELN-LOW'.

    MESSAGE E999 WITH TEXT-005.

    ENDIF.

    ********end of screen validation*****************

    START-OF-SELECTION.

    *set pf-status '100'.

    IF R1 EQ 'X'.

    SELECT MATNR

    WERKS

    PSTAT

    EKGRP

    FROM MARC

    INTO TABLE IT_PLANT

    WHERE WERKS = P_WERKS.

    LOOP AT IT_PLANT.

    WRITE : SY-VLINE , 2 IT_PLANT-MATNR COLOR COL_KEY,

    21 SY-VLINE , 22 IT_PLANT-WERKS COLOR COL_KEY,

    27 SY-VLINE ,28 IT_PLANT-PSTAT COLOR COL_NORMAL,

    43 SY-VLINE ,44 IT_PLANT-EKGRP COLOR COL_NORMAL.

    ENDLOOP.

    ENDIF.

    IF R2 EQ 'X'.

    SELECT EBELN EBELP MATNR WERKS LGORT

    FROM EKPO

    INTO TABLE IT_PONO

    WHERE EBELN IN S_EBELN.

    LOOP AT IT_PONO.

    WRITE : SY-VLINE , 2 IT_PONO-EBELN COLOR COL_KEY,

    12 SY-VLINE , 13 IT_PONO-EBELP COLOR COL_KEY,

    18 SY-VLINE , 19 IT_PONO-MATNR COLOR COL_NORMAL,

    37 SY-VLINE , 38 IT_PONO-WERKS COLOR COL_NORMAL,

    44 SY-VLINE , 45 IT_PONO-LGORT COLOR COL_NORMAL, 49 SY-VLINE..

    ENDLOOP.

    ENDIF.

    TOP-OF-PAGE.

    IF R1 EQ 'X'.

    *ULINE AT /1(48).

    WRITE : SY-VLINE ,2 'MATERIAL NUMBER',

    21 SY-VLINE , 22 'PLANT',

    27 SY-VLINE , 28 'STATUS',

    43 SY-VLINE , 44 'GRUP', 48 SY-VLINE.

    ULINE AT /1(48).

    ENDIF.

    IF R2 EQ 'X'.

    WRITE : SY-VLINE , 2 'PO NUMBER',

    12 SY-VLINE, 13 'ITEM',

    18 SY-VLINE,19 'MATERIAL NUMBER',

    37 SY-VLINE, 38 'PLANT',

    44 SY-VLINE, 45 'GRUP',

    49 SY-VLINE.

    ULINE AT /1(50).

    ENDIF.

    END-OF-PAGE.

    ULINE AT /1(50).

    WRITE :/10 'PAGE NUMBER', SY-PAGNO.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 07:19 AM

    Hello Shoeb,

    This is very simple.

    See you are having 2 radio buttons r1 and r2 of same group.

    then just loop at screen and if r1 is selected initialize select option with 'RS' else 'RD'.

    Please find the code.

    REPORT zsample .

    TABLES: rbkp.

    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

    SELECT-OPTIONS : s_vgart FOR rbkp-vgart.

    SELECTION-SCREEN END OF BLOCK b1.

    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

    PARAMETERS: r1 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND r1,

    r2 RADIOBUTTON GROUP g1.

    SELECTION-SCREEN END OF BLOCK b2.

    AT SELECTION-SCREEN OUTPUT.

    LOOP AT SCREEN.

    IF r1 eq 'X'. "screen-group1 EQ 'G' AND

    REFRESH s_vgart.

    s_vgart-sign = 'I'.

    s_vgart-option = 'EQ'.

    s_vgart-low = 'RS'.

    APPEND s_vgart.

    CLEAR s_vgart.

    ELSE.

    REFRESH s_vgart.

    s_vgart-sign = 'I'.

    s_vgart-option = 'EQ'.

    s_vgart-low = 'RD'.

    APPEND s_vgart.

    CLEAR s_vgart.

    ENDIF.

    MODIFY SCREEN.

    ENDLOOP.

    Reward If Helpful.

    Regards

    --

    Sasidhar Reddy Matli.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 06:37 AM

    use this code u will get a fair idea.

    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

    PARAMETERS: alv-list RADIOBUTTON GROUP gp1 DEFAULT 'X' USER-COMMAND chk,

    alv-grid RADIOBUTTON GROUP gp1.

    SELECTION-SCREEN END OF BLOCK b1.

    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.

    PARAMETERS: s_matnr TYPE mara-matnr MODIF ID g1.

    SELECT-OPTIONS: k_matnr FOR mara-matnr MODIF ID g2.

    SELECTION-SCREEN END OF BLOCK b2.

    ----


    AT SELECTION-SCREEN OUTPUT.

    LOOP AT SCREEN.

    IF alv-list = 'X' AND screen-group1 = 'G1'.

    screen-active = 0.

    *screen-intensified = '1'.

    MODIFY SCREEN.

    ENDIF.

    IF alv-grid = 'X' AND screen-group1 = 'G2'.

    screen-active = 0.

    MODIFY SCREEN.

    ENDIF.

    ENDLOOP.

    Dont forget to reward points if useful,

    kushagra

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 06:40 AM

    Hi,

    check out the code.

    tables rbkp.

    PARAMETERS : r1 RADIOBUTTON GROUP rg1,

    r2 RADIOBUTTON GROUP rg1 DEFAULT 'X'.

    SELECT-OPTIONS : s_vgart for rbkp-vgart DEFAULT 'RD'.

    at SELECTION-SCREEN OUTPUT.

    if r1 = 'X'.

    refresh s_vgart.

    s_vgart-low = 'RS'.

    s_vgart-option = 'EQ'.

    s_vgart-sign = 'I'.

    append s_vgart.

    elseif r2 = 'X'.

    refresh s_vgart.

    s_vgart-low = 'RD'.

    s_vgart-option = 'EQ'.

    s_vgart-sign = 'I'.

    append s_vgart.

    endif.

    regards,

    Santosh Thorat

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 06:43 AM

    Hi,

    You can do as below in the at selection screen.

    At selection-screen.

    if s_vgart[] is initial.

    if r1 = 'X'.

    s_vgart-sign = 'I'.

    s_vgart-option = 'EQ'.

    s_vgart-low = 'RS'.

    append s_vgart.

    else.

    s_vgart-sign = 'I'.

    s_vgart-option = 'EQ'.

    s_vgart-low = 'RD'.

    append s_vgart.

    endif.

    endif.

    Thanks,

    Sriram Ponna.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 22, 2008 at 06:46 AM

    Hi,

    see the sample code and try

    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

    PARAMETERS : p_aserv RADIOBUTTON GROUP grp

    USER-COMMAND app, "Application server

    p_afile1 TYPE filename-fileextern , "Application File

    "Name for contracts

    p_afile2 TYPE filename-fileextern , "Application

    "FileName for

    "Long text

    p_aerfl1 TYPE filename-fileextern , "Error File

    "forcontracts

    p_aerfl2 TYPE filename-fileextern , "Error File

    "for Longtext

    p_pserv RADIOBUTTON GROUP grp, "Presentation Server

    p_pfile1 TYPE rlgrap-filename , "Presentation File

    "Name forcontracts

    p_pfile2 TYPE rlgrap-filename , "Presentation File

    "Name for long

    "texts

    p_errfl1 TYPE rlgrap-filename ,

    "Error File for

    "contracts

    p_errfl2 TYPE rlgrap-filename . "Err File Long text

    SELECTION-SCREEN : END OF BLOCK b1.

    at selection-screen output.

    IF p_pserv IS INITIAL.

    LOOP AT SCREEN.

    CASE screen-name.

    WHEN 'P_PFILE1'.

    screen-input = 0.

    MODIFY SCREEN.

    WHEN 'P_PFILE2'.

    screen-input = 0.

    MODIFY SCREEN.

    WHEN 'P_ERRFL1'.

    screen-input = 0.

    MODIFY SCREEN.

    WHEN 'P_ERRFL2'.

    screen-input = 0.

    MODIFY SCREEN.

    ENDCASE.

    ENDLOOP.

    ELSE.

    LOOP AT SCREEN.

    CASE screen-name.

    WHEN 'P_AFILE1'.

    screen-input = 0.

    MODIFY SCREEN.

    WHEN 'P_AFILE2'.

    screen-input = 0.

    MODIFY SCREEN.

    WHEN 'P_AERFL1'.

    screen-input = 0.

    MODIFY SCREEN.

    WHEN 'P_AERFL2'.

    screen-input = 0.

    MODIFY SCREEN.

    ENDCASE.

    ENDLOOP.

    ENDIF.

    Regards,

    nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 08:54 AM

    Thanks Guys

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.