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

Problem with Dynamic Selection Screen

Former Member
0 Likes
749

Hi ppl,

I have this part of code in my program. But it is not working as desired. Please could somebody let me know what is wrong with it.


TYPES: BEGIN OF tp_selscr,
         klart TYPE klah-klart,
         class TYPE klah-class,
       END OF tp_selscr.

DATA: wa_selscr TYPE tp_selscr.

SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK cls WITH FRAME TITLE text-s01.
PARAMETERS:     p_cls AS CHECKBOX USER-COMMAND chk.
SELECT-OPTIONS: s_klart FOR wa_selscr-klart MODIF ID cls,    "Class type
      	         s_class FOR wa_selscr-class MODIF ID cls
                        MATCHCODE OBJECT clas.
SELECTION-SCREEN END OF BLOCK cls.


AT SELECTION-SCREEN.
*AT SELECTION-SCREEN ON p_cls.

  PERFORM dynamic_sel.  "Selection based on class


*&---------------------------------------------------------------------*
*&      Form  dynamic_sel
*&---------------------------------------------------------------------*
*       Selection based on class option
*----------------------------------------------------------------------*
FORM dynamic_sel.

  IF p_cls EQ 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'CLS'.
        screen-active = 1.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'CLS'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

ENDFORM.                    " dynamic_sel

Regards.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
612

You should use 'AT SELECTION-SCREEN OUTPUT' instead of 'AT SELECTION-SCREEN'

3 REPLIES 3
Read only

Former Member
0 Likes
613

You should use 'AT SELECTION-SCREEN OUTPUT' instead of 'AT SELECTION-SCREEN'

Read only

Former Member
0 Likes
612

Hi,

Just to add, I want the 2 fields S_KLART and S_CLASS to appear only if the checkbox is marked.

Read only

Former Member
0 Likes
612

The event is wrong. It should be AT SELECTON SCREEN OUTPUT


TYPES: BEGIN OF tp_selscr,
         klart TYPE klah-klart,
         class TYPE klah-class,
       END OF tp_selscr.

DATA: wa_selscr TYPE tp_selscr.

SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK cls WITH FRAME TITLE text-s01.
PARAMETERS:     p_cls AS CHECKBOX USER-COMMAND chk.
SELECT-OPTIONS: s_klart FOR wa_selscr-klart MODIF ID cls,    "Class type
                 s_class FOR wa_selscr-class MODIF ID cls
                        MATCHCODE OBJECT clas.
SELECTION-SCREEN END OF BLOCK cls.


AT SELECTION-SCREEN OUTPUT.       """ Instead of AT SELECTION SCREEN
*AT SELECTION-SCREEN ON p_cls.

  PERFORM dynamic_sel.  "Selection based on class


*&---------------------------------------------------------------------*
*&      Form  dynamic_sel
*&---------------------------------------------------------------------*
*       Selection based on class option
*----------------------------------------------------------------------*
FORM dynamic_sel.

  IF p_cls EQ 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'CLS'.
        screen-active = 1.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'CLS'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

ENDFORM.

Vikranth