We can help. Together we learn....

Dynamic selection screen

by Voice | Thursday, November 06, 2008 in |

Selection screen is the first thing which user can see when he/she executes a program or transaction. For basic need, we can create a selection screen only by using ABAP commands and we do not have to go for a module pool programming.

 

There are some extensions which can be used with select option to meet the requirement.

Please check F1 for the extensions and their effects.

Some it is required to populate a default value in the selection screen. There is an ABAP command which can be used for this.

Eg. SELECT-OPTIONS: matn FOR mara-matnr DEFAULT 'AA'.

 

# Sometime the default value needs to be calculated at run-time. Use Initialization Event or At Selection-screen output Event.

 

Dynamic Selection Screen: You can active a field or can disable input to a certain field depending on some criteria at your will. The following code may help you to make a dynamic screen. There are several other option in SCREEN structure. Explore and you can impress some user by producing a flashy selection screen. Remember selection screen is the first impression of your program.

 

TABLES: mara.

*----------------------------------------------------------------------*
* S E L E C T I O N S C R E E N *
*----------------------------------------------------------------------
SELECTION-
SCREENBEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS : mat RADIOBUTTON GROUP opt1 DEFAULT 'X' USER-COMMAND aa.
PARAMETERS : mtype RADIOBUTTON GROUP opt1.
SELECTION-
SCREENEND OF BLOCK b1.
SELECTION-
SCREENBEGIN OF BLOCK b2.
SELECT-OPTIONS: matn FOR mara-matnr DEFAULT 'AA'
                MODIF 
ID a.
SELECT-OPTIONS: mtypen FOR mara-mtart MODIF ID b.
SELECTION-
SCREENEND OF BLOCK b2.
*----------------------------------------------------------------------*
* AT S E L E C T I O N S C R E E N O U T P U T *
*----------------------------------------------------------------------
AT SELECTION-SCREEN OUTPUT.
  
LOOP AT SCREEN.
    
IF mat = 'X'.
      
IF screen-group1 = 'B'.
        
screen-input = 0.
      
ENDIF.
    
ELSE.
      
IF screen-group1 = 'A'.
        
screen-active = 0.
      
ENDIF.
    
ENDIF.
    
MODIFY SCREEN.
  
ENDLOOP.

0 comments:

Categories