Wednesday, July 25, 2007

Hide parameter / select option in selection screen

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.


11 comments:

Aravindh said...

This bit really helped me... thanks a lot dude... u r a star. :)

Unknown said...

Thanks a lot, helped me, too!

Proust from Munich

Anonymous said...

very clear and very good. Now where did I put the 12 sap help screens that didn't have this answer? Thanks dude.

Anonymous said...

Help a lot!!! Thanks


Obrigado!!!! from Brasil

Sushant said...

That really helped me .3 cheers

Erratic Thoughts said...

Thanks for this...
Quick, simple and point blank...

Abap Community Forums said...

Check out the select statement in ABAP here
Abap Community Forums

alex said...

Modify screen,dynamic screen in module programming http://saptechnicals.blogspot.com/2013/04/modify-screen-in-module-programming.html

yektek training said...

Thanks dear for sharing this nice information sravani

admin said...

Thanks for the wonderful post.

-www.abapmadeeasy.com

Business World said...

Thanks for sharing valuable information through your post. The information provided is of great use.
SAP ABAP TRAINING IN HYDERABAD