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: 

Modify screen on screen painter not work automatically after click radio button

former_member635273
Participant
0 Kudos

I have 3 rad.buttons like below and some input field exactly. I want to hide/ show the input field base on checked radio button. the porblem is, it's not hide/show automatically after i checked the other radio button. I hve to click enter, it's like not refresh without press enter.

MODULE modify_screen OUTPUT.
  IF b_pl = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 CS 'P1'.
        screen-active = 1.
      ENDIF.
      IF screen-group1 CS 'P2' OR screen-group1 CS 'P3' .
        screen-active = 0.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

  IF b_pb = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 CS 'P2'.
        screen-active = 1.
      ENDIF.
      IF screen-group1 CS 'P1' OR screen-group1 CS 'P3'.
        screen-active = 0.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

  IF b_bn = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 CS 'P3'.
        screen-active = 1.
      ENDIF.
      IF screen-group1 CS 'P1' OR screen-group1 CS 'P2' .
        screen-active = 0.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.
ENDMODULE.
1 ACCEPTED SOLUTION

mateuszadamus
Active Contributor

Hello saddam.id

You probably need to add a function command to the radio buttons so that they raise the PAI event.

Kind regards,
Mateusz
7 REPLIES 7

mateuszadamus
Active Contributor

Hello saddam.id

You probably need to add a function command to the radio buttons so that they raise the PAI event.

Kind regards,
Mateusz

0 Kudos

i hv added fncCode , it's work only when i checked other rad button.but it's not work for the first time i run my program.

0 Kudos

Please show when is your MODIFY_SCREEN module executed.

Also, you could change all the IFs into one CASE statement, since there will be only one radio button selected at a time.

MODULE modify_screen OUTPUT.
  CASE 'X'.
    WHEN b_pl.
      LOOP AT SCREEN.
        IF screen-group1 CS 'P1'.
          screen-active = 1.
        ENDIF.
        IF screen-group1 CS 'P2' OR screen-group1 CS 'P3' .
          screen-active = 0.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    WHEN b_pb.
      LOOP AT SCREEN.
        IF screen-group1 CS 'P2'.
          screen-active = 1.
        ENDIF.
        IF screen-group1 CS 'P1' OR screen-group1 CS 'P3'.
          screen-active = 0.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    WHEN b_bn.
      LOOP AT SCREEN.
        IF screen-group1 CS 'P3'.
          screen-active = 1.
        ENDIF.
        IF screen-group1 CS 'P1' OR screen-group1 CS 'P2' .
          screen-active = 0.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
  ENDCASE.
ENDMODULE.

Kind regards,
Mateusz

0 Kudos
saddam husen As you have probably seen in debug of MODIFY_SCREEN module, the variables of the radio buttons (B_PL, etc.) are all blank, that's the reason why "it's not work".

So, before you display the dynpro with "CALL SCREEN", do:

b_pl = 'X'.

Simple as that.

0 Kudos

Thanks, it's work. And I add condition, to make sure that only 1 button checked.

IF b_pl = '' and b_pb = '' and b_bn = ''.
b_pl = 'X'.
ENDIF.

Thnks a lot. This case was solved. After i add fncCode, I need add some condition like sandra said.

matt
Active Contributor
0 Kudos

Refference is incorrect. It should be one f. Reference.