cancel
Showing results for 
Search instead for 
Did you mean: 

Radio button issue

0 Kudos

I have 2 radio button options..... But if i click SD Invoice number i will show SD Update..... and same shld be for MM Invoice number...... But when i select MM it still shows SD update....... How to dynamically change it? pls help me with this issue...

Pls refer this code.....

SELECTION-SCREEN : BEGIN OF BLOCK c1.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : r1 RADIOBUTTON GROUP rad1 USER-COMMAND u1 DEFAULT 'X'.
SELECTION-SCREEN COMMENT 3(25) text-015 FOR FIELD r1.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : r2 RADIOBUTTON GROUP rad1.
SELECTION-SCREEN COMMENT 3(25) text-016 FOR FIELD r2 .
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN : END OF BLOCK c1.


SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_invnum FOR zsd_vf01-vbeln MODIF ID a OBLIGATORY.
PARAMETERS : rem_upd(100) TYPE c MODIF ID a OBLIGATORY.
SELECTION-SCREEN END OF BLOCK a1.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
SELECT-OPTIONS : s_inv1 FOR zmm_vf01-vbeln MODIF ID b OBLIGATORY.
PARAMETERS : rem_upd1(100) TYPE c MODIF ID b OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.

*AT SELECTION-SCREEN ON VALUE-REQUEST FOR


AT SELECTION-SCREEN OUTPUT.

IF r1 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'A'.
screen-active = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

LOOP AT SCREEN.
IF screen-group1 = 'B'.
screen-active = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.


IF r2 = 'X'.
LOOP AT SCREEN.
if screen-group1 = 'B'.
screen-active = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

LOOP AT SCREEN.
IF screen-group1 = 'A'.
screen-input = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

ENDIF.

START-OF-SELECTION.
Sandra_Rossi
Active Contributor
0 Kudos

For better legibility, I think you'd better do a single LOOP AT SCREEN.

Just replace screen-input = '0'. with screen-active = '0'. ?

Sandra_Rossi
Active Contributor
0 Kudos

Okay, I just read the existing answers, it seems that you didn't see the error message "Fill out all required entry fields" each time you press a radio button, it's due to the "OBLIGATORY" word that you used.

Solution: remove OBLIGATORY and it will work better, still you'll need to replace screen-input = '0'. with screen-active = '0'. Also add a check in ABAP (IF + MESSAGE with type error, in the AT SELECTION-SCREEN block) to make sure that the fields are filled.

View Entire Topic
Jeansy
Active Contributor
0 Kudos

Hi,

following adapted code works in my case:

  IF r1 = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'A'.
        screen-active = '1'.
        screen-invisible = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.

    LOOP AT SCREEN.
      IF screen-group1 = 'B'.
        screen-active = '0'.
        screen-invisible = '1'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
ENDIF.


 IF r2 = 'X'.
    LOOP AT SCREEN.
      if screen-group1 = 'B'.
        screen-active = '1'.
        screen-invisible = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.

    LOOP AT SCREEN.
      IF screen-group1 = 'A'.
        screen-input = '0'.
        screen-invisible = '1'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.

  ENDIF.

I just added the invisible-flag additionally. But from my point of view you have to disable the obligatory-flag for the fields in the blocks as otherwise SAP does not allow to change the screen when using a radio-button without entering some data in the obligatory fields. I would suggest to check in START-OF-SELECTION if the user has entered some data in the selection parameter and if not raise an error, so you can avoid the obligatory-flag.

I hope this helps you 🙂

Kind regards
Jens

thank you jzaehringer it worked......