With this website we are trying to share many useful and real-time scenarios faced in projects as tutorials to help people. You can explore many tutorials, download many useful documents and materials, watch sap abap video tutorials and many more completely free. Simply subscribe our website and keep updated.

  • ABAP Online Training @ $50

    Now you can learn ABAP by watching and listening video classes by experienced consultant.

  • ABAP Tutorials N Materials

    Read, Surf and Download useful ABAP tips, tutorials, code and download many eBooks and documents free

  • Latest ABAP Job in India

    Get all latest opening for SAP ABAP and related jobs, vaccancies across India and apply for the same.

    Showing posts with label selection screen. Show all posts
    Showing posts with label selection screen. Show all posts

    Monday, October 29, 2012


    For that first of all you have to declare 2 parameters and 2 radio button. We assume on click first radio button, first parameter will hide and on select 2nd radio button first parameter will display and 2nd will hide.

    First create 2 radio button like below :

    parameters: radio_button1 radiobutton group GRP user-command test default 'X',
                              radio_button2 radiobutton group GRP.

    You can create 2 different selection screen block also, for each parameter field. Parameter declaration need to be done like below:

    selection-screen begin of block b1 with frame title text-001.
             parameters: p_var1 type vbeln modif id GR1.
    selection-screen end of block b1.

    Here GR1 is the screen group ID. Similarly you can define the 2nd block with screen group ID = GR2. Then write douwn the Hide /Show code in AT SELECTION-SCREEN OUTPUT event.

    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'GR1' AND radio_button1 EQ 'X'.
        SCREEN-ACTIVE = '0'.
        MODIFY SCREEN.
        CONTINUE.
      ELSEIF SCREEN-GROUP1 = 'GR2' AND radio_button2 EQ 'X'.
        SCREEN-ACTIVE = '0'.
        MODIFY SCREEN.
        CONTINUE.
      ENDIF.
    ENDLOOP.

    Here, SCREEN-ACTIVE = '0' means screen is not active.
               SCREEN-ACTIVE = '1'. Screen is active

    This requirement can be completed in couple of steps. First of all write down the selection screen code for button to display in the screen.

     "This code will button to application toolbar
    SELECTION-SCREEN FUNCTION KEY 1. 

    Now we need to put some meaningful text for that button.

    INITIALIZATION .
    Data: FUNCTEXT type smp_dyntxt.

    Clear Functext.
    Functext-text = 'Display'.
    sscrfields-functxt_01 = functext.

    You can multiple buttons this way.....

    Next we need to assign some action to this button to work properly. For that we have to assign the PF status first.

    AT SELECTION SCREEN OUTPUT.
    Set PF-STATUS 'ZTEST'.

    Double click on that ZTEST and do the configuration. Provide a function code there, e.g. "DISP" . Then you can use the function code to catch the button press and based on that write code. If you like to do anything on screen itself, like to hide something, write the code below

    AT SELECTION-SCREEN OUTPUT.
      if sy-ucomm = 'DISP'.
          your code here
      endif.

    If you want to revoke some other functionality in the main code, then write in start-of-selection the below code

    if sy-ucomm = 'DISP'.
           your code here
    endif.
    You can define a selection screen parameter with  the below syntax

    PARAMETERS: p_var1 TYPE i DEFAULT 100,

    This parameter will auto defaulted with value = 100.
    Parameters cannot have data type F. The data type F is not supported in the Selection Screen

    To hide an existing parameter field, use NO-DISPLAY option
    PARAMTER P_VAR2 NO-DISPLAY.

    To make a parameter as mandatory input field, the OBLIGATORY option is used.
    PARAMETERS: p_var3 TYPE i OBLIGATORY.
    Selection screen is not like only displaying some input fields. If there are multiple input fields in the screen based of several criteria, then you have to make different blocks so that user can get the screen data properly.

    There are several syntaxes used to design and position selection screen fields

    To position the next parameter or comment on the selection screen, the POSITION option is used.

       SELECTION-SCREEN POSITION <pos>.
    For <pos>, you can specify a number, POS_LOW, or POS_HIGH.

    To create a logical block of elements on the selection screen, mark the beginning of the block with the  BEGIN OF BLOCK option of the SELECTION-SCREEN statement, then define the individual elements and mark the end of the block with the END OF BLOCK option as shown below:

     SELECTION-SCREEN BEGIN OF BLOCK <block>
    [WITH FRAME [TITLE <title>]]
    [NO INTERVALS].

    SELECTION-SCREEN END OF BLOCK <block>.
    Blocking Selection Screen code example:

    SELECTION-SCREEN BEGIN OF BLOCK rad1 WITH FRAMETITLE text-002.
    PARAMETERS vendor RADIOBUTTON GROUP gr1.
    PARAMETERS customer RADIOBUTTON GROUP gr1.
    PARAMETERS material RADIOBUTTON GROUP gr1.
    SELECTION-SCREEN END OF BLOCK rad1.
    Easy2learnabap.co.in @ 2012 All product names on this web site are trademarks of the companies that own them .

    Easy2learnabap.co.in is not affiliated with SAP AG in any way. SAP AG is the registered trademark holder of SAP, SAP R/3, mySAP, ABAP, xApps, NetWeaver, and other proprietary terms.

    The technical information on this site is verified to the greatest extent possible, however, any information found on this site is used at the site visitor's own risk. All the tutorials are collected from various sources, if anyone is having problem with the content, report this to us. We will take action accordingly.

    Easy2learnabap.co.in reserves the right to correct any errors or omissions in any portion of this site at any time without obligation.

    This website is created to teach people about ABAP technology. The Video contents provided in Premium service are completely owned by us and copyrighted.