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: 

Dynamic Programm

suem
Discoverer
0 Kudos

hi im trying to write a code with radio buttons.

Problem is that: there are 3 Radio buttons and if i pick one it has to add someone new to my table, other one has to show some one and the last one has to delete it. I wrote a Programm but all of parameters are on the screen and they dont disappear when i chose the other Radiobuttons. Could you help me?

7 REPLIES 7

Sandra_Rossi
Active Contributor

So, your question is how to change the layout of the screen if one radio button is pressed?

In the forum, search PARAMETERS ... USER-COMMAND ...

suem
Discoverer
0 Kudos

no im trying to make my this code dynamic. But all the blocks are on the screen


PARAMETERS:
  p_anzeig RADIOBUTTON GROUP ub5 USER-COMMAND com1,
  p_anleg  RADIOBUTTON GROUP ub5,
  p_delete RADIOBUTTON GROUP ub5.


SELECTION-SCREEN  BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001 NO INTERVALS.
  PARAMETERS:
    p_persno TYPE persno,
    p_name   TYPE name_first     MODIF ID md1,
    p_namela TYPE name_last      MODIF ID md1,
    p_gender TYPE zde_sgender    MODIF ID md1,
    md2irth  TYPE zde_s_birth    MODIF ID md1,
    p_plz    TYPE zde_s_postcode MODIF ID md1,
    md3ity   TYPE zde_s_ort      MODIF ID md1.
SELECTION-SCREEN END OF BLOCK b1 .

SELECTION-SCREEN  BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-002 NO INTERVALS.
  PARAMETERS:
    p_persn TYPE persno,
    p_nam   TYPE name_first     MODIF ID md2,
    p_namel TYPE name_last      MODIF ID md2,
    p_gende TYPE zde_sgender    MODIF ID md2,
    md2irt  TYPE zde_s_birth    MODIF ID md2,
    p_pl    TYPE zde_s_postcode MODIF ID md2,
    md3it   TYPE zde_s_ort      MODIF ID md2.
SELECTION-SCREEN END OF BLOCK b2 .

SELECTION-SCREEN  BEGIN OF BLOCK b3 WITH FRAME TITLE TEXT-003 NO INTERVALS.
  PARAMETERS:
  p_per TYPE persno MODIF ID md3.
SELECTION-SCREEN END OF BLOCK b3 .

AT SELECTION-SCREEN OUTPUT.
  IF  p_anleg 'X'  .
    LOOP AT SCREEN.
      IF screen-group1 'MD1' .
        screen-active 0.
        screen-invisible 1.
       ELSE.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

  ELSEIF p_delete 'X'  .
    LOOP AT SCREEN.
      IF screen-group1 'MD1'.
        screen-active 0.
        screen-invisible 1.
       ELSE.
screen-active 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 'MD2' .
        screen-active 0.
      ELSE.

        screen-invisible 0.

        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

Sandra_Rossi
Active Contributor

Thanks. I think it's best to add the code in your question. (and also use the formatting option "..." then "</>").

Sandra_Rossi
Active Contributor

Simple problem that you don't do MODIFY SCREEN all the time. Just debug.

Use the prety print function on your code to easily find errors (screen values changed without MODIFY SCREEN and vice versa). You can also use CASE/WHEN instead of IF/ELSEIF to improve readability. Also debug for initialization (default radio button)

Hint: Keep only one, and only one, MODIFY SCREEN statement, just before the ENDLOOP. 😎

suem
Discoverer
0 Kudos

hi Sandra thanks for tipp. But what do you mean i dont do modify screen? in every if i have modify screen

Sandra_Rossi
Active Contributor

No. You did it in only one half of the IF.