Application Development 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: 

using Back button issue for radio button

Former Member
0 Kudos

Dear All,

My initial screen has 2 radio buttons, on selecting will take to a selection screen with few fields, i have enabled the back button using MODULE user_command AT EXIT-COMMAND.

  when i select a Radio Button 1 which takes to the Selection Screen 1, if the user clicks back button it works fine, even thou we got a mandatory field, it goes back,

however when i click Radio Button 2 it still takes me to Selection Screen 1, its the same vice versa.


Is there anyway i can change the screen based on radio button entry

4 REPLIES 4

karun_prabhu
Active Contributor
0 Kudos

Of course, you can do that.

Please debug and see the program flow on PAI of radio button click.

Whichever radio button is selected will have the value 'X'. Based on this, it can be achieved.

former_member196651
Contributor
0 Kudos

Hi Krishnan,

I believe that, when you click on any radio button you are taken to a Module Pool screen. That is why you said about using MODULE user_command AT EXIT-COMMAND. See when you perform exiting a program from AT EXIT-COMMAND it will not perform mandatory field checks, type checks etc.

If you want to check the mandatory field, then please code the same out side a module with AT EXIT-COMMAND addition.

Regards,

Abijith

Former Member
0 Kudos

Hi Krishnan,

Please refer below code, even if you are using module pool screen, i think the PAI and PBO is same:

SELECTION-SCREEN BEGIN OF SCREEN 100.
PARAMETERS: p_rad RADIOBUTTON GROUP rad1 USER-COMMAND ucomm,
p_rad2 RADIOBUTTON GROUP rad1.
SELECTION-SCREEN END OF SCREEN 100.

SELECTION-SCREEN BEGIN OF SCREEN 200.
PARAMETERS: p_file TYPE string.
SELECTION-SCREEN END OF SCREEN 200.

SELECTION-SCREEN BEGIN OF SCREEN 300.
PARAMETERS: p_mater TYPE matnr.
SELECTION-SCREEN END OF SCREEN 300.

INITIALIZATION.
  CALL SELECTION-SCREEN 100.

AT SELECTION-SCREEN.
  IF p_rad EQ 'X'.
    CALL SELECTION-SCREEN 200.
  ELSEIF p_rad2 EQ 'X'.
    CALL SELECTION-SCREEN 300.
  ENDIF.

START-OF-SELECTION.

  WRITE:p_file,/,p_mater.

regards,

Archer

Former Member
0 Kudos

Hi Krishan,

You can call your desire selection screen based on the button click.

if you are working on report program (SE38), then say you have two radio button p1 and p2 and also you have created two selection screen block B1 and B2 and each block has some selection screen elements i.e fields.

Now if you want that after radio button click b1, you want the only selection screen block B1 and while clicking radio button b2 click ,you want only selection screen block B2.

Two acheive this in report programming, use the event AT SELECTION-SCREEN OUTPUT.

so a demo code for the same,

SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-049.

PARAMETERS: p_header RADIOBUTTON GROUP asim USER-COMMAND s DEFAULT 'X',

                            p_item RADIOBUTTON GROUP asim.

SELECTION-SCREEN END OF BLOCK lim.

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

PARAMETERS : p_vbeln TYPE vbak-vbeln MODIF ID sc1,

              p_audat TYPE vbak-audat MODIF ID sc1.

SELECTION-SCREEN END OF BLOCK b1.

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

PARAMETERS : p_vbeln1 TYPE vbap-vbeln MODIF ID sc2,

                             p_posnr TYPE vbap-posnr MODIF ID sc2.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

   IF p_header EQ 'X'.

     LOOP AT SCREEN.

       IF screen-group1 = 'SC1'.

         screen-active = '1'.

       ELSEIF screen-group1 = 'SC2'.

         screen-active = '0'.

       ENDIF.

       MODIFY SCREEN.

     ENDLOOP.

   ELSEIF p_item EQ 'X'.

     LOOP AT SCREEN.

       IF screen-group1 = 'SC2'.

         screen-active = '1'.

       ELSEIF screen-group1 = 'SC1'.

         screen-active = '0'.

       ENDIF.

       MODIFY SCREEN.

     ENDLOOP.

   ENDIF.


If you are working with Module POOL, then code in the PAI of the screen, and call your respective screen while respective button click.


code:


MODULE user_command_900 INPUT.


     IF p1 EQ 'X'.

          CALL SCREEN 9001.

     ELSEIF p2 EQ 'X'.

          CALL SCREEN 9002.

     ENDIF.


NOTE: your screen 9001 have some screen input fields and 9002 have some screen input fields.



Thanks & Regards

Syed