Initialization event

Hi Gurus,
I found the follwoing statements from SAP help
Initialization event can be used to initialize the input fields of the standard selection screen.
This event keyword defines an event block whose event is triggered by the ABAP runtime environment during the flow of an executable program, directly after LOAD-OF-PROGRAM and before the selection screen processing of any existing standard selection screen.
Now my doubt is if a program doesn't have a selection screen does Initialization event would still get called?

yes it will call initialization even if it doesnt have any selection screen fields.
For example,
code -
DATA a TYPE i.
START-OF-SELECTION.
  WRITE a .
  a = 9.
  WRITE a.
INITIALIZATION.
  a = 10.
now answer will be 10 and 9.
So the value for A will be 10 first which is set in intialization event.

Similar Messages

  • Leave to screen 0 does not branch to initialization event (ALV)

    Hi All,
    I'm new at this forum thing so be gentle. I have created the standard custom control in a new screen, setup the field catalog and other parameters and when I call the screen and do the :
      IF g_custom_container IS INITIAL.
        CREATE OBJECT g_custom_container
           EXPORTING
              container_name = 'ZTMR_EVAL_GRID'.
        CREATE OBJECT g_grid
           EXPORTING
             i_parent = g_custom_container.
        CLEAR wa_disvariant.
        wa_disvariant-report = sy-repid.
        CALL METHOD g_grid->set_table_for_first_display
          EXPORTING
            is_variant      = wa_disvariant
            i_save          = 'A'
            is_layout       = wa_layout
          CHANGING
            it_outtab       = detail_tab[]
            it_fieldcatalog = itab_fldcat
            it_sort         = itab_sort.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_top_of_page FOR g_grid.
      ENDIF.
    , everything works great. The problem occurs when hit the BACK button in my PAI module, it returns to the line after the CALL SCREEN XXX, ENDFORM, PERFORM output_alv_grid_report and then branches to :
    FUNCTION hrpy_process_fire_event in the source code of LHRST1U01 in the main program SAPLHRST1.
    It does this instead of branching to the INITIALIZATION event (selection-screen) which is what it's supposed to do?
    Any help would be greatly appreciated - Thanks in advance,
    Jim

    hi,
    REPORT  ZTEST1234_ALV_TOP    MESSAGE-ID ZZ                           .
    DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: L_VALID TYPE C,
          V_FLAG,
          V_DATA_CHANGE,
          V_ROW TYPE LVC_S_ROW,
          V_COLUMN TYPE LVC_S_COL,
          V_ROW_NUM TYPE LVC_S_ROID.
    "The Below Definitions Must.....
    DATA:
    * Reference to document
           DG_DYNDOC_ID       TYPE REF TO CL_DD_DOCUMENT,
    * Reference to split container
           DG_SPLITTER          TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
    * Reference to grid container
           DG_PARENT_GRID     TYPE REF TO CL_GUI_CONTAINER,
    * Reference to html container
           DG_HTML_CNTRL        TYPE REF TO CL_GUI_HTML_VIEWER,
    * Reference to html container
           DG_PARENT_HTML     TYPE REF TO CL_GUI_CONTAINER.
    "up to here
    *       CLASS lcl_event_handler DEFINITION
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION .
        METHODS:
    **Hot spot Handler
        HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                          IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
    **Double Click Handler
        HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                         IMPORTING E_ROW E_COLUMN ES_ROW_NO,
        TOP_OF_PAGE FOR EVENT TOP_OF_PAGE              "event handler
                             OF CL_GUI_ALV_GRID
                             IMPORTING E_DYNDOC_ID.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *Handle Hotspot Click
      METHOD HANDLE_HOTSPOT_CLICK .
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW_ID.
        V_COLUMN = E_COLUMN_ID.
        V_ROW_NUM = ES_ROW_NO.
        MESSAGE I000 WITH V_ROW 'clicked'.
      ENDMETHOD.                    "lcl_event_handler
    *Handle Double Click
      METHOD  HANDLE_DOUBLE_CLICK.
      ENDMETHOD.                    "handle_double_click
      METHOD TOP_OF_PAGE.                   "implementation
    * Top-of-page event
        PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
      ENDMETHOD.                            "top_of_page
    ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION
    *&             Global Definitions
    DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
                G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
    DATA: OK_CODE LIKE SY-UCOMM,
          SAVE_OK LIKE SY-UCOMM,
          G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
          GS_LAYOUT TYPE LVC_S_LAYO.
    *- Fieldcatalog for First and second Report
    DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
          X_FIELDCAT TYPE LVC_S_FCAT,
          LS_VARI  TYPE DISVARIANT.
    *                START-OF_SELECTION
    START-OF-SELECTION.
      DATA:BEGIN OF  ITAB OCCURS 0,
           VBELN LIKE LIKP-VBELN,
           POSNR LIKE LIPS-POSNR,
           CELLCOLOR TYPE LVC_T_SCOL, "required for color
           DROP(10),
           END OF ITAB.
      SELECT VBELN
             POSNR
             FROM LIPS
             UP TO 20 ROWS
             INTO CORRESPONDING FIELDS OF TABLE ITAB.
    END-OF-SELECTION.
      IF NOT ITAB[] IS INITIAL.
        <b>CALL SCREEN 100.</b>
      ELSE.
        MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
      ENDIF.
    *&      Form  CREATE_AND_INIT_ALV
    *       text
    FORM CREATE_AND_INIT_ALV .
      DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
      "attention.....from here
      "split your container here...into two parts
      "create the container
      CREATE OBJECT G_CUSTOM_CONTAINER
               EXPORTING CONTAINER_NAME = G_CONTAINER1.
      "this is for top of page
    * Create TOP-Document
      CREATE OBJECT DG_DYNDOC_ID
                       EXPORTING STYLE = 'ALV_GRID'.
    * Create Splitter for custom_container
      CREATE OBJECT DG_SPLITTER
                 EXPORTING PARENT  = G_CUSTOM_CONTAINER
                           ROWS    = 2
                           COLUMNS = 1.
    * Split the custom_container to two containers and move the reference
    * to receiving containers g_parent_html and g_parent_grid
      "i am allocating the space for grid and top of page
      CALL METHOD DG_SPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 1
          COLUMN    = 1
        RECEIVING
          CONTAINER = DG_PARENT_HTML.
      CALL METHOD DG_SPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 2
          COLUMN    = 1
        RECEIVING
          CONTAINER = DG_PARENT_GRID.
      "you can set the height of it
    * Set height for g_parent_html
      CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
        EXPORTING
          ID     = 1
          HEIGHT = 5.
      "from here as usual..you need to specify parent as splitter part
      "which we alloted for grid
      CREATE OBJECT G_GRID
             EXPORTING I_PARENT = DG_PARENT_GRID.
    * Set a titlebar for the grid control
      CLEAR GS_LAYOUT.
      GS_LAYOUT-GRID_TITLE = TEXT-003.
      GS_LAYOUT-ZEBRA = SPACE.
      GS_LAYOUT-CWIDTH_OPT = 'X'.
      GS_LAYOUT-NO_ROWMARK = 'X'.
      GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
      CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
      CREATE OBJECT G_HANDLER.
      SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
      DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
      DATA: L_INDEX TYPE SY-TABIX.
      "Here i am changing the color of line 1,5,10...
      "so you can change the color of font conditionally
      LOOP AT ITAB.
        L_INDEX = SY-TABIX.
        IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
          LS_CELLCOLOR-FNAME = 'VBELN'.
          LS_CELLCOLOR-COLOR-COL = '6'.
          LS_CELLCOLOR-COLOR-INT = '0'.
          LS_CELLCOLOR-COLOR-INV = '1'.
          APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
          MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
          LS_CELLCOLOR-FNAME = 'POSNR'.
          LS_CELLCOLOR-COLOR-COL = '6'.
          LS_CELLCOLOR-COLOR-INT = '0'.
          LS_CELLCOLOR-COLOR-INV = '1'.
          APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
          MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
        ENDIF.
      ENDLOOP.
    * setting focus for created grid control
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL = G_GRID.
    * Build fieldcat and set editable for date and reason code
    * edit enabled. Assign a handle for the dropdown listbox.
      PERFORM BUILD_FIELDCAT.
      PERFORM  SET_DRDN_TABLE.
    * Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
      PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
    **Vaiant to save the layout
      LS_VARI-REPORT      = SY-REPID.
      LS_VARI-HANDLE      = SPACE.
      LS_VARI-LOG_GROUP   = SPACE.
      LS_VARI-USERNAME    = SPACE.
      LS_VARI-VARIANT     = SPACE.
      LS_VARI-TEXT        = SPACE.
      LS_VARI-DEPENDVARS  = SPACE.
    **Calling the Method for ALV output
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          IS_VARIANT           = LS_VARI
          IS_LAYOUT            = GS_LAYOUT
          I_SAVE               = 'A'
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = ITAB[].
      "do these..{
    * Initializing document
      CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
    * Processing events
      CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
        EXPORTING
          I_EVENT_NAME = 'TOP_OF_PAGE'
          I_DYNDOC_ID  = DG_DYNDOC_ID.
      "end }
    * Set editable cells to ready for input initially
      CALL METHOD G_GRID->SET_READY_FOR_INPUT
        EXPORTING
          I_READY_FOR_INPUT = 1.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
    *       text
    *      -->PT_EXCLUDE text
    FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      DATA LS_EXCLUDE TYPE UI_FUNC.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_fieldcat
    *       Fieldcatalog
    FORM BUILD_FIELDCAT .
      DATA: L_POS TYPE I.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
      X_FIELDCAT-FIELDNAME = 'VBELN'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN = '10'.
      X_FIELDCAT-HOTSPOT = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Item'(025).
      X_FIELDCAT-FIELDNAME = 'POSNR'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
      X_FIELDCAT-FIELDNAME = 'DROP'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      X_FIELDCAT-EDIT = 'X'.
      X_FIELDCAT-DRDN_HNDL = '1'.
      X_FIELDCAT-DRDN_ALIAS = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
    ENDFORM.                    " build_fieldcat
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF G_CUSTOM_CONTAINER IS INITIAL.
    **Initializing the grid and calling the fm to Display the O/P
        PERFORM CREATE_AND_INIT_ALV.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  SET_DRDN_TABLE
    *       text
    FORM SET_DRDN_TABLE.
      DATA:LT_DRAL TYPE LVC_T_DRAL,
            LS_DRAL TYPE LVC_S_DRAL.
      LOOP AT ITAB .
    * First listbox (handle '1').
        IF SY-INDEX = 1.
          LS_DRAL-HANDLE = '1'.
          LS_DRAL-VALUE =  ' '.
          LS_DRAL-INT_VALUE =  ' '.
        ELSE.
          LS_DRAL-HANDLE = '1'.
          LS_DRAL-VALUE =  ITAB-POSNR.
          LS_DRAL-INT_VALUE =  ITAB-POSNR.
        ENDIF.
        APPEND LS_DRAL TO LT_DRAL.
      ENDLOOP.
    **Setting the Drop down table for Reason Code
      CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
        EXPORTING
          IT_DROP_DOWN_ALIAS = LT_DRAL.
    ENDFORM.                               " set_drdn_table
    *&      Form  EVENT_TOP_OF_PAGE
    *       text
    *      -->DG_DYNDOC_ID  text
    FORM EVENT_TOP_OF_PAGE USING   DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
      "this is more clear.....check it
      "first add text, then pass it to comentry write fm
      DATA : DL_TEXT(255) TYPE C.  "Text
    * Populating header to top-of-page
      CALL METHOD DG_DYNDOC_ID->ADD_TEXT
        EXPORTING
          TEXT      = 'Test Report'
          SAP_STYLE = CL_DD_AREA=>HEADING.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move program ID
      CONCATENATE 'Program Name :' SY-REPID
             INTO DL_TEXT SEPARATED BY SPACE.
    * Add Program Name to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move User ID
      CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE
    * Add User ID to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move Client
      CONCATENATE 'Client :' SY-MANDT INTO DL_TEXT SEPARATED BY SPACE.
    * Add Client to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move date
      WRITE SY-DATUM TO DL_TEXT.
      CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
    * Add Date to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move time
      WRITE SY-UZEIT TO DL_TEXT.
      CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
    * Add Time to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
    * Populating data to html control
      PERFORM HTML.
    ENDFORM.                    " EVENT_TOP_OF_PAGE
    *&      Form  ADD_TEXT
    *       To add Text
    FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.
    * Adding text
      CALL METHOD DG_DYNDOC_ID->ADD_TEXT
        EXPORTING
          TEXT         = P_TEXT
          SAP_EMPHASIS = CL_DD_AREA=>HEADING.
    ENDFORM.                    " ADD_TEXT
    *&      Form  HTML
    *       text
    FORM HTML.
      DATA : DL_LENGTH  TYPE I,                           " Length
             DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id
    * Creating html control
      IF DG_HTML_CNTRL IS INITIAL.
        CREATE OBJECT DG_HTML_CNTRL
             EXPORTING
                  PARENT    = DG_PARENT_HTML.
      ENDIF.
    * Reuse_alv_grid_commentary_set
      CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
        EXPORTING
          DOCUMENT = DG_DYNDOC_ID
          BOTTOM   = SPACE
        IMPORTING
          LENGTH   = DL_LENGTH.
    * Get TOP->HTML_TABLE ready
      CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.
    * Set wallpaper
      CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND
        EXPORTING
          PICTURE_ID = DL_BACKGROUND_ID.
    * Connect TOP document to HTML-Control
      DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.
    * Display TOP document
      CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT
        EXPORTING
          REUSE_CONTROL      = 'X'
          PARENT             = DG_PARENT_HTML
        EXCEPTIONS
          HTML_DISPLAY_ERROR = 1.
      IF SY-SUBRC NE 0.
        MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
      ENDIF.
    ENDFORM.                    " HTML
    Regards
    Vijay

  • Use of FM 'SELECT_OPTIONS_RESTRICT' in other than INITIALIZATION event

    Hi all,
    I am using function module SELECT_OPTIONS_RESTRICT to restrict the select option ranges. My question is can we use this FM into another event such as AT SELECTION-SCREEN. Basically I want to restrict n grayed out Select Option High value and Ranges option on certain value of other paramter on selection screen. When I use this FM into event AT SELECTION-SCREEN it gives me exception 'TOO_LATE'.
    Any idea how to use this or any other way to fullfll such requirement?
    Thanks,
    Vikas.

    The FM SELECT_OPTIONS_RESTRICT would only work in INITIALIZATION event. I don't came across other FM which we can call from another event. But, you to achieve your functionality, you can have a dummy type of select option with required restricted settings and make it active when required.
    DATA: w_vbeln TYPE vbak-vbeln.
    TYPE-POOLS sscr.
    DATA: restrict     TYPE sscr_restrict,
          opt_list     TYPE sscr_opt_list,
          associate    TYPE sscr_***.
    PARAMETERS: p_simpl RADIOBUTTON GROUP rd1 USER-COMMAND usr1 DEFAULT 'X',
                p_compl RADIOBUTTON GROUP rd1.
    SELECT-OPTIONS: s_simpl FOR w_vbeln MODIF ID gp1.
    SELECT-OPTIONS: s_compl FOR w_vbeln MODIF ID gp2.
    INITIALIZATION.
      %_s_simpl_%_app_%-text = 'Select Option'.
      %_s_compl_%_app_%-text = 'Select Option'.
    * Set the complex
      MOVE 'EQ'  TO opt_list-name.
      opt_list-options-eq = 'X'.
      APPEND opt_list TO restrict-opt_list_tab.
      associate-kind    = 'S'.
      associate-name    = 'S_COMPL'.
      associate-sg_main = 'I'.
      associate-sg_addy = ' '.
      associate-op_main = 'EQ'.
      associate-op_addy = 'EQ'.
      APPEND associate TO restrict-***_tab.
      CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
        EXPORTING
          restriction = restrict.
    AT SELECTION-SCREEN OUTPUT.
      CASE 'X'.
        WHEN p_simpl.
          LOOP AT SCREEN.
            IF screen-group1 = 'GP2'.
              screen-active = 0.
              MODIFY SCREEN.
            ENDIF.
          ENDLOOP.
        WHEN p_compl.
          LOOP AT SCREEN.
            IF screen-group1 = 'GP1'.
              screen-active = 0.
              MODIFY SCREEN.
            ENDIF.
          ENDLOOP.
      ENDCASE.
    Regards,
    Naimesh Patel

  • LDB-PNP Variant  behavior (Background job )  on INITIALIZATION Event.

    Iu2019ve written code on initialization event to pre-select employees based on Employee status (active) and created PNPINDEX.
    Problem: This program move to prod in June, user created the variant as u201Ccurrent yearu201D and employee status u201CACTIVEu201D. Guess what, this program ran for month of June, July, August and September and always come up with 100 recordsu2019. I found it really strange, after doing research I came to know that when user created the variant first time, it created the pre-populate list of employees and always run for it. Since this job run it background. 
    I knew from HR ABAP class, you always pre-select the employees to make program more efficient and Iu2019ve seen this coding routine habit at almost every project.
    I commented my code and now it is running fine. But my question from the folks out there who know the value of pre-select.  What approach we should follow if we hit by the above scenario? Comment the code (the way I did) or re-save the variant every time, which is not good practice from user stands point.  So what else?
    Regards,
    Khan

    Good idea... I shouldu2019ve done this in " start-of-selection " .  Some time, you never think end result until it hits you
    Thanks,
    Khan

  • CREATE OBJECT inside INITIALIZATION event in ABAP

    Hi everyone,
    I have one question, can we create object inside INITIALIZATION event. Why, I am asking this question is, because most of the time I have seen people to create object inside start-of-selection. Please give your thought on this.
    The code I have just coded below is also right or wrong?
    CLASS lcl_build_data DEFINITION.
       PUBLIC SECTION.
         METHODS : constructor,
                            get_all_files,
                             validate_site.
    *-- Private Section declaration
       PRIVATE SECTION.
             METHODS : clear_and_refresh,
                                display_output.
    ENDCLASS.                 
    *** class declaration,  create instance for the class
    DATA: gv_data     TYPE REF TO lcl_build_data.
    INITIALIZATION.
    *** Create class object. Constructor method will be called to Refresh
    *** and Clear all internal tables and Work areas
       CREATE OBJECT gv_data.
    *                    AT SELECTION-SCREEN             *
    AT SELECTION-SCREEN ON s_vkbur.
    *** Sales Office validation
       CALL METHOD gv_data->validate_site.
    *                START-OF-SELECTION                    *
    START-OF-SELECTION.
    *** Get the list of all files from unix dir.
       CALL METHOD gv_data->get_all_files.

    Since you are using the same object for your Selection screen related events, AT SELECTION-SCREEN, you would have to instantiate the object in the INITIALIZATION event. If your object usage is just for the data - In case you use the MVC design pattern, you should push back the object creation in START-OF-SELECTION.
    Regards,
    Naimesh Patel

  • INITIALIZATION event of Tabstrips in Selection screens

    Hello all.
    I created a selection screen with 6 tabs. Each tab is a "standalone" transaction with it's own logic (i.e. tab1 will execute form 1, tab2 will execute form 2 and so on).
    In the end each tab will display an ALV report.
    The problem: after the display of the ALV or if no data was found (an error msg. is displayed), the screen goes through the INITIALIZATION event and the tabs are reset again into the first (default) tab. So if the user in in tab4 and no data was displayed - he get's the error msg. and the selection screen displays tab1 again. All the selection data the user has entered into tab4 is still kept in tab4.
    Is there a way to bypass the INITIALIZATION event or control the activetab?
    Thanks and regards...

    May be to each subscreen you have given the First screen as next screen, that is why this is happening.....
    change the screen numebr of next screen of subscreen to itself.. then u should not get this error
    Regards.....

  • What is the specific use of initialization event

    hi experts
    pls tell me what is the specific use of initialization other than providing default values to selection-screen variables.
    thanks in advance

    Hi
    Initialization event is used to assign some default values to the selection screen fields before it is displayed.
    You can assign default values in this event and use.
    select-options: s_kunnr for kna1-kunnr.
    Initialization:
    s_kunnr-low  = '0001674659'.
    s_kunnr-sign  = 'I'
    s_kunnr-option  = 'BT'
    s_kunnr-high  = '0001675999'.
    append s_kunnr.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Initialize event happens twice when using setDynamic

    Hi.
    I'm using WD Java, EP 7 SP 14 and Designer 8.
    I have a form with a table, and in the initialize event I add a row to the table using the addInstance() method.
    I also set the document to be dynamic using the setDynamic method of the class IWDPDFDocumentInteractiveFormContext, in the method wdDoModifyView.
    Then, when I run the form, there are 2 rows added to the table.
    But when I don't use the setDynamic method, only one row is added (as it should be).
    Is there a chance that using the setDynamic method calls the Initialize event twice?
    I'll be thankful if anyone can try this, so I would know if that's a general problem, or if it happens only to me.
    Best regards,
    Udi.

    Hi Udi,
    I donu2019t think the setDynamic() method would trigger the initialize event (I could be wrong though).  The case could be that your Initialize code is only getting triggered when you use the setDynamic() method, and the One table row is always there by default! 
    Try putting some code in your initialize method for debugging:
    xfa.host.messageBox("initializing form...");
    See how many times this message pops up!
    Just a suggestionu2026
    Hope this helps,
    Harman

  • Examples for Initialization event

    can any one give some examples for initialization event
    with regards
    nagaraj
    Moderator Message: Basic question. Thread locked.
    Edited by: Suhas Saha on Nov 8, 2011 12:56 PM

    Hi,
    plz search..

  • Extending Reader Rights causing Initialize event to fire twice?

    I have a few drop-down boxes populated by scripts on their respective Initialization events. Everything worked great through development--except, when I demonstrated the form for a group, I noticed the drop-down boxes were populating twice. I wasn't using a clearItems()--shouldn't have needed it, right?
    So, this was something I couldn't reproduce in Desiger. Once the the Extended Rights had been removed, the form performed as expected in Acrobat, and Reader, too. Put the Extended Rights back on, and the drop-down boxes are double populating again. Take the Extended Rights off, no misbehaving, everythings fine. Extended Rights on, bad doggie, no biscuit!!
    Now, obviously I can get past this by using clearItems(), or moving the scripts to preOpen. However, I'd like to know what the heck is causing this? Is this a bug? a known issue? or is it something caused by something somewhere else in the form? I have always assumed forms would behave the same with or without Extended Rights. But it looks very much like the Initialize event is firing twice upon opening with Extended Rights.
    Any insights out there?
    Thanks,
    Stephen

    Hi Stephen,
    I have come across this before and thought I had a "proper" answer, but I can't find it. I think that when reader enabling rights are applied by Acrobat the the form does a check as part of the opening process. There appears to be a bunch of events that fire twice when the form is reader enabled (in Acrobat - I can't test if the form is enabled in LC RE ES2).
    Here is an example showing how, when and in what order, events fire.  The form is at the end of the post (at http://cookbooks.adobe.com/post_How_often_events_fire_and_their_sequence-16547.html). There are 13 objects in the form, whose events are tracked.
    When the form is not enabled the start up looks like this (certain events firing once as expected):
    When I apply the reader enabling rights through Acrobat, the firing of events doubles for:
    initialise;
    form:ready;
    layout:ready
    IndexChange;
    docReady.
    One indicator of what is potentially happening is that in the RE version the preSave event fires (but not postSave event).
    Not the full answer - just an indication.
    Good luck,
    Niall

  • Better to call HTTPService send() in creationComplete or initialize event handler???

    I'm wondering if, in general, it is better to call the send()
    method for HTTPService in the creationComplete event handler, or if
    there is any advantage to calling send() in the initialize event
    handler.

    "Greg Lafrance" <[email protected]> wrote in
    message
    news:gm80e7$n6c$[email protected]..
    > I'm wondering if, in general, it is better to call the
    send() method for
    > HTTPService in the creationComplete event handler, or if
    there is any
    > advantage
    > to calling send() in the initialize event handler.
    I think that depends on how much stuff your program has to
    build, and
    whether you're doing anything in the result handler that
    might depend on
    having things ready (and if your HTTPService is set up in
    MXML, it's
    probably not ready for you to be able to send anyway).

  • How to set default values in initialization event for select option

    Abapers,
    I have 3 GL account like 0024831231,0024831238,0024831245.
    Please help me how to set default values in select-options ( s_hkont ) in INTIALIZATION event
    Thanks

    Select option is table <Structure> with fields, low, high, sign & option
    you need to append the value into the select option, with appropriate value in low or
    example:
    S_HKONT-low  = <value>
    S_HKONT-SIGN = 'I'
    S_hkont-OPTION = 'EQ'
    append s_hkont.
    Default value for select-option also can be added directly in select-option statement.
    Regards,
    Mahesh

  • Setting the focus to a text field on a subform in the form initialize event.

    I have a form that checks the rawValue of a text field to determine whether or not the focus should be set on a particular text field. Here is the logic:
    if(txtEmailVisible.rawValue == "visible")
    frmEmailData.presence = "visible";
    xfa.host.setFocus(xfa.form.NEDA.main.frmEmailData.txtEmailBody);
    else
    frmEmailData.presence = "hidden";
    For some reason the focus isn't going to that object, instead it is still going to the first field in the tabbing order. Am I calling this in the wrong event, which is causing the tabbing order to over ride my setFocus call?
    Thanks,
    Chad

    Try using setTimeout for this from the DocReady event.
    app.setTimeout("xfa.host.setFocus(xfa.form.NEDA.main.frmEmailData.txtEmailBody);
    ", 250);
    There are several occasions where code must be executed after init/formReady/DocReady, etc. has been completed. This is one of them.

  • Bug: RichTextEditor "Initialize" not classed as event handler

    I'm trying to load the RichTextEditor control in a popup window. Here's my code:
    var rte:RichTextEditor = new RichTextEditor();
    rte.width   =  600;
    rte.height  =  500;
    rte.title   =  'Edit Text';
    I need to add the initialize event handler so I can add a button to the toolbar (as per the example on the Adobe website).
    However, when I type:
    rte.initialize  =  "addSaveButton()";
    Flash Builder says this is invalid as "initialize" is actually a function and doesn't accept any parameters.
    Compare this with:
    <mx:RichTextEditor initialize="addSaveButton()"/>
    Flash Builder recongises "initialize" as an event handler and therefore accepts the addSaveButton() function.
    Can anyone else confirm whether this is a bug with the SDK or not? I can simply add the button outside of the RTE for now, but then I'd have to wrap the RTE in a separate panel to accomodate the button, which isn't ideal.
    Thanks in advance.

    Hi,
    this is how to add the event listener
    rte.addEventListener(FlexEvent.INITIALIZE,addSaveButton);
    David.

  • Disadv. of intializing date field in any events other than INITIALIZATION

    hi,
    Disadvantages while initializing date field in any events other than INITIALIZATION event?
    regards,
    prajwala

    Hi D,
    I could reporduce but not sure why.  As a workaround, we can set the "AllItems.aspx" view (with a large value of "Item Limit") as default view for Calendar list, then the Docuemnt lookup column should lookup all events.
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Daniel Yang
    TechNet Community Support

Maybe you are looking for

  • Automatic variable Change of the Place item on a action

    I'm begining in the scripting area, but I'm lost realy.  I looking in a way to change the place automatic based on the filename/ folder. Today I do like this: I'm aplying a image in the back of a photo with automate batch. My actions goes in resume l

  • Change visible property of iView assigned to page

    Hi, When we add an iView to a page, we have some properties like visible, fixed,etc. mentioned along with each iView. Now, I want to change the visible property dynamically using pdk development. How can we achieve this? Regards, Khushboo

  • HT5070 why hasn't the last episode of futurama become available

    Is anyone else having this issue? I purchased season 10 of Futurama. Although I received the email stating that the new episode was available for dl, I had to use the email link to dl it. When I checked for available dl's in iTunes, it would state th

  • Clusterware problem

    We had problems on clusterware and the clusterware is not coming up after reboot. We checked all possibilities. Tested everything.. vote disk,ocr,vip,pub ip etc. We have a SR with Oracle, and no solution yet. it is a 2 node RAC on 11gR1 on Linux. Loo

  • Two finger secondary click not working!

    I have a 15" Macbook Pro with Retina. Brand new as of December 2012- I have searched everywhere for a solution to this! I have solved the problem only for a few minutes at a time by entering a short script into terminal, but nothing has worked perman