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: 

Hiding and then making select-options visible on the selection-screen

Former Member
0 Kudos

I've created a selection screen. On this i've got a field (pr_inpt) depending on whose value i have to display the rest select-options viz. (so_c1, so_n1, so_d1, so_t1) say ,

1.)if (pr_inpt) contains value 'A' then display (so_c1 & so_d1)

2.)if (pr_inpt) contains value 'B' then display (so_n1, so_d1 & so_t1)

To achieve it, in the initialization event, i looped at the screen and for all (so_c1, so_n1, so_d1, so_t1) i made screen-active = '0'. Due to this my objective to hide fields in the beginning is achieved.

Next when user is entering value into (pr_inpt), i am making screen-active = '1' at selection-screen output event, for those relevant select-options (say if A, then made active for so_c1 & so_d1) but my problem is that it is making all select-options (so_c1, so_n1, so_d1, so_t1) visible on the screen which i don't want.

How can i achieve this, also is it possible to change the label of the select-options while displaying.

Plz help.

1 ACCEPTED SOLUTION

former_member194152
Contributor
0 Kudos

hi just copy and paste following code into ur abap editor and see weather this logic helps u ????

REPORT Z_HRA1.

tables: pa0000, pa0001.

parameters: p_chk1 as checkbox user-command rusr,
p_chk2 as checkbox user-command rusr,
p_chk3 as checkbox user-command rusr,
p_chk4 as checkbox user-command rusr,
p_chk5 as checkbox user-command rusr.

selection-screen: begin of block blk1 with frame.
select-options: s_pernr for pa0000-pernr modif id ABC no-extension no intervals,
s_stat2 for pa0000-stat2 modif id DEF,
s_werks for pa0001-werks modif id GHI,
s_persg for pa0001-persg modif id JKL,
s_persk for pa0001-persk modif id MNO.
selection-screen: end of block blk1.

AT SELECTION-SCREEN output.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'ABC'.
IF p_chk1 = 'X'.
SCREEN-ACTIVE = 1.
ELSE.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.

IF SCREEN-GROUP1 = 'DEF'.
IF p_chk2 = 'X'.
SCREEN-ACTIVE = 1.
ELSE.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.

IF SCREEN-GROUP1 = 'GHI'.
IF p_chk3 = 'X'.
SCREEN-ACTIVE = 1.
ELSE.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.

IF SCREEN-GROUP1 = 'JKL'.
IF p_chk4 = 'X'.
SCREEN-ACTIVE = 1.
ELSE.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.

IF SCREEN-GROUP1 = 'MNO'.
IF p_chk5 = 'X'.
SCREEN-ACTIVE = 1.
ELSE.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.

ENDLOOP.

Regards

Gagan

5 REPLIES 5

Former Member
0 Kudos

Hi Annie,

Follow the below syntax.This will helpful to u check it once.

parameteres: pr_inpt.

select-options:so_c1,

so_n1,

so_d1,

so_t1 .

If pr_inpt = 'A'.

loop at screen.

if screen-name = 'so_c1' .

screen-input = 1.

endif.

if screen-name = 'so_d1'.

screen-input = 1.

endif.

modify screen.

endloop.

endif.

If pr_inpt = 'B'.

loop at screen.

if screen-name = 'so_n1' .

screen-input = 1.

endif.

if screen-name = 'so_d1'.

screen-input = 1.

endif.

if screen-name = 'so_t1'.

screen-input = 1.

endif.

modify screen.

endloop.

endif.

Award points if helpful.

Kiran Kumar.G.A

former_member194152
Contributor
0 Kudos

hi just copy and paste following code into ur abap editor and see weather this logic helps u ????

REPORT Z_HRA1.

tables: pa0000, pa0001.

parameters: p_chk1 as checkbox user-command rusr,
p_chk2 as checkbox user-command rusr,
p_chk3 as checkbox user-command rusr,
p_chk4 as checkbox user-command rusr,
p_chk5 as checkbox user-command rusr.

selection-screen: begin of block blk1 with frame.
select-options: s_pernr for pa0000-pernr modif id ABC no-extension no intervals,
s_stat2 for pa0000-stat2 modif id DEF,
s_werks for pa0001-werks modif id GHI,
s_persg for pa0001-persg modif id JKL,
s_persk for pa0001-persk modif id MNO.
selection-screen: end of block blk1.

AT SELECTION-SCREEN output.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'ABC'.
IF p_chk1 = 'X'.
SCREEN-ACTIVE = 1.
ELSE.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.

IF SCREEN-GROUP1 = 'DEF'.
IF p_chk2 = 'X'.
SCREEN-ACTIVE = 1.
ELSE.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.

IF SCREEN-GROUP1 = 'GHI'.
IF p_chk3 = 'X'.
SCREEN-ACTIVE = 1.
ELSE.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.

IF SCREEN-GROUP1 = 'JKL'.
IF p_chk4 = 'X'.
SCREEN-ACTIVE = 1.
ELSE.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.

IF SCREEN-GROUP1 = 'MNO'.
IF p_chk5 = 'X'.
SCREEN-ACTIVE = 1.
ELSE.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.

ENDLOOP.

Regards

Gagan

Former Member
0 Kudos

Hi Annie,

Check if you haven't missed modify screen at any point...

There are many different elements for select-options, hence it's better you assign modif-id to each select options (say M1, M2, M3 and M4) and check screen-group1 = M1 (M2, or M3 or M4)...

Also put screen-active = '1'

screen-invisibile = '0'

modify screen

for those you want to make visible.

Exclusively you have to mention screen-active = '0'

screen-invisible = '1'

modify screen for those which you do not want to display.

I think you are missing second step

Former Member
0 Kudos

Hi Annie ,

You should loop on SCREEN in the code for the event

AT SELECTION SCREEN OUTPUT.

and for the select options and text you want to make invisible set them as invisible and modify the table screen.

Regards

Arun

Former Member
0 Kudos

Hi Annie,

Follow the below syntax.This will helpful to u check it once.

parameteres: pr_inpt.

select-options:so_c1,

so_n1,

so_d1,

so_t1 .

If pr_inpt = 'A'.

loop at screen.

if screen-name = 'so_c1' .

screen-input = 1.

endif.

if screen-name = 'so_d1'.

screen-input = 1.

endif.

modify screen.

endloop.

endif.

If pr_inpt = 'B'.

loop at screen.

if screen-name = 'so_n1' .

screen-input = 1.

endif.

if screen-name = 'so_d1'.

screen-input = 1.

endif.

if screen-name = 'so_t1'.

screen-input = 1.

endif.

modify screen.

endloop.

endif.

Award points if helpful.