Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Radio button issue

Former Member
0 Likes
1,168

Hi,

  i have created 2 radio buttons as p_code,p_pono and select-options as s_ccode ,s_pono.

when i am selecting p_pono , s_pono should be deactivated,but in my code s_pono is in activate state and i am able to enter the values.

can any one please give me solution. i am attaching the code.

Thanks

Deepthi.

10 REPLIES 10
Read only

former_member187748
Active Contributor
0 Likes
1,117

Hi Please check

i have done some changes

please check its working or not

Read only

0 Likes
1,117

i am not able to find the changes.

Read only

0 Likes
1,117

Hi Deepthi,

please see, if you wants to gets only some fields based on that radio button, and wants to get

other radio button fields disappeared, please change your code as shown below.

Lets say i have two radiobutton rad1 and rad2.

Then i will write my code as shown below

AT SELECTION-SCREEN OUTPUT.

   IF rad1 NE 'X' .

     LOOP AT SCREEN.

       CASE SCREEN-GROUP1.

         WHEN 'modif id'.

           SCREEN-ACTIVE = 0.

           MODIFY SCREEN.

       ENDCASE.

     ENDLOOP.

     CLEAR : fields name.

   ENDIF.


IF rad2 NE 'X' .

     LOOP AT SCREEN.

       CASE SCREEN-GROUP1.

         WHEN 'modif id'.

           SCREEN-ACTIVE = 0.

           MODIFY SCREEN.

       ENDCASE.

     ENDLOOP.

     CLEAR : field name.

   ENDIF.

Read only

Former Member
0 Likes
1,117

Hi,

Create the Modif ID for your selection! because

The addition MODIF ID assigns all the screen elements for the selection criterion to the modification group modid that is assigned to column group1 in the system table screen. This means they can be modified with a MODIFY SCREEN statement before the selection screen is displayed. You must specify the name of the modification group modid directly and it can only contain a maximum of three characters.

Read only

Former Member
0 Likes
1,117

Hi Deepthi,

Even though you have specified MODIF ID's in lower case, when you check them within the SCREEN Loop, you should check for Upper Case Values. In your case, you should check for SCREEN-GROUP1 = 'PON' / 'COD'.

At the same time, specify a default radio button and a user command too. Specifying a default radio button will trigger your deactivation logic when you execute your code for the first time. Specifying a user command will trigger the Selection Screen PBO automatically when you select the radio button so that you don't need to press Enter.

Read only

Former Member
0 Likes
1,117

HI,


Selection-Screen : Begin of Block b1 WITH FRAME TITLE TEXT-001.

parameter : p_code Radiobutton Group rdb USER-COMMAND s DEFAULT 'X',

             p_pono Radiobutton Group rdb.

Selection-Screen End of block b1.

Selection-Screen : Begin of Block b2 WITH FRAME TITLE TEXT-002.

select-options : s_ccode for sy-datum modif id one,

                  s_pono for sy-datum modif id two.

selection-screen End of block b2.

At selection-screen output.

if p_code = 'X'.

loop at screen.

   if screen-group1 = 'ONE'.

      screen-INPUT = '1'.

      elseif screen-group1 = 'TWO'.

      screen-INPUT = '0'.

    endif.

MODIFY SCREEN.

ENDLOOP.

Endif.

if p_pono = 'X'.

LOOP AT SCREEN.

   if screen-group1 = 'TWO'.

      screen-INPUT = '1'.

      elseif screen-group1 = 'ONE'.

      screen-INPUT = '0'.

    endif.

   modify screen.

    endloop.

ENDIF.


Try this.


Regards

Read only

Former Member
0 Likes
1,117

This message was moderated.

Read only

rosenberg_eitan
Active Contributor
0 Likes
1,117

Hi,

I took the liberty to simplify the code.

- I recommend using type on input parameters (so we can get the parameter name when using help )


- I added USER-COMMAND c01 .
- I use perform.
- I use case structure (I think cleaner code).
- I use abap_true NOT 'X' (TYPE-POOLS: abap) .


TYPE-POOLS: abap .

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

PARAMETER : p_code TYPE radiob RADIOBUTTON GROUP rdb USER-COMMAND c01 DEFAULT 'X' ,
            p_pono TYPE radiob RADIOBUTTON GROUP rdb.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECT-OPTIONS : s_ccode FOR wa_ekko-bukrs MODIF ID cod ,
                 s_pono  FOR wa_ekko-ebeln MODIF ID pon .
SELECTION-SCREEN END OF BLOCK b2.


AT SELECTION-SCREEN OUTPUT .
  PERFORM at_selection_screen_output .

*----------------------------------------------------------------------*
FORM at_selection_screen_output .

  LOOP AT SCREEN.

    CASE screen-group1 .

      WHEN 'COD' .


        screen-input = '0'.
        IF p_code EQ abap_true .
          screen-input = '1'.
        ENDIF .


      WHEN 'PON' .


        screen-input = '0'.
        IF p_pono EQ abap_true .
          screen-input = '1'.
        ENDIF .


    ENDCASE .

    MODIFY SCREEN.

  ENDLOOP.

ENDFORM .                    "at_selection_screen_output
*----------------------------------------------------------------------*

Read only

former_member220538
Active Participant
0 Likes
1,117

Hi,

You have to make a radio button as default and add a user command to it.Please refer the below code for the changes made.

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

PARAMETER : p_code RADIOBUTTON GROUP rdb DEFAULT 'X' USER-COMMAND cmd,

                        p_pono RADIOBUTTON GROUP rdb.

SELECTION-SCREEN END OF BLOCK b1.

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

SELECT-OPTIONS : s_ccode FOR WA_ekko-bukrs MODIF ID cod,

                                s_pono FOR WA_ekko-ebeln MODIF ID pon.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

   LOOP AT SCREEN.

     IF p_code = 'X'.

       IF screen-group1 = 'PON'.

         screen-input = '0'.

       ENDIF.

     ELSEIF p_pono = 'X'.

       IF screen-group1 = 'COD'.

         screen-input = '0'.

       ENDIF.

     ENDIF.

     MODIFY SCREEN.

   ENDLOOP.


Regards,

Jeffin

Read only

former_member186413
Participant
0 Likes
1,117

Hi, Try this,

LOOP AT SCREEN.

     CASE 'X'.

          WHEN p_code.

             IF screen-group1 = 'PON'.

                    screen-input = '0'.

             ELSEIF screen-group1 = 'COD'.

                    screen-input = '1'.

             ENDIF.

          WHEN p_pono.

             IF screen-group1 = 'PON'.

                    screen-input = '1'.

             ELSEIF screen-group1 = 'COD'.

                    screen-input = '0'.

             ENDIF.

     ENDCASE.

ENDLOOP.