At selection screen event

suppose i have declared parameter on selection screen for carrid and  i want to validate it like this.
suppose when i am putting valid carrid then i am getting the list but if i put another value for carrid and if no values exist in database for carrid then it should show msg that values are not found in table.
please let me know how to do it.

*& Report  ZTEST1
REPORT  ZTEST1.
type-pools: slis.
data:i_sbook type STANDARD TABLE OF sbook initial SIZE 0,
     i_fieldcatalog type SLIS_T_FIELDCAT_ALV,
     wa_sbook type sbook.
select-OPTIONS:
s_CARRID for wa_sbook-carrid.
at SELECTION-SCREEN.
if s_CARRID is not initial.
select count( * )
  from SCARR where CARRID in s_CARRID.
if sy-subrc <> 0.
   MESSAGE e000(ztest) with 'Invalid Airline Code'.
endif.
endif.
START-OF-SELECTION.
select *
  from sbook
  into table i_sbook
  up to 50 rows
  where carrid in s_carrid.
check sy-subrc = 0.
data: l_repid type syrepid value sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    I_PROGRAM_NAME               = l_repid
    I_INTERNAL_TABNAME           = 'I_SBOOK'
   I_STRUCTURE_NAME             = 'SBOOK'
    I_CLIENT_NEVER_DISPLAY       = 'X'
*   I_INCLNAME                   =
*   I_BYPASSING_BUFFER           =
*   I_BUFFER_ACTIVE              =
  CHANGING
    ct_fieldcat                  = i_fieldcatalog
  EXCEPTIONS
    INCONSISTENT_INTERFACE       = 1
    PROGRAM_ERROR                = 2
    OTHERS                       = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
data:
      wa_layout type SLIS_LAYOUT_ALV.
wa_layout-confirmation_prompt = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
*   I_CALLBACK_PROGRAM                = ' '
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
    I_STRUCTURE_NAME                  = 'SBOOK'
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
    IS_LAYOUT                         = wa_layout
*    IT_FIELDCAT                       = i_fieldcatalog
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
  TABLES
    t_outtab                          = i_sbook
  EXCEPTIONS
    PROGRAM_ERROR                     = 1
    OTHERS                            = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Similar Messages

  • How to get rid of the loop in ALV output from At selection screen event?

    I have several push buttons on a selection screen.
    Clikc on a button, then it pops up an editable ALV report. (This gets triggered AT SELECTION SCREEN event.). REUSE_ALV_GRID_DISPLAY_LVC..
    On the ALV output, I enabled F4 for a couple of fields. Once I click on the F4 button, ONF4 method gets triggerd and a pop up appears with custom search helps.
    choose a line and it fills the cell.
    Upto this it works fine.
    Now I click on the BACK button at the ALV output, it takes me to the selection screen. I click on the button again, it show the editable ALV. Now when I click on the F4 button, the pop up comes up twice and the cell gets filled from the second pop - up.
    How to control this?
    Probably I am not refreshing something?
    (I am using REUSE_ALV_GRID_DISPLAY_LVC and tooks ome code for ONF4 event from BCALV_*DATATYPES (forgot the exact name) program.)
    Thanks,
    Ven

    Hi,
    FORM refresh_grid USING  pw_grid TYPE REF TO cl_gui_alv_grid.
    *Work area
      DATA : wal_stable TYPE lvc_s_stbl.
      CHECK NOT pw_grid IS INITIAL.
      wal_stable-col = c_check.
      wal_stable-row = c_check.
    *Method to refresh grid
      CALL METHOD  pw_grid->refresh_table_display
           EXPORTING
             is_stable      = wal_stable
             i_soft_refresh = c_check
           EXCEPTIONS
             finished       = 1
             OTHERS         = 2.
    ENDFORM.                    " refresh_grid
    Thanks,
    Sree.

  • How to catch the select-options value in AT SELECTION-SCREEN event?

    Hi,all
    This is my code:
    SELECT-OPTIONS: P_BUKRS FOR T012-BUKRS.
    PARAMETERS: P_BNKA TYPE BANKA.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BNKA.
    select single bankl from bnka where bukrs = p_bukrs.
    Last statement failed because p_bukrs was null.
    So, How can I got the value of p_bukrs in AT SELECTION-SCREEN event?

    Hi Jie,
    try following code.
    REPORT zanu_test.
    TABLES : t012.
    PARAMETERS: p_bukrs LIKE t012-bukrs.
    PARAMETERS: p_bnka TYPE banka.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bnka.
      DATA: BEGIN OF dynpfields OCCURS 0.
              INCLUDE STRUCTURE dynpread.
      DATA: END OF dynpfields.
    *---  IT for changing fields on the screen
      DATA : t_dynp_flds LIKE  dynpread OCCURS 0 WITH HEADER LINE,
             t_dynpfields LIKE  dynpread OCCURS 0 WITH HEADER LINE.
      DATA: l_bukrs  LIKE t012-bukrs.
      DATA: BEGIN OF it_bank OCCURS 0,
              banka LIKE bnka-banka,
           END OF it_bank.
      DATA: l_tabix LIKE sy-tabix.
      dynpfields-fieldname = 'P_BUKRS'. APPEND dynpfields.
      CALL FUNCTION 'DYNP_VALUES_READ'
           EXPORTING
                dyname               = 'ZANU_TEST'
                dynumb               = sy-dynnr
           TABLES
                dynpfields           = dynpfields
           EXCEPTIONS
                invalid_abapworkarea = 1
                invalid_dynprofield  = 2
                invalid_dynproname   = 3
                invalid_dynpronummer = 4
                invalid_request      = 5
                no_fielddescription  = 6
                invalid_parameter    = 7
                undefind_error       = 8
                double_conversion    = 9
                stepl_not_found      = 10
                OTHERS               = 11.
      IF sy-subrc EQ 0.
        READ TABLE dynpfields WITH KEY fieldname = 'P_BUKRS'.
        IF sy-subrc EQ 0.
          MOVE dynpfields-fieldvalue TO l_bukrs.
        ENDIF.
      ELSE.
        EXIT.
      ENDIF.
      SELECT b~banka INTO CORRESPONDING FIELDS OF TABLE it_bank
      FROM t012 AS a
      INNER JOIN bnka AS b
      ON abanks = bbanks AND abankl = bbankl
      WHERE a~bukrs = l_bukrs.
      CLEAR l_tabix.
      CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
           EXPORTING
                endpos_col   = 85
                endpos_row   = 20
                startpos_col = 50
                startpos_row = 10
                titletext    = text-035
           IMPORTING
                choise       = l_tabix
           TABLES
                valuetab     = it_bank
           EXCEPTIONS
                break_off    = 1
                OTHERS       = 2.
      IF sy-subrc EQ 0.
        READ TABLE it_bank INDEX l_tabix.
        IF sy-subrc EQ 0.
    *---  Clear IT t_dynp_flds
          CLEAR : t_dynp_flds,
                  t_dynp_flds[].
    *---  Append screen values
          t_dynp_flds-fieldname = 'P_BNKA'.
          t_dynp_flds-fieldvalue = it_bank-banka.
          APPEND t_dynp_flds.
          CLEAR  t_dynp_flds.
        ENDIF.
      ENDIF.
    *---  Change screen field contents w/o PBO
      CALL FUNCTION 'DYNP_VALUES_UPDATE'
           EXPORTING
                dyname               = 'ZANU_TEST'
                dynumb               = sy-dynnr
           TABLES
                dynpfields           = t_dynp_flds
           EXCEPTIONS
                invalid_abapworkarea = 1
                invalid_dynprofield  = 2
                invalid_dynproname   = 3
                invalid_dynpronummer = 4
                invalid_request      = 5
                no_fielddescription  = 6
                undefind_error       = 7
                OTHERS               = 8.
    START-OF-SELECTION.
    -Anu

  • How to prevent AT SELECTION-SCREEN event on second Selection Screen

    Hi All
    I have a program in which I am entering some parameters in a selection screen and also validating them in AT SELECTION-SCREEN events. After validating them the program shows another selection screen in which I have some push-buttons. I have some events on those push-buttons also.
    However I am facing a different problem now. When I execute the second selection screen I get the report, and when I click on back button then it again triggers the AT SELECTION SCREEN event of the first selection screen and displays the related messages.
    How to prevent this ? Is there any way where I can restrict the execution of selection screen events for a particular selection screen?
    Amol

    Hi,
        try this logic when Ist selection screen validation
         is done set a flag = 'X' .
          at selection-screen.
          if glag is initial
           *screen validation
               flag = 'X..     
          endif.
    regards
    amole

  • Subscreen with Select-Options called from At Selection Screen event

    Dear friends,
    I'm trying to call a subscreen that contains a select-options, from an 'at selection screen' event, in a report program, but without sucess.
    Here's go what I'm doing:
    I declared a selection-screen as subscreen in my main program, and I'm calling it from a module-pool subscreen area, to make the module-pool select-options magic.
    In my main report program, I have a customized status GUI with a new toolbar button and I'm handling it at the 'at selection screen' event.
    What I need to do is to call the subscreen that contains the select-options when this new customized button get pressed, but when It happens, the select-option selections pop-up doesn't appear.
    If I call the subscreen from the 'start-of-selection' event, it goes fine, just don't work from the 'at selection screen'.
    Any ideas on how can I do it?
    Thank you,
    Heber

    i think you should try something like this:
    at selection screen.
    if condition handled ....
      show_popup = 'X'.
    endif.
    at selection screen output.
    if show_popup EQ 'X.
    call subscreen
    endif.

  • Is it possible to have two at selection-screen events in a program

    Hi all,
         I have a selection screen wherein i am using i have 5 radiobuttons and 3 select-options and a parameter. I am trying to use two at selection-screen events
    1) at selection-screen on radiobutton group rad1.
    2) AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_STATUS.
    the second event is not getting triggered.
    I have to get certain values for the parameter p_status based on the radiobutton selected from an internal table(the field doesn't belong to any dictionary table i am filling an itab with some values based on the radiobutton selected) pls help. its urgent.
    Regards
    Tharanath

    Hi
    TYPES : BEGIN OF ST_OBJID_SH,
             OTYPE TYPE HRP1000-OTYPE,
             OBJID TYPE HRP1000-OBJID,
            END OF ST_OBJID_SH.
    DATA : IT_OBJID_SH TYPE STANDARD TABLE OF ST_OBJID_SH.
    DATA : WA_OBJID_SH TYPE ST_OBJID_SH.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_OBJID-LOW.
    IF S_OBJID IS NOT INITIAL.
        SELECT OTYPE OBJID FROM HRP1000
                     INTO TABLE IT_OBJID_SH
                     WHERE OTYPE = 'D'.
    IF SY-SUBRC EQ 0.
    SEARCH HELP FOR QUALIFICATION.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
                 DDIC_STRUCTURE         = ' '
            RETFIELD               =  'OBJID'
                 PVALKEY                = ' '
           DYNPPROG               = SY-REPID
           DYNPNR                 = SY-DYNNR
           DYNPROFIELD            = 'S_OBJID'
                 STEPL                  = 0
                 WINDOW_TITLE           =
                 VALUE                  = ' '
           VALUE_ORG              = 'S'
                 MULTIPLE_CHOICE        = ' '
                 DISPLAY                = ' '
                 CALLBACK_PROGRAM       = ' '
                 CALLBACK_FORM          = ' '
                 MARK_TAB               =
               IMPORTING
                 USER_RESET             =
          TABLES
            VALUE_TAB              =  IT_OBJID_SH
                 FIELD_TAB              =
                 RETURN_TAB             = RETURN_TAB
                 DYNPFLD_MAPPING        =
               EXCEPTIONS
                 PARAMETER_ERROR        = 1
                 NO_VALUES_FOUND        = 2
                 OTHERS                 = 3
        IF SY-SUBRC <> 0.
              MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    Use in this way it will defently triggers
    <b>REward if usefull</b>

  • Sequence of  AT SELECTION-SCREEN events

    Hi All,
    I have a requirement where i need to have two fields selection screen, where the second field should have f4 help depending on the first field.
    So, i have validated the first field through AT SELECTION-SCREEN ON <FIELD1>. and for the second field i am using AT SELECTION-SCREEN ON VALUE-REQUEST FOR  <FIELD2>
    The problem i am facing over here is when i give first field input and press F4 in the second field it is not validating the First field and instead it is showing FIELD1 as blank to over come this i need to press enter before i press F4 in the second field. Is there any other alternative to over come this problem.
    Is there any sequenec for the AT SELECTION-SCREEN events to be used.
    Thanks
    Shashikanth

    Hi Shashi,
    Check the below code
    and for your future ref
    Table Control dynamic F4
    DATA : BEGIN OF f4_tab OCCURS 0,
             carrid TYPE sflight-carrid,
             connid TYPE sflight-connid,
        END OF f4_tab.
       CLEAR lin.
    " adjust this as per your requirement
      DATA : dynpread TYPE TABLE OF dynpread WITH HEADER LINE.
      REFRESH dynpread.
      CLEAR dynpread.
      dynpread-fieldname = 'ITAB-CARRID'.
    *  dynpread-stepl = lin. 
      APPEND dynpread.
      CLEAR dynpread.
    at selection-screen on value-request for YOUR_FIELD " Your Second Field here
      CALL FUNCTION 'DYNP_VALUES_READ'
            " This FM gives the First field value before u press Enter/ PAI is triggered
        EXPORTING
          dyname                               = sy-repid
          dynumb                               = sy-dynnr
        TABLES
          dynpfields                           = dynpread
       EXCEPTIONS
         invalid_abapworkarea                 = 1
         invalid_dynprofield                  = 2
         invalid_dynproname                   = 3
         invalid_dynpronummer                 = 4
         invalid_request                      = 5
         no_fielddescription                  = 6
         invalid_parameter                    = 7
         undefind_error                       = 8
         double_conversion                    = 9
         stepl_not_found                      = 10
         OTHERS                               = 11
      IF sy-subrc IS INITIAL.
        READ TABLE dynpread WITH KEY fieldname = 'ITAB-CARRID'.
        IF sy-subrc IS INITIAL.
          SELECT carrid connid FROM sflight
                INTO TABLE f4_tab
                 WHERE carrid = dynpread-fieldvalue.
          CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
            EXPORTING
              retfield               = 'CONNID'
             dynpprog               = sy-repid
             dynpnr                 = sy-dynnr
             dynprofield            = 'ITAB-CONNID'
             value_org              = 'S'
            TABLES
              value_tab              = f4_tab
        ENDIF.
      ENDIF.
    Cheerz
    Ram
    Edited by: Rob Burbank on Mar 18, 2010 9:01 AM

  • At Selection-screen Events!

    Hi!
      Pls tell me the order of selection screen events in sequence
    Pls give some sample program for validation of selection screen i/p without using search helps.
      Thanks

    Hi Rahul
    Basic form
    AT SELECTION-SCREEN.
    Additions
    1. ... ON psel
    2. ... ON END OF sel
    3. ... ON VALUE-REQUEST FOR psel_low_high .
    4. ... ON HELP-REQUEST FOR psel_low_high
    5. ... ON RADIOBUTTON GROUP radi
    6. ... ON BLOCK block
    7. ... OUTPUT
    Effect
    This event only makes sense in reports, i.e. in programs set to type 1 in the attributes. Type 1 programs are started via a logical database and always have a selection screen where the user can specify the database selections.
    The event is processed when the selection screen has been processed (at the end of PAI ).
    If an error message ( MESSAGE Emnr ) is sent during the event, all fields on the selection screen become ready for input.
    After further user input, AT SELECTION-SCREEN is executed again.
    Note
    You should only perform very expensive checks with AT SELECTION-SCREEN if the program is then started (not every time the user presses ENTER). Here, you can read the system field SSCRFIELDS-UCOMM (provided a statement TABLES SSCRFIELDS exists). If the field has one of the values 'ONLI' (= Execute) or 'PRIN' (= Execute and Print), the report is then started, i.e. the selection screen is closed and the processing continues with START-OF-SELECTION . Remember that the selection screen (and thus also AT SELECTION-SCREE N ) is also processed in variant maintenance and with SUBMIT VIA JOB . You can determine which of these applies by calling the function module RS_SUBMIT_INFO .
    Addition 1
    ... ON psel
    Effect
    This event is assigned to the selection screen fields corresponding to the report parameter or selection criterion psel .
    If the report starts an error dialog at this point, precisely these fields become ready for input.
    Addition 2
    ... ON END OF sel
    Effect
    For each selection criterion sel on the selection screen, you can call a further screen by pressing a pushbutton. On this screen, you can enter any number of single values and ranges for the selection criterion sel .
    When this screen has been processed (i.e. at the end of PAI for this screen), the event AT SELECTION-SCREEN ON END OF sel is executed.
    At this point, all the values entered are available in the internal table sel .
    Addition 3
    ... ON VALUE-REQUEST FOR psel_low_high
    Effect
    With this addition, the field psel_low_high is either the name of a report parameter or of the form sel-LOW or sel-HIGH , where sel is the name of a selection criterion. The effect of this is twofold:
    The pushbutton for F4 (Possible entries) appears beside the appropriate field.
    When the user selects this pushbutton or presses F4 for the field, the event is executed. You can thus implement a self-programmed possible entries routine for the input/output fields of the selection screen. If the program contains such an event and the user presses F4 , the system processes this rather than displaying the check table or the fixed values of the Dictionary field - even if the report parameter or the selection option with LIKE or FOR points to a Dictionary field. You can, for example, use the CALL SCREEN statement to display a selection list of possible values. The contents of the field psel_low_high at the end of this processing block are copied to the appropriate input/output field.
    This addition is only allowed with report-specific parameters (PARAMETERS ) or selection options (SELECT-OPTIONS ). For database-specific parameters or selection options, you can achieve the same effect by using the addition VALUE-REQUEST FOR ... with the key word PARAMETERS or SELECT-OPTIONS in the include DBxyzSEL (where xyz = name of logical database). In this case, you must program the value help in the database program SAPDBxyz .
    Addition 4
    ... ON HELP-REQUEST FOR psel_low_high
    Effect
    As with the addition ON VALUE-REQUEST the field psel_low_high is either the name of a report parameter or of the form sel-LOW or sel-HIGH , where sel is the name of a selection criterion. When the user presses F1 on the relevant field, the subsequent processing block is executed. You can thus implement a self-programmed help for the input/output fields of the selection screen. If the program contains such an event and the user presses F1 , the system processes this rather than displaying the documentation of the Dictionary field - even if the report parameter or the selection option with LIKE or FOR points to a Dictionary field.
    This addition is only allowed with report-specific parameters (PARAMETERS ) or selection options (SELECT-OPTIONS ). For database-specific parameters or selection options, you can achieve the same effect by using the addition HELP-REQUEST FOR ... with the key word PARAMETERS or SELECT-OPTIONS in the include DBxyzSEL (where xyz = name of logical database). In this case, you must program the help in the database program SAPDBxyz .
    Addition 5
    ... ON RADIOBUTTON GROUP radi
    <u><b>Effect</b></u>
    This event is assigned to the radio button groups on the selection screen defined by PARAMETERS par RADIOBUTTON GROUP radi .
    If the report starts an error dialog at this point, precisely these fields of the radio button group radi become ready for input again.
    <b>
    Addition 6</b>
    ... ON BLOCK block
    Effect
    <b><i>This event is assigned to the blocks on the selection screen defined by SELECTION-SCREEN BEGIN/END OF BLOCK block .
    If the report starts an error dialog at this point, precisely these fields of the block block become ready for input again.</i></b>
    <u><b>Note</b></u>
    In which sequence are the events AT SELECTION-SCREEN ON psel ... , AT SELECTION-SCREEN ON RADIOBUTTON GROUP ... , AT SELECTION-SCREEN ON BLOCK ... , AT SELECTION-SCREEN processed?
    <i>The AT SELECTION-SCREEN ON psel ... events assigned to the parameters or selection options are executed in the sequence they are declared in the program, i.e. in the sequence they appear on the selection screen.
    The events assigned to the radio button groups are executed according to the first parameter of the radio button group.
    The events assigned to the blocks are executed "from the inside to the outside".</i>
    <b>Example</b>
    SELECT-OPTIONS SEL0 FOR SY-TVAR0.
    SELECTION-SCREEN BEGIN OF BLOCK BL0.
    SELECT-OPTIONS SEL1 FOR SY-TVAR1.
    SELECTION-SCREEN BEGIN OF BLOCK BL1.
    PARAMETERS P0 RADIOBUTTON GROUP RADI.
    PARAMETERS P1 RADIOBUTTON GROUP RADI.
    SELECTION-SCREEN BEGIN OF BLOCK BL2.
    PARAMETERS P3.
    SELECTION-SCREEN END   OF BLOCK BL2.
    SELECT-OPTIONS SEL2 FOR SY-TVAR2.
    SELECTION-SCREEN END   OF BLOCK BL1.
    SELECTION-SCREEN END   OF BLOCK BL0.
    <b>Sequence:</b>
    AT SELECTION-SCREEN ON...
    SEL0
    SEL1
    RADIOBUTTON GROUP RADI
    P3
    BLOCK BL2
    SEL2
    BLOCK BL1
    BLOCK BL0
    AT SELECTION-SCREEN is executed at the very end.
    <b>Addition 7</b>
    ... OUTPUT
    <u>Effect</u>
    <b>This event is executed at PBO of the selection screen every time the user presses ENTER - in contrast to INITIALIZATION . Therefore, this event is not suitable for setting selection screen default values. Also, since AT SELECTION-SCREEN OUTPUT is first executed after the variant is imported (if a variant is used) and after adopting any values specified under SUBMIT in the WITH clause, changing the report parameters or the selection options in AT SELECTION-SCREEN OUTPUT would destroy the specified values.
    Here, however, you can use LOOP AT SCREEN or MODIFY SCREEN to change the input/output attributes of selection screen fields.</b>
    <u><b>Example</b></u>
    <b>Output all fields of the
    SELECT-OPTION NAME
    highlighted:</b>
    SELECT-OPTIONS NAME FOR SY-REPID MODIF ID XYZ.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
         CHECK SCREEN-GROUP1 = 'XYZ'.
         SCREEN-INTENSIFIED = '1'.
         MODIFY SCREEN.
      ENDLOOP.
    <i><b>The addition MODIF ID XYZ to the key word SELECT-OPTIONS assigns all fields of the selection option NAME to a group you can read in the field SCREEN-GROUP1 . At PBO of the selection screen, all these fields are then set to highlighted.
    </b></i>
    check these links
    http://help.sap.com/saphelp_nw2004s/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/10/e7dbde82ba11d295a40000e8353423/content.htm
    Reward all helpfull answers
    Regards
    Pavan

  • Capture Selection-screen events

    Dear SAP friends,
    I have created OOP report.
    At the runtime the program creates toolbar and adds pushbuttons to it.
    Every button has fcode assigned.
    On button click the below method is called.
    The below statement "CALL SELECTION-SCREEN 1200 STARTING AT 10 10" calls selection screen as popup.
    I need to capture when User closes the selection popup and when he clicks Cancel button located in the selection popup.
    Please advise.
    Regards
    Tatyana.
    METHOD  handle_pushbutton_click.
    CASE fcode.
          WHEN 'CHECKS_EXP'.
            CALL SELECTION-SCREEN 1200 STARTING AT 10 10.
            PERFORM at_selection_1200.
            CHECK w_continue = abap_true.
            PERFORM build_options_range.
            PERFORM build_options_norange.
            PERFORM start_selection_1200.
            PERFORM fcat_init_1200.
            w_title = 'Checks -> Expenditures'.
            PERFORM set_layout USING w_title.
            PERFORM getdata_1200.
            DESCRIBE TABLE lt_rpt LINES w_count.      " Get number of records.
            PERFORM populate_selection USING w_count.
    ENDDCASE.

    Hello Tatyana
    The following sample report ZUS_SDN_OO_REPORT_SELSCREEN should simulate your scenario.
    If you push the EXECUTE button you will find ok-code='CRET'.
    If you close the popup or push the CANCEL button ok-code=' ' (space; empty). This way you know that the popup was closed by the user.
    *& Report  ZUS_SDN_OO_REPORT_SELSCREEN
    *& Thread: Capture Selection-screen events
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1205127"></a>
    REPORT  zus_sdn_oo_report_selscreen.
    *       CLASS lcl_myclass DEFINITION
    CLASS lcl_myclass DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          md_okcode   TYPE ui_func.
        CLASS-METHODS:
          handle_pushbutton_click.
    ENDCLASS.                    "lcl_myclass DEFINITION
    *       CLASS lcl_myclass IMPLEMENTATION
    CLASS lcl_myclass IMPLEMENTATION.
      METHOD handle_pushbutton_click.
        DATA: ld_msg    TYPE bapi_msg.
        BREAK-POINT.
        CLEAR: lcl_myclass=>md_okcode.
        DO.
          CALL SELECTION-SCREEN 1200 STARTING AT 10 10.
          EXIT.
        ENDDO.
        CONCATENATE 'ok-code =' md_okcode INTO ld_msg
          SEPARATED BY space.
        MESSAGE ld_msg TYPE 'I'.
        MESSAGE 'Continue after SelScreen' TYPE 'S'.
      ENDMETHOD.                    "handle_pushbutton_click
    ENDCLASS.                    "lcl_myclass IMPLEMENTATION
    SELECTION-SCREEN BEGIN OF SCREEN 1200.
    PARAMETERS:
      p_bukrs   TYPE bukrs.
    SELECTION-SCREEN END OF SCREEN 1200.
    AT SELECTION-SCREEN OUTPUT.
      BREAK-POINT.
      CLEAR: syst-ucomm.
    AT SELECTION-SCREEN.
      BREAK-POINT.
      lcl_myclass=>md_okcode = syst-ucomm.
    START-OF-SELECTION.
      lcl_myclass=>handle_pushbutton_click( ).
    END-OF-SELECTION.
    Regards
      Uwe

  • Reports(Selection screen events)

    Hi guys,
    What are the 11 selection screen events?

    Hai Raj Singh
    Here is the Report Event
    Check it
    This is the order of execution in Classical/Interactive Report Events
    Classical Reports
    Reports which are properly formatted  (header, footer, page numbers etc.,) with the help of one or more external events like top-of-page,end-of-page etc., are called as CLASSICAL REPORTS.
    Standard list.
    Output of Report program is nothing but Standard list. It consists of one continuous page of 60,000 lines.
    To restrict number of lines per page.
    Report Zxxxxx line-count 25.
                   OR
    Report Zxxxxx line-count 25(3).
    ( In this case 3 lines are reserved for footer)
    To restrict Output width.
    Report Zxxxx line-size 125.
    To suppress standard page heading.
    Report Zxxxx no standard page heading
    Above all at a time:
    Report Zxxxx line-count 25(3)
                           line-size 125
                           no standard page heading.
    Screen Events               List Events
    Initialization.           Start-of-selection
    At selection-screen.          Top-of-page.
    At selection-screen on <field>.     End-of-page.
                        End-of-selection.
    We can initialize the selection-screen with calculated default values under this event.
         Initialization.
         s_date-high = sy-datum.
         s_date-low = sy-datum - 15.
         Append s_date.
    We can validate all the inputs on selection screen fields under this event.
         At selection-screen.
         If s_carrid-low is initial or
             s_connid-low is initial or
             s_date is initial.
         < ... code for validation... >.
         Endif.
    We can validate a particular field input on selection screen under this event.
         At selection-screen on s_carrid.
         If s_carrid-low < > ‘LH’.
         <… code for validation…>
         Endif.
    If any of the other event comes before
    ‘Select…Endselect.’ statements, then to break
    that event, we require this S-O-S event.
    Start-of-selection.
    Select * from ……
    Endselect.
    If we need some portion of the output (like
    column headings) to appear in all the pages,
    then we use this event.
    Top-of-page.
    Write:/ ‘Carrier’,10 ‘Connection’ 20 ‘Date’.
    If there is no external output statement before
    ‘Top-of-page’ event, then this event will not
    work.
    Once the cursor reaches the last line of the
    page, automatically this event will be triggered.
    Report Zxxx line-count 25(3).
    In this case line numbers 23, 24 and 25 are
    reserved for footer.
    Once the cursor reaches 23rd line, this event
    will be triggered.
    End-of-page.
    Write:/ sy-uline(75).
    Write:/ ‘This is end of page:’,sy-pagno.
    Write:/ sy-uline(75).
    This event is used for concluding part of List.
         End-of-selection.
         Write:/ ‘This is end of the Report’.
    Interactive Report
    A simple report or even a classical report  displays a clustered list with all the  requested output at one go.
    What ever it is displayed, it is final. That means, the user can not interact with with that list.
    A simple report or even a classical report  displays a clustered list with all the  requested output at one go.
    What ever it is displayed, it is final. That means, the user can not interact with with that list.
    In the interactive reports, we can create as many as 21 lists.
    The first list is called ‘Basic list’ and all the successive lists are called ‘Secondary lists’. Each list is again an interactive.
    The Basic list is not deleted when secondary list is created.
    A secondary list may either overlay the basic list or appear in an additional dialog window on the same screen.
    The system variable associated with list number is ‘SY-LSIND’.
    For basic list SY-LSIND = 0 and for secondary lists, SY-LSIND varies from 1 to 20.
    User can interact with the list by the following ways.
    Double clicking or single click and pressing F2 (function key) or single click with ‘hotspot on’.
                   OR
    Selecting from menu bar or from application tool bar.
    All the events used in classical reports can be used in Basic List.
    The event ‘End-of-page’ can be used in Secondary Lists also.(the other six events can not be used in secondary lists)
    You can not place ‘select-options’ in secondary lists.
    The following additional events are
    applicable to secondary lists.
    Top-of-page during line-selection.
    At line-selection.
    At user-command.
    When you double click on any field in the basic list, you will be navigating to secondary list with detailed information pertaining to clicked field.
    As such we need to store the clicked field information at some variable.
    ‘Hide’ temporarily stores the content of clicked field for later use.
    The default title of the out put is the text what we enter during creation of program.
    This title can be changed using:
    SET TITLEBAR ‘AAA’.
         GUI status includes:
    Menu bar
    Application tool bar and
    Activating standard tool bar
         GUI status can be created using
    SET PF-STATUS ‘BBB’.
    You can have 8 menus ( out of which, 2 menus are reserved for ‘System’ and ‘Help’).
    Each menu can have 15 menu items.
    Each menu item can have 3 levels of submenus.
    You can create 35 items in application tool bar.
    Thanks & Regards
    Sreenivasulup

  • Selection screen event in tbale maintainance generator

    Hi experts,
         I had created Table maintainance for Ztable..Now req is i have to some of the delete the entries of table based on input values of user.Now table maintainance displayin all the entries of database table.but before entries to be deleted i want one selction screen .so user can give the vlaues..based on the it will display that correspoinding entries to be deleted..then user can delete the entries..
    for this can anybody tell me what is correct event in table maintainance generator..i mean before going to display the entries i wnat one selection screen ..
    Can any body plz help me..
    Thanks in advance,
    Praveena.
    Moderator Message: Do some R&D first.
    Edited by: kishan P on Nov 30, 2010 9:48 AM

    Try to check when user requests for batch, not when  batch is running, when sy-batch is initial and function code is execute in background.
    AT SELECTION-SCREEN.
      IF sy-batch = IS INITIAL AND sscrfields-ucomm EQ 'SJOB'.
        IF p_layout IS INITIAL.
          MESSAGE e226(ZMG) "Please fill the layout field.
        ENDIF.
      ENDIF.
    Regards,
    Raymond

  • Regarding at selection screen event

    hi experts,
                   i m working on hr abap report with the help of pnp ldb i made my selection screen using report category 'PY_DEF'  now what i want that i m not using the first selction screen which contains current period  details etc but when i click on the payroll period button the second selection screen is coming no doubt... containing payroll area current period ,other periods etc here i m entering payroll area eq 'ka' and  other periods from '012006' to '122006' ,,here i want to validate the user input that it sud be of one year that is from 1 to 12.....for this i know i will use at selection event but how can i use it for the second selection screen not for first screen......... plz help me....

    Do u realy need the first selection screen having the current period? If u don't need then u can hide the field in the report category, by passing only the payroll area with other period, in this case we can validate through selection screen..
    Reward points ... if found helpful...
    Regards,
    Sowmen Das

  • SELECTION SCREEN EVENT

    Hi Guys,
       we have a customized selection program similar to RSNAST00. In that while maintaining the variant when the users enter values other than say "ZABC " in output type field (KSCHL) and press enter certain fields in the screen should not be available for input. I have written this event which is getting trigerred but no changes are done to the screen
    AT SELECTION-SCREEN ON S_KSCHL.
      LOOP AT SCREEN.
        IF screen-group1 = 'SHP'.
          IF s_kschl-low NE 'ZABC'.
            SCREEN-INPUT = '1'.
            ELSE.
            SCREEN-INPUT = '0'.
                ENDIF.
          MODIFY SCREEN .
        ENDIF.
      ENDLOOP
    Can anyone please advice me how to achieve this.
    Thanks
    Krithika

    Hi Krithika,
    Recently 3 days before i have posted the same question and i got the solution which i am sharing you. I am having a drop box input field where if i select NO from the dropdown then automatically concern fields has to be disabled.
    In PBO
    IF ZFORMA-CISWK = 'NO'. 
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZFORMA-YISWK'. "field will become inactive
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    In PAI
    IF ZFORMA-CISWK = 'YES'.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZFORMA-YISWK'. "field will be active
    SCREEN-INPUT = 1.
    SCREEN-ACTIVE = 1.
    SCREEN-OUTPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    It is work with me fine.
    Hope my answer will help you.
    Cheers!!

  • 'SET PF-STATUS EXCLUDING fcode' not working in Selection Screen event

    Hi all,
    I am trying to set PF-Status dynamically in Selection Screen based on Radio button.
    For that i have inserted following code under event --> AT SELECTION-SCREEN OUTPUT
    * SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: s_inc  RADIOBUTTON GROUP rad DEFAULT 'X'
                       USER-COMMAND inc MODIF ID mod,
                p_inc(10) MODIF ID m1,
                s_lbr  RADIOBUTTON GROUP rad,
                p_lbr(10) MODIF ID m2.
    SELECTION-SCREEN END OF BLOCK b1.
    *  AT SELECTION-SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      REFRESH fcode.
      IF s_inc IS INITIAL.
        APPEND 'CRTE' TO fcode.
        APPEND 'CHNG' TO fcode.
        APPEND 'DISP' TO fcode.
        APPEND 'PRNI' TO fcode.
        APPEND 'CRTL' TO fcode.
        SET PF-STATUS 'STATUS_IN' EXCLUDING fcode.
      ELSE.
        SET PF-STATUS 'STATUS_IN'.
      ENDIF.
    Though s_inc is initial, i can see all the buttons from Status 'STATUS_IN' after execution of above code. EXCLUDING statement is not taking any effect which we normally get in Module pool program.
    Please tell me what went wrong in above code?

    Problem solved ......Thanks Keshav,
    Giving code correction -->
    * SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: s_inc  RADIOBUTTON GROUP rad DEFAULT 'X'
                       USER-COMMAND inc MODIF ID mod,
                p_inc(10) MODIF ID m1,
                s_lbr  RADIOBUTTON GROUP rad,
                p_lbr(10) MODIF ID m2.
    SELECTION-SCREEN END OF BLOCK b1.
    *  AT SELECTION-SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      REFRESH fcode.
      IF s_inc IS INITIAL.
        APPEND 'CRTI' TO fcode.
        APPEND 'CHGI' TO fcode.
        APPEND 'DISI' TO fcode.
        APPEND 'DELI' TO fcode.
        APPEND 'PRNI' TO fcode.
        APPEND 'CRTL' TO fcode.
        APPEND 'DATA' TO fcode.
      ELSE.
        APPEND 'CHGL' TO fcode.
        APPEND 'DISL' TO fcode.
        APPEND 'PRNL' TO fcode.
      ENDIF.
      CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
        EXPORTING
          p_status        = 'STATUS_IN'
          P_PROGRAM       = sy-repid
        TABLES
          p_exclude       = fcode

  • On at selection-screen event

    hi,
    i have two fields in seelction screen .if i enter delivery number on selection screen field automatically delivery date to filled in second field of selection screen.
    how it solved..

    hi, you need to press enter after filling the field so that the next parameter is populated otherwise no event is triggered
    Please check this sample code and award points if found helpful
    <b>
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-NAME = 'ST_NAME'.
          IF ST_NAME IS NOT INITIAL AND FLAG_SEL IS INITIAL.
            CLEAR LIMPR.
            CLEAR QTY.
            SELECT STOCK CURRPR
                         FROM
                         ZEXCH
                         INTO (ST_CODE, CURRPR)
                         WHERE ST_NAME = ST_NAME
                         AND EXCH = L_EXCH.
            ENDSELECT.
            IF SY-SUBRC <> 0.
              FLAG_END = 'X'.
              CLEAR CURRPR.
              CLEAR ST_CODE.
              CLEAR ST_NAME.
          ENDIF.
          ENDIF.
      ENDLOOP.
    </b>
    When u want to handle F4 help for this and automatically fill the delivery date then u need to use <b>AT SELECTION-SCREEN ON VALUE-REQUEST FOR ST_NAME.</b>
    Award points if found helpful

  • Radio button on selection screen event issue.

    Hi all,
    I have two radio buttons and two input mandatory fields on selection screen.
    - If  first radio button selected then some value 'ABC' should fill in second input field.(because it is a mandatory field)
    - If  second radio button selected then some value 'XYZ' should fill in first input field..(because it is a mandatory field)
    If suppose, user deletes first input value (ABC) and selects second Radio then, ABC to automatically display on first input field as this is mandatory. Same like,If he deletes second input field value and selects first radio, it should display XYZ in second input field. (As these fields are mandatory and requires some value).
    I tried with below code, but not working. Appreciate your quick response.
    PARAMETER          ppart RADIOBUTTON GROUP src  DEFAULT 'X'.
    SELECT-OPTIONS  p_sndprn FOR edoc_stat-sndprn OBLIGATORY DEFAULT 'ABC'.
    PARAMETER         psndr RADIOBUTTON GROUP src.
    SELECT-OPTIONS p_sendid FOR zabc-sndlad OBLIGATORY DEFAULT 'XYZ'.   
    AT SELECTION-SCREEN ON RADIOBUTTON GROUP src.
    IF SSCRFIELDS-UCOMM = 'PRGP'.
      IF ppart EQ 'X'.
           P_SENDID-LOW = 'XYZ'.
      ELSE.
          P_SNDPRN-LOW = 'ABC'.
      ENDIF.
    ENDIF.
    Thanks,
    Ranjith.

    Search the forum... don't make fields obligatory and use event AT SELECTION-SCREEN OUTPUT.

Maybe you are looking for