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: 

Regarding hiding Selection screen block

Former Member
0 Kudos

hi all ,

i have 2 blocks in the selection screen. the First block has 4 radiobuttons and the second block has 4 parameters.

i need to hide the block 2 based on the radiobutton checked in the initail block.

if radiobutton 1 or 2 is selected then the block should not be visible and if the rdbtn 3 or 4 is selected the block should be visible

i have wriiten the code but it doesn't work at all. the block is hidden but when i select the radiobtn 3 or 4 it doesn't work

the code i hve wriiten is as follows

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

PARAMETERS: par1 RADIOBUTTON GROUP rg2 DEFAULT 'X' USER-COMMAND ucom1

PARAMETERS: par2 RADIOBUTTON GROUP rg2 .

PARAMETERS: par3 RADIOBUTTON GROUP rg2 .

PARAMETERS: par4 RADIOBUTTON GROUP rg2

SELECTION-SCREEN END OF BLOCK b1.

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

SELECTION-SCREEN BEGIN OF LINE.

PARAMETER p_pwwrk TYPE plaf-pwwrk MODIF ID FSC.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS p_wch TYPE cr_hname MODIF ID FSC.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECT-OPTIONS s_mdv01 FOR g_mdv01 MODIF ID FSC.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK a1.

I have declared this after Initialization.

AT SELECTION-SCREEN OUTPUT.

if par3 eq 'X' or par4 eq 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'FSC'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

endif.

can anybody please suggest.

Thanx

Srinivas

9 REPLIES 9

Former Member
0 Kudos

Hi

if par1 eq 'X' or par2 eq 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'FSC'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

endif.

Max

0 Kudos

hi Max,

Thanx for the response , my isue is the when i click on the radio button 3 or 4 the block is not visible

thanks

Srinivas

0 Kudos

Hi,

THat is beacuse your hiding it using screen-active = 0.

if you want to unhide then use SCREEN-ACTIVE = 1.

SCREEN-ACTIVE = 0 is for hiding

SCREEN-ACTIVE = 1 for unhiding.

Your code should be.

if par1 eq 'X' or par2 eq 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'FSC'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

elseif par3 = 'X' or par4 = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'FSC'.

screen-active = 1

MODIFY SCREEN.

ENDIF.

ENDLOOP.

endif.

Regards,

Sesh

0 Kudos

hi ,

well it 's not working .... i have done the way u have Suggested but it doesn't work

initially the block should be hidden coz the Radiobutton is by default checked.

but if i want to make a different selection say radiobutton 3 or 4 the block is still hidden ..

the At selection screen output i guess is an event that works ijn the PBO that is before the display of the of the Selection screen , as the first radio button is checked by default it works and it hiodes the block . now if i want to change the selection then i need to make it display

any suggestion.. please

thanks

srinivas

0 Kudos

hI

i can't understand, if you need to hide the block if radiobutton 3 or 4 are selected your code is right.

I tried to run it and it seem it works just like you need.

Max

0 Kudos

Hi,

Add the event block AT USER-COMMAND or AT SELECTIO-SCREEN so that PAI sort of this is done. So once these event blocks are executed PBO that is AT SELECTION-SCREEN OUTPUT will be executed.

check SY-UCOMM for your user command and set some flag and use the flag instead to hide and unhide. the code is fine. How it is getting called is wrong.

Regards,

Sesh

Former Member
0 Kudos

Hiding Input Fields Locate the document in its SAP Library structure

To suppress the display of the input field on the selection screen, you use the following syntax:

PARAMETERS p ...... NO-DISPLAY ......

Although parameter p is declared, it is not displayed on the selection screen.

If the parameter belongs to the standard selection screen, you can assign a value to it either by using the DEFAULT addition when you declare it, or during the INITIALIZATION event. If you call the executable program using the SUBMIT statement, the calling program can also pass the value.

When you use user-defined selection screens, you can assign a value to the parameter at any time before calling the selection screen.

If you want to display a parameter only in certain cases, for example, depending on the values entered by the user in other input fields of the selection screen, you cannot use the NO-DISPLAY addition. If you use NO-DISPLAY, the parameter actually is an element of the interface for program calls, but not an element of the selection screen. As a result, you cannot make it visible using the MODIFY SCREEN statement.

To hide a parameter that is an element of the selection screen, you must declare it without the NO-DISPLAY addition and suppress its display using the MODIFY SCREEN statement.

We can Hide parameter / select option in selection screen dynamically by manipulating screen object.

SCREEN is like an internal table with a header line. However, you do not have to declare it in your program. Go to debugging mode and then view structure of screen.

You can modify SCREEN in your ABAP program during the PBO event of a screen. Its contents override the static attributes of the screen fields for a single screen call. The only statements that you can use with SCREEN are:

LOOP AT SCREEN.

...

MODIFY SCREEN.

...

ENDLOOP.

We can hide parameter by set screen-active to 0.

Here is example of how to hide parameter in selection screen. Write it, and change click on radiobutton to hide parameter.

REPORT ZAALGAL0006.

DATA: d_ucomm LIKE sy-ucomm.

PARAMETERS: p_grpa1(10) MODIF ID A,

p_grpa2(5) MODIF ID A,

p_grpb1(2) MODIF ID B.

PARAMETERS: p_actA RADIOBUTTON GROUP rad1 USER-COMMAND ACT DEFAULT 'X',

p_actB RADIOBUTTON GROUP rad1.

AT SELECTION-SCREEN.

d_ucomm = sy-ucomm.

AT SELECTION-SCREEN OUTPUT.

LOOP AT screen.

IF p_actA = 'X'.

IF screen-group1 = 'B'.

screen-active = 0.

ENDIF.

ELSEIF p_actB = 'X'.

IF screen-group1 = 'A'.

screen-active = 0.

ENDIF.

ENDIF.

MODIFY screen.

ENDLOOP.

START-OF-SELECTION.

regards,

srinivas

<b>*reward for useful answers*</b>

Former Member
0 Kudos

hi,

CHECK THIS ONE.

PARAMETERS : Pre_lay RADIOBUTTON GROUP RG USER-COMMAND R DEFAULT 'X'.

PARAMETERS : Apln_lay RADIOBUTTON GROUP RG .

selection-screen begin of block b1 with frame.

parameters : Pre_layr(10) type c modif id abc.

selection-screen end of block b1.

selection-screen begin of block b2 with frame.

parameters : Appl_lay(40) type c modif id def.

selection-screen end of block b2.

at selection-screen output.

IF Pre_lay = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'DEF' .

screen-active = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

IF Apln_lay = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'ABC' .

screen-active = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

THANKS

mAHESH

Former Member
0 Kudos

Thanks all of you, I appreciate your help.

Actually the code was right , i was executing the code at the wrong place.

thanks once again