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

Selection Screen based on condition

Former Member
0 Likes
5,078

Is it possible to design selection screen based on condition. I mean , is it possible to display different selection screen based on a particlar cond ? I tried with the code below and it did not work :

IF TCODE = 'ZSCPPAC1'.

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

PARAMETERS:p_var TYPE zde_variant,

p_desc TYPE zde_rdesc.

SELECTION-SCREEN:END OF BLOCK b1.

ELSE.

SELECTION-SCREEN:BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS:p_var1 TYPE zde_variant.

SELECTION-SCREEN:END OF BLOCK b2.

ENDIF.

Please suggest

7 REPLIES 7
Read only

Former Member
0 Likes
2,289

Hi,

Design the selection screen with all the fields.

However in the AT SELECTION-SCREEN event ENABLE or DISABLE the required fields using LOOP at SCREEN.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
2,289

Hi,

Use Modif ID for all screen fields to make the process Easier.

Regards

Karthik D

Read only

Former Member
0 Likes
2,289

Hi,

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

PARAMETERS:p_var TYPE zde_variant MODIF ID abc,

p_desc TYPE zde_rdesc MODIF ID abc.

SELECTION-SCREEN:END OF BLOCK b1.

SELECTION-SCREEN:BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS:p_var1 TYPE zde_variant MODIF ID bcd.

SELECTION-SCREEN:END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

IF sy-tcode = 'ZSCPPAC1'.

LOOP AT SCREEN.

IF screen-group1 = 'ABC'.

screen-active = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Regards,

Kumar Bandanadham

Read only

Former Member
0 Likes
2,289

yes based on condition we can able to DISABLE or ENABLE our selection screen

define all selection fileds first with MODIF ID.

In AT-SELECTION SCREEN EVENT You can use LOOP AT SCREEN to Modify our screen.

Go through ABAP Documentation then you will come to know.....

Read only

Former Member
0 Likes
2,289

Hi,

You can modify the code as below,

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

PARAMETERS:p_var TYPE zde_variant modif id nnn,

p_desc TYPE zde_rdesc modif id nnn.

SELECTION-SCREEN:END OF BLOCK b1.

SELECTION-SCREEN:BEGIN OF BLOCK b2 WITH FRAME TITLE text-002 modif id mmm.

PARAMETERS:p_var1 TYPE zde_variant modif id mmm.

SELECTION-SCREEN:END OF BLOCK b2.

ENDIF.

Now at AT SELECTION SCREEN OUTPUT

IF TCODE = 'ZSCPPAC1'.

loop at SCREEN.

if screen-group1 = 'mmm'.

screen-active = '0'.

modify screen.

endif.

endloop.

else.

loop at SCREEN.

if screen-group1 = 'nnn'.

screen-active = '0'.

modify screen.

endif.

endloop.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
2,289

Hi,

Refer code, its working:-


SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_var  TYPE zde_variant MODIF ID abc,
             p_desc TYPE zde_rdesc   MODIF ID abc.
SELECTION-SCREEN:END OF BLOCK b1.

SELECTION-SCREEN:BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS:p_var1 TYPE zde_variant MODIF ID def.
SELECTION-SCREEN:END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF sy-tcode = 'ZSCPPAC1'.
      IF screen-group1 = 'ABC'.
        screen-active = 1.
        screen-invisible = 0.
      ENDIF.
      IF screen-group1 = 'DEF'.
        screen-active = 0.
        screen-invisible = 1.
      ENDIF.

    ELSE.
      IF screen-group1 = 'ABC'.
        screen-active = 0.
        screen-invisible = 1.
      ENDIF.
      IF screen-group1 = 'DEF'.
        screen-active = 1.
        screen-invisible = 0.
      ENDIF.
    ENDIF.

    MODIFY SCREEN.
  ENDLOOP.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
2,289

Hi,

Check this link for further link.

[http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/dba70535c111d1829f0000e829fbfe/content.htm]

Please let me know if you still need any more help.

Thanks and regards,

Rajeshwar.