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: 

Hide / Show a block in Selection screen

Former Member
0 Kudos

Hi,

How to hide or show a block in selection screen.

Plz help.

Regards,

Sriram

1 ACCEPTED SOLUTION

former_member583013
Active Contributor

Kindly steal from Rich Heilman -:)


type-pools: icon.

data: switch.

selection-screen begin of block b2 with frame title text-001.
parameters: radio radiobutton group rnd user-command test default 'X',
            radio2 radiobutton group rnd.
selection-screen end of block b2.

selection-screen begin of block b1 with frame title text-001.
parameters:
           test type bkpf-belnr modif id sc1.
selection-screen end of block b1.

selection-screen begin of block b3 with frame title text-001.
parameters:
           test1 type bkpf-belnr modif id sc2.
selection-screen end of block b3.

AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
  IF SCREEN-GROUP1 = 'SC1' AND RADIO EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ELSEIF SCREEN-GROUP1 = 'SC2' AND RADIO2 EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ENDIF.
ENDLOOP.

start-of-selection.

Greetings,

Blag.

3 REPLIES 3

former_member583013
Active Contributor

Kindly steal from Rich Heilman -:)


type-pools: icon.

data: switch.

selection-screen begin of block b2 with frame title text-001.
parameters: radio radiobutton group rnd user-command test default 'X',
            radio2 radiobutton group rnd.
selection-screen end of block b2.

selection-screen begin of block b1 with frame title text-001.
parameters:
           test type bkpf-belnr modif id sc1.
selection-screen end of block b1.

selection-screen begin of block b3 with frame title text-001.
parameters:
           test1 type bkpf-belnr modif id sc2.
selection-screen end of block b3.

AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
  IF SCREEN-GROUP1 = 'SC1' AND RADIO EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ELSEIF SCREEN-GROUP1 = 'SC2' AND RADIO2 EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ENDIF.
ENDLOOP.

start-of-selection.

Greetings,

Blag.

Former Member
0 Kudos

REPORT ZTESTETSET.

02.

03."First we create the selection screen which contains 2 option

04."buttons For show and hide.

05.

06. SELECTION-SCREEN BEGIN of BLOCK screen1 WITH FRAME TITLE title1.

07. PARAMETERS: Show RADIOBUTTON GROUP opt USER-COMMAND aaa DEFAULT 'X',

08. Hide RADIOBUTTON GROUP opt .

09. SELECTION-SCREEN END OF BLOCK screen1.

10.

11. "This is the selection screen that we will hide and show

12. "based on the selected option button above

13.

14. SELECTION-SCREEN BEGIN of BLOCK screen2 WITH FRAME TITLE title2.

15. PARAMETER CONNID like spfli-connid.

16. SELECTION-SCREEN END OF BLOCK screen2.

17.

18."We capture the selected option event using

19."AT SELECTION-SCREEN OUTPUT to modify the screen

20.

21. AT SELECTION-SCREEN OUTPUT.

22. PERFORM modify_screen.

23.

24. START-OF-SELECTION.

25.

26."This is the sub program that will loop all the elements on

27."the selection screen to identify which element we want to

28."hide or show based on screen name.

29.

30. FORM modify_screen .

31. LOOP AT SCREEN.

32. IF Show NE 'X'.

33. IF screen-name CS 'CONNID'.

34. screen-active = 0.

35. MODIFY SCREEN.

36. ENDIF.

37. ENDIF.

38. ENDLOOP.

39.ENDFORM.

40.

41."Give the selection block a title.

42.INITIALIZATION.

43.

44.title1 = 'Show/Hide Option'.

45.title2 = 'Selection Screen'.

Thanks

anurag Srivastava

0 Kudos

IF screen-name CS 'field name'.

screen-active = 0.

screen-invisible  = '0'.

MODIFY SCREEN.

ENDIF.

This works great. Removes the block also if no fields in the block are visible.