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

Dynamically hide a block in selection screen

Bhaskar_Tripath
Participant
0 Likes
4,503

Hi All,

Can we hide a whole block in a selection screen dynamically.

If so, then how?

Regards,

Bhaskar Tripathi

1 ACCEPTED SOLUTION
Read only

former_member386202
Active Contributor
0 Likes
2,233

Hi,

Refer this code

&----


*& Form sub_select_report

&----


  • text

----


FORM sub_select_report .

IF ( p_post EQ c_chk ).

LOOP AT SCREEN.

IF ( screen-group1 EQ 'MD1' ) OR

( screen-group1 EQ 'MD2' ) OR

( screen-group1 EQ 'MD3' ) OR

( screen-group1 EQ 'MD4' ).

screen-input = c_ok.

screen-active = c_ok.

ENDIF.

IF ( screen-group1 EQ 'MD5' ) OR

( screen-group1 EQ 'MD6' ).

screen-input = c_1.

screen-active = c_1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF p_rpt EQ c_chk.

LOOP AT SCREEN.

IF ( screen-group1 EQ 'MD5' ) OR

( screen-group1 EQ 'MD6' ).

screen-input = c_ok.

screen-active = c_ok.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

ENDFORM. " sub_select_report

Regards,

Prashant

5 REPLIES 5
Read only

former_member386202
Active Contributor
0 Likes
2,234

Hi,

Refer this code

&----


*& Form sub_select_report

&----


  • text

----


FORM sub_select_report .

IF ( p_post EQ c_chk ).

LOOP AT SCREEN.

IF ( screen-group1 EQ 'MD1' ) OR

( screen-group1 EQ 'MD2' ) OR

( screen-group1 EQ 'MD3' ) OR

( screen-group1 EQ 'MD4' ).

screen-input = c_ok.

screen-active = c_ok.

ENDIF.

IF ( screen-group1 EQ 'MD5' ) OR

( screen-group1 EQ 'MD6' ).

screen-input = c_1.

screen-active = c_1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF p_rpt EQ c_chk.

LOOP AT SCREEN.

IF ( screen-group1 EQ 'MD5' ) OR

( screen-group1 EQ 'MD6' ).

screen-input = c_ok.

screen-active = c_ok.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

ENDFORM. " sub_select_report

Regards,

Prashant

Read only

Former Member
0 Likes
2,233

Hi,

Make sure you hide your comment lines with the MODIF ID as well.

code

selection-screen begin of block processing with frame title text-030.

selection-screen begin of line.

selection-screen position 1.

parameters pa_xmanu like rm08mrbr-manu default 'X'

radiobutton group val modif id id1.

selection-screen comment 3(30) text-040 for field pa_xmanu modif id id1. "<--- Here

selection-screen position 40.

parameters pa_xauto like rm08mrbr-auto

radiobutton group val modif id id1.

selection-screen comment 43(30) text-050

for field pa_xauto modif id id1. "<--- Here

selection-screen end of line.

selection-screen begin of line.

parameters: pa_xskto like rm08mrbr-skto as checkbox modif id id1.

selection-screen comment 3(30) text-055

for field pa_xskto modif id id1. "<--- Here

selection-screen end of line.

selection-screen end of block processing.

at selection-screen output.

loop at screen.

if screen-group1 = 'ID1'.

screen-active = 0.

modify screen.

endif.

endloop.

[/code]

OR

You can hide the block using:

In Initialization event.

Loop at screen.

if screen-name = <f1> and screen-name = <f2>.

screen-input = 0.

modify screen.

endif.

endloop.

Regards,

Raj.

Read only

Former Member
2,233

Hi,

We can hide the block in the selection screen depends upon the user selection using the LOOP AT SCREEN.

Check the below sample code:

selection-screen : begin of block b1 with frame no intervals.
parameter : p_plant radiobutton group g1 user-command radio default 'X',
                  p_mrp   radiobutton group g1.
selection-screen end of block b1.

selection-screen begin of block b2 with frame no intervals.
parameter : p_werks type marc-werks modif id sp1.
selection-screen end of block b2.

selection-screen begin of block b3 with frame no intervals.
parameter : p_berid type smdma-berid modif id sp2.
selection-screen end of block b3.

at selection-screen output.

  loop at screen.

    check screen-group1 = 'SP1' or
          screen-group1 = 'SP2'.

    if p_plant = 'X'.
      if screen-group1 = 'SP2'.
        screen-input = 0.
        screen-active = 0.
        screen-required = 1.
        modify screen.
      endif.
    else.
      if screen-group1 = 'SP1'.
        screen-input = 0.
        screen-active = 0.
        screen-required = 1.
        modify screen.
      endif.
    endif.

  endloop.

Regards,

Raghu

Read only

Former Member
0 Likes
2,233

Lets take an example here,if u click a check box 'Check' then it should hide a block with a parameter S_Werks and select options S_Lgort should get hidden.For that u need to write this code.

select-options: s_matnr for mard-matnr modif id xyz.

parameters : s_werks like mard-werks modif id abc.

select-options: s_lgort for mard-lgort modif id abc.

parameters check as checkbox user-command check.

at selection-screen output.
if check eq 'X'.
loop at screen.
if screen-group1 = 'ABC'.
screen-input = 0.
screen-invisible = 1.
modify screen.
endif.
endloop.
endif.

Replace all elements of the block u want to hide with Modif ID ABC in the above code.

Reward If found helpful.

Read only

Former Member
0 Likes
2,233

Hi,

Loop at screen.

If screen-group3 = 'BLK'.

screen-active = 0.

modify screen.

endif.

endloop.

Thank you.

Reward points if found useful.