_______________________________________________________________________________________________________________________

Home :: Sample Code :: Tutorials :: Interview FAQs :: Material :: SAP Books :: About :: Contact :: Links :: Disclaimer
_______________________________________________________________________________________________________________________

Sep 6, 2007

Dynamic Selection Screen Fields (properties)

*&---------------------------------------------------------------------*
*& Report ZKAR_DYN_SELSCR.
*&---------------------------------------------------------------------*
*& This program demonstrates how easy it is to set selection screen
*& element properties dynamically
*&
*& The program uses 3 radio buttons to set the display and input
*& properties of selection screen fields dynamically
*&---------------------------------------------------------------------*
*& Written by: Karthik Potharaju
*& URL: http://allaboutsap.blogspot.com
*&---------------------------------------------------------------------*

REPORT ZKAR_DYN_SELSCR.
*----------------------------------------------------------------------*
* DATABASE TABLES
*----------------------------------------------------------------------*

tables : mara.
*----------------------------------------------------------------------*
* SELECTION SCREEN
*----------------------------------------------------------------------*

selection-screen begin of block b1 with frame.
*--- Radio buttons to set properties
PARAMETERS:
rad1 RADIOBUTTON GROUP rad default 'X' USER-COMMAND radio,
rad2 RADIOBUTTON GROUP rad,
rad3 RADIOBUTTON GROUP rad.
*--- Selection Screen fields
SELECT-OPTIONS:
s_matnr FOR mara-matnr MODIF ID MI1,
s_mtart FOR mara-mtart MODIF ID MI1,
s_mbrsh FOR mara-mbrsh MODIF ID MI2,
s_matkl FOR mara-matkl MODIF ID MI2.
selection-screen end of block b1.


*----------------------------------------------------------------------*
* AT SELECTION SCREEN
*----------------------------------------------------------------------*

at selection-screen output.
loop at screen.
*--- If Radio Button 1 is checked
IF rad1 = 'X'.
IF screen-group1 = 'MI2'.
*--- Fields with MODIF ID MI2 disappear from the screen
screen-input = 0.
screen-invisible = 1.
ENDIF.
*--- If Radio Button 2 is checked
ELSEIF rad2 = 'X'.
IF screen-group1 = 'MI1'.
*--- Fields with MODIF ID MI1 are input-disabled
screen-input = 0.
ENDIF.
*--- If Radio Button 3 is checked
ELSEIF rad3 = 'X'.
IF screen-group1 = 'MI1' or screen-group1 = 'MI2'.
*--- All fields will appear input-enabled
screen-input = 1.
ENDIF.
ENDIF.
*--- MODIFY SCREEN mandatory addition to apply changes to the screen
Modify screen.
endloop.

No comments:

Subscribe to posts via email

Enter your email address:

Delivered by FeedBurner

Blog Owner

Karthik P
Certified SAP Netweaver Consultant

View Karthik Potharaju's profile on LinkedIn