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

Hide the text field using radio button

Hi,

I have two Radio button in one group and two text fields on the screen .I want the functionality that when I select the radio button the text field related to other radio button become hide (mean no more avail able for input).

Help me out please.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 10:31 AM

    sorry faisal .

    change it as.

    screen-name = 'FIELDNAME'

    " 'FIELDNAME' which u want to hide or display

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 09:14 AM

    Hi Faizal,

    here's the sample code..

    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-t01 .

    PARAMETERS : r_abc RADIOBUTTON GROUP GRP1 USER-COMMAND za DEFAULT 'X',

    r_def RADIOBUTTON GROUP GRP1.

    SELECTION-SCREEN END OF BLOCK b1.

    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-t02.

    PARAMETERS :

    p_1 like mara-matnr MODIF ID GR1 ,

    p_2 like mara-matnr MODIF ID GR1 .

    SELECTION-SCREEN END OF BLOCK b2.

    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE TEXT-t03.

    PARAMETERS :

    p_3 like mara-matnr MODIF ID GR2 ,

    p_4 like mara-matnr MODIF ID GR2 .

    SELECTION-SCREEN END OF BLOCK b3.

    AT SELECTION-SCREEN OUTPUT.

    IF r_abc = 'X'.

    LOOP AT SCREEN.

    IF screen-group1 = 'GR2' .

    screen-active = '0'.

    ELSEIF screen-group1 = 'GR1'.

    screen-active = '1'.

    screen-input = 1.

    ENDIF.

    MODIFY SCREEN.

    ENDLOOP.

    ELSEIF r_def = 'X'.

    LOOP AT SCREEN.

    IF screen-group1 = 'GR1' .

    screen-active = '0'.

    ELSEIF screen-group1 = 'GR2'.

    screen-active = '1'.

    screen-input = '1' .

    ENDIF.

    MODIFY SCREEN.

    ENDLOOP.

    ENDIF.

    Regards,

    Amit.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 09:15 AM

    Hi Faisal,

    You can do it as follows:

    IF p_radio1 eq 'X'.
    LOOP AT SCREEN.
      TEXT2-ACTIVE = 0.
      MODIFY SCREEN.
    ENDLOOP.
    ENDIF.
    

    The above given code will disable TEXT2 if RADIO1 is selected.

    Similarly you can do for RADIO2 as well.

    Best Regards,

    Ram.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 09:17 AM

    Sorry, I designed the screens using layout..se51

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 09:41 AM

    hi, Gautham.

    the following message is appearing

    Field 'fieldname-active' is unknown this neither in on of the specified tables not defined by a "DATA" statement.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 09:42 AM

    Hi Faisal...

    Go to screen attributes.Group all the components related to

    the radio button.

    i.e., group name = 'gr2' related to radio 2 which is not checked.

    now write this code.

    if radio1 = 'X'

    loop at screen

    if screen-group = 'GR2'.

    screen-invisible = 1.

    modify screen.

    endif.

    endloop.

    endif.

    .

    Thanks & regards ,

    Nishad.

    Edited by: Nishad Shah on Oct 29, 2008 10:43 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 10:26 AM

    IF rad1 eq 'X'.

    LOOP AT SCREEN.

    if SCREEN-fieldname = 'TEXT2'. -


    > Field Name which needs to be hidden

    screen-ACTIVE = 0.

    endif.

    MODIFY SCREEN.

    ENDLOOP.

    ENDIF

    hi faisal:

    just change this code at line no 3. make it like

    if SCREEN-FIELD = 'FIELD NAME'

    then do it. ---> SCREEN-field gives u all the elements name used on that screen

    best regards.

    Tahir

    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.