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

Hiding/showing selection screen fields

Former Member
0 Likes
627

Good day experts!

I wrote the following code and what I wish to do is the following:

If im is checked, only p_imalv listbox should appear

If wm is checked, only p_wmalv listbox should appear.

If both checkbox is checked, both p_imalv and p_wmalv should appear.

If both checkbox is unchecked, both p_imalv and p_wmalv should not appear.

I wrote the following code and it's not working. Also only the box disappears and not the text label.

I would appreciate your help and I will award points. Thank you!

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

PARAMETERS: im AS CHECKBOX USER-COMMAND ucomm.

PARAMETERS: p_imalv AS LISTBOX VISIBLE LENGTH 15 LIKE ltdxt-variant.

PARAMETERS: wm AS CHECKBOX.

PARAMETERS: p_wmalv AS LISTBOX VISIBLE LENGTH 15 LIKE ltdxt-variant.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

   IF im = 'X' and wm ne 'X'.

     LOOP AT SCREEN.

       IF screen-name = 'P_IMALV'.

         screen-active = '1'.

       ENDIF.

       IF screen-name = 'P_WMALV'.

         screen-active = '0'.

       ENDIF.

       MODIFY SCREEN.

     ENDLOOP.

   ELSEIF im = 'X' and wm = 'X'.

     LOOP AT SCREEN.

       IF screen-name = 'P_IMALV'.

         screen-active = '1'.

       ENDIF.

       IF screen-name = 'P_WMALV'.

         screen-active = '1'.

       ENDIF.

       MODIFY SCREEN.

     ENDLOOP.

    endif.

    IF im ne 'X' and wm ne 'X'.

     LOOP AT SCREEN.

       IF screen-name = 'P_IMALV'.

         screen-active = '0'.

       ENDIF.

       IF screen-name = 'P_WMALV'.

         screen-active = '0'.

       ENDIF.

       MODIFY SCREEN.

     ENDLOOP.

    ELSEIF im ne 'X' and wm = 'X'.

     LOOP AT SCREEN.

       IF screen-name = 'P_IMALV'.

         screen-active = '0'.

       ENDIF.

       IF screen-name = 'P_WMALV'.

         screen-active = '1'.

       ENDIF.

       MODIFY SCREEN.

     ENDLOOP.

   ENDIF.

Regards,

Dm

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
594

HI,

Try this.

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

PARAMETERS: im AS CHECKBOX USER-COMMAND ucomm.

PARAMETERS: p_imalv AS LISTBOX VISIBLE LENGTH 15 LIKE ltdxt-variant MODIF ID p1.

PARAMETERS: wm AS CHECKBOX USER-COMMAND ucomm.

PARAMETERS: p_wmalv AS LISTBOX VISIBLE LENGTH 15 LIKE ltdxt-variant MODIF ID p2.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

  IF im = 'X' AND wm NE 'X'.

    LOOP AT SCREEN.

      IF screen-group1 EQ 'P1'.

        screen-active = '1'.

      ELSEIF screen-group1 EQ 'P2'.

        screen-active = '0'.

      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.

   ELSEIF wm = 'X' AND im NE 'X'.

    LOOP AT SCREEN.

      IF screen-group1 EQ 'P2'.

        screen-active = '1'.

      ELSEIF screen-group1 EQ 'P1'.

        screen-active = '0'.

      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.

  ELSEIF im = 'X' AND wm = 'X'.

    LOOP AT SCREEN.

      IF screen-group1 EQ 'P1' OR

         screen-group1 EQ 'P2'.

       screen-active = '1'.

      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.

  ELSEIF im NE 'X' AND wm NE 'X'.

    LOOP AT SCREEN.

      IF screen-group1 EQ 'P1' OR

         screen-group1 EQ 'P2'.

       screen-active = '0'.

      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.

  ENDIF.

3 REPLIES 3
Read only

Former Member
0 Likes
595

HI,

Try this.

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

PARAMETERS: im AS CHECKBOX USER-COMMAND ucomm.

PARAMETERS: p_imalv AS LISTBOX VISIBLE LENGTH 15 LIKE ltdxt-variant MODIF ID p1.

PARAMETERS: wm AS CHECKBOX USER-COMMAND ucomm.

PARAMETERS: p_wmalv AS LISTBOX VISIBLE LENGTH 15 LIKE ltdxt-variant MODIF ID p2.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

  IF im = 'X' AND wm NE 'X'.

    LOOP AT SCREEN.

      IF screen-group1 EQ 'P1'.

        screen-active = '1'.

      ELSEIF screen-group1 EQ 'P2'.

        screen-active = '0'.

      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.

   ELSEIF wm = 'X' AND im NE 'X'.

    LOOP AT SCREEN.

      IF screen-group1 EQ 'P2'.

        screen-active = '1'.

      ELSEIF screen-group1 EQ 'P1'.

        screen-active = '0'.

      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.

  ELSEIF im = 'X' AND wm = 'X'.

    LOOP AT SCREEN.

      IF screen-group1 EQ 'P1' OR

         screen-group1 EQ 'P2'.

       screen-active = '1'.

      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.

  ELSEIF im NE 'X' AND wm NE 'X'.

    LOOP AT SCREEN.

      IF screen-group1 EQ 'P1' OR

         screen-group1 EQ 'P2'.

       screen-active = '0'.

      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.

  ENDIF.

Read only

0 Likes
594

Read this blog. Close the thread if it answers all your questions. Thank you.

Read only

0 Likes
594

Thank you so much. It works perfectly!