ALV  ONF4 event

Hi All,
I have used the ALV onF4 event for F4 help for a field in an ALV display....But the problem is that this is not getting triggered on pressing F4.....
What might be the problem..
I have referred the program : BCALV_EDIT_08.
-SatyaPriya

Hi ,
  Please check whether you have created the class to handle events and also set the handlers for it.
Regards
Arun

Similar Messages

  • How to use the ONF4 event in REUSE_ALV_GRID_DISPLAY?

    I am able to use the methods for BUTTON_CLICK and HOTSPOT_CLICK for a report that outputs ALV Grid using REUSE_ALV_GRID_DISPLAY.
    But I am not able to trigger the ONF4 event.
    How to enable this?
    Thanks,

    hi look at the code ...may be helpful for u..
    TYPE-POOLS SLIS.
    DATA: BEGIN OF T_OUT_FOR_F4 OCCURS 0,
            BUKRS LIKE T001-BUKRS,
            BUTXT LIKE T001-BUTXT,
          END   OF T_OUT_FOR_F4.
    PARAMETERS: P_BUKRS TYPE BUKRS.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS.
      PERFORM F4_FOR_BUKRS.
    *&      Form  F4_FOR_BUKRS
          text
    -->  p1        text
    <--  p2        text
    FORM F4_FOR_BUKRS.
      DATA: IT_FIELDCAT TYPE  SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
            IT_REPORT   TYPE  SY-REPID,
            ES_SELFIELD TYPE  SLIS_SELFIELD.
    Get data
      SELECT BUKRS BUTXT FROM T001 INTO TABLE T_OUT_FOR_F4
      WHERE BUKRS = '0001' OR BUKRS = 'US01'.
    Get field
      IT_REPORT = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME     = IT_REPORT
                I_INTERNAL_TABNAME = 'T_OUT_FOR_F4'
                I_INCLNAME         = IT_REPORT
           CHANGING
                CT_FIELDCAT        = IT_FIELDCAT[].
      LOOP AT IT_FIELDCAT.
        IT_FIELDCAT-KEY = SPACE.
        IF IT_FIELDCAT-FIELDNAME = 'BUTXT'.
          IT_FIELDCAT-KEY = 'X'.
        ENDIF.
        MODIFY IT_FIELDCAT.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
        EXPORTING
        I_TITLE                       =
        I_SELECTION                   = 'X'
        I_ZEBRA                       = ' '
        I_SCREEN_START_COLUMN         = 0
        I_SCREEN_START_LINE           = 0
        I_SCREEN_END_COLUMN           = 0
        I_SCREEN_END_LINE             = 0
        I_CHECKBOX_FIELDNAME          =
        I_LINEMARK_FIELDNAME          =
        I_SCROLL_TO_SEL_LINE          = 'X'
          I_TABNAME                     = 'T_OUT_FOR_F4'
        I_STRUCTURE_NAME              =
          IT_FIELDCAT                   = IT_FIELDCAT[]
        IT_EXCLUDING                  =
        I_CALLBACK_PROGRAM            =
        I_CALLBACK_USER_COMMAND       =
        IS_PRIVATE                    =
        IMPORTING
          ES_SELFIELD                   = ES_SELFIELD
        E_EXIT                        =
        TABLES
          T_OUTTAB                      = T_OUT_FOR_F4
       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.
      ELSE.
        READ TABLE T_OUT_FOR_F4 INDEX ES_SELFIELD-TABINDEX.
        P_BUKRS = T_OUT_FOR_F4-BUKRS.
      ENDIF.
    ENDFORM.                    " F4_FOR_BUKRS

  • Cl_gui_alv_grid onf4 event handler

    Has anyone got a nice, tight, example of an ONF4 event handler using CL_GUI_ALV_GRID that they'd be willing to share?
    I'm trying to figure out the example in BCALV_EDIT_08. But, it's very difficult to follow.
    If BCALV_EDIT_08 is indicative of how much work you have to do to enable this event ... phew, that's a lot of code you have to enter just for this 'simple' task.

    Hi,
    Try this one
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.
      PERFORM f230_value_request.
    FORM f230_value_request.
      DATA:  lv_exit        TYPE c,
               lw_variant    LIKE w_variant.
      w_variant-report   = sy-repid.
      w_variant-username = sy-uname.
    Invoke function to provide drop down entries
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant    = w_variant
                i_save        = c_a
           IMPORTING
                e_exit        = lv_exit
                es_variant    = lw_variant
           EXCEPTIONS
                not_found     = 1
                program_error = 2
                OTHERS        = 3.
      IF sy-subrc IS INITIAL.
        IF lv_exit IS INITIAL.
          p_layout = lw_variant-variant.
        ENDIF.
      ELSE.
        MESSAGE i037. "'No layouts found'
      ENDIF.
    ENDFORM.                    " f230_value_request
    Thanks & Regards,
    Judith.

  • In ALV End_of_list Event  Scrolling Option

    Hi Experts,
    In ALV END_OF_LIST Event if I want to display more records approx:50 .
    iam able to display using Reuse_Alv_Commentary_Write But .Due to high volume of Records Its Overlaping Main List  I need to drag Manually.
    My Question : is There any option where Scrolling is Available for Reuse_Alv_Commentary.
    Thank You.Please Reply.

    Hi,
    Use do_sum = 'X', in the fieldcatalog for the fields for which you need to do the summation.
    Best Regards,
    Durga Naresh Bayireddy

  • ALV Print event in Custom Button

    Hi,
    I have requirement to call ALV print event in Custom Button after some condition. Can anyone give me the solution or link to achieve this requirement.
    Thank in advance.

    Hi Mani,
    On that ALV button event, write the following code.
      DATA lo_component TYPE REF TO if_wd_component.
      DATA lo_appl      TYPE REF TO if_wd_application.
      lo_component = wd_comp_controller->wd_get_api( ).
      lo_appl      = lo_component->get_application( ).
      lo_appl->print_page( ).
      DATA lo_app_info TYPE REF TO if_wd_rr_application .
      lo_app_info = lo_appl->get_application_info( ).
      DATA lv_app_name TYPE string .
      lv_app_name = lo_app_info->get_name( ).
    It helps you to print the table contents. Hope this helps you.
    Thanks
    KH

  • Wrong messagetype while processing in an alv grid event

    Hello,
    a brief discription of my problem:
    I am processing a standard SAP form "PERIODE_PRUEFEN" which calls the function "READ_CUSTOMIZED_MESSAGE". The routine is called inside an event-handler of the ALV Grid event 'user_command'. The messagetype is selected from a customising table 'T100C'. Despite the messagetype 'W' the program is always aborted with an 'E' message.
    What I have tried so far:
    1. I debugged the SAP standard transaction 'fb08' which runs exactly the same functions with the same values and it works.
    2. I changed the messagetype in the debugger - no success
    3. I searched the SAP notes, but theres nothing about my problem
    I guess the problem is somewhere in the ALV Grid event, because this is the only difference between the SAP standard an my program. Maybe the message is processed wrong while beeing called within an event.
    It would be great to get some useful hints to solve this problem

    Hi,
    The ABAP runtime environment handles messages according to the type declared in the MESSAGE statement and the context in which the message was sent.
    The behaviour of message type 'W' in a dialog is different from a report program.
    Run demo program DEMO_MESSAGES, select Main Program, Type 'W' and execute. You will get an error message instead of warning message.
    This behaviour is well documeneted in the on-line help for MESSAGE statement.
    Regards,
    Rao A

  • Drop Down List in ALV with Event handler

    Hi All ,
    I have created an ALV grid with a dropdown as one of the columns. This all works fine, except that I want to be able to react to a change in the value of each line's dropdown the next column values should change according to the user selection in the 1st column .
    Is this possible?
    As an example, I have a table of records with one column as a dropdown called " Replace Function Module "   and in 2nd column i have call function of that Replace Function Module , If a  change in " Replace Function Module " should change the call function of in the 2nd column .
    I am using these objects lvc_t_drop , lvc_s_drop and  the method  " set_drop_down_table ",
    Please Can any 1 tel me how to do this with any event handler ar any other way !

    Hi,
    You need to use event handler for this. Check if the below link gives some direction.
    [http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]
    I guess you should create a method inside which you call the FM using the FM name from the selected cell in ALV.
    I have not tried it out, but its worth a try.
    Hope this helps!
    Regards,
    Saumya

  • ALV Tree event registration doesn't work

    Hello Experts,
    the following is the registration-form which shall register a item-double-click event to my alv-tree-object. when doing the double-click it doesn't open my own methods in the event-handler class but the standard ones and nothing happens further.
    Any ideas?
    Many thanks in advance!
    Tobias
    FORM register_events.
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
      CALL METHOD g_alv_tree->get_registered_events
        IMPORTING
          events = lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
      APPEND l_event TO lt_events.
      CALL METHOD g_alv_tree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
      CREATE OBJECT event_handler.
      SET HANDLER event_handler->handle_item_double_click FOR g_alv_tree.
    ENDFORM.

    It doesn't matter where I place my double-click. The standard event handling "handle_event" is called.
    Instead of this I would like to have my coding.....
    Changing the cl_gui_alv_tree to cl_gui_column_tree doesn't work since my tree isn't a reference of column_tree but of alv_tree. So I would have to rebuild nearly the entire tree. This cannot be a solution since I guess the double-click item should work anyway.
    What I am wondering furthermore is my button declaration not being displayed. The following is my fieldcatalog declaration:
    FORM create_tree_fc.
      DATA: ls_fc TYPE lvc_s_fcat.
      DATA: lo_descrref   TYPE REF TO cl_abap_typedescr.
      DATA: lo_tableref TYPE REF TO cl_abap_tabledescr.
      DATA: lo_structref TYPE REF TO cl_abap_structdescr.
      FIELD-SYMBOLS: <fs_str> TYPE abap_compdescr.
      lo_tableref ?= cl_abap_tabledescr=>describe_by_data( lt_report_tree ).
      lo_descrref ?= lo_tableref->get_table_line_type( ).
      lo_structref ?= lo_descrref.
      CLEAR gt_fc[].
      LOOP AT lo_structref->components ASSIGNING <fs_str>.
        CLEAR ls_fc.
        ls_fc-fieldname = <fs_str>-name.
        ls_fc-intlen = <fs_str>-length.
        ls_fc-inttype = <fs_str>-type_kind.
        ls_fc-decimals = <fs_str>-decimals.
        CASE <fs_str>-name.
          WHEN 'PROCESS_TYPE'.
            ls_fc-tooltip = 'Process Type'.
            ls_fc-coltext = 'Process Type'.
            ls_fc-emphasize = 'C110'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = cl_gui_column_tree=>item_class_button.
            ls_fc-outputlen = 20.
          WHEN 'SMI_PROJECT'.
            ls_fc-tooltip = 'Project Relation'.
            ls_fc-coltext = 'Project'.
            ls_fc-hotspot = 'X'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
            ls_fc-outputlen = <fs_str>-length.
          WHEN 'TRORDER_NUMBER'.
            ls_fc-tooltip = 'ID of Transport Request'.
            ls_fc-coltext = 'Transport Request'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = CL_GUI_ALV_GRID=>MC_STYLE_HOTSPOT.
            ls_fc-outputlen = 30.
        ENDCASE.
        APPEND ls_fc TO gt_fc.
      ENDLOOP.
    ENDFORM.
    Edited by: Tobias Fickinger on Jun 10, 2009 9:59 AM
    Edited by: Tobias Fickinger on Jun 10, 2009 10:00 AM
    Edited by: Tobias Fickinger on Jun 10, 2009 10:03 AM

  • Capturing the ALV Grid Event

    Hi Experts,
    I am working on ALV Grid , Data is Displayed in Grid well , But Can Any one please tell me how can i capture the event (back,exit and cancel) which is persent on standard toolbar on ALV Gried output .
    Rgds,
    Premraj

    Hello PremRaj ,
    Please find an dummy program to capture the events below:
    TYPE-POOLS slis.
    DATA: ITAB_EVENTS TYPE slis_t_event,
          WA_EVENTS TYPE SLIS_ALV_EVENT.
    DATA: IT_END TYPE SLIS_T_LISTHEADER,
          WA_END TYPE SLIS_LISTHEADER.
    ** This function module will get all the events present in alv into internal table itab_events*
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = ITAB_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.
    ** With this read table statement itab_events is read for the desired event*+
    READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.
      wa_eventS-form = 'END'.
      MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.
      CLEAR wa_eventS.
    *Pass the ITAB_EVENTS created in this Function Module
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
        IT_EVENTS                         = ITAB_EVENTS
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER           =
       ES_EXIT_CAUSED_BY_USER            =
       TABLES
         t_outtab                          = it_tab
    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.
    *READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.
    wa_eventS-form = 'END'.
    MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.
    CLEAR wa_eventS.
    *in these statements ,the second line will automatically try to call subroutine with name end.
    FORM END.
    WA_END-TYP = 'S'.
    WA_END-KEY = TEXT-004.
    WA_END-INFO = SY-DATUM.
    APPEND WA_end TO IT_END.
    CLEAR WA_END.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = IT_END
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    Hope it helps you.
    Thanks Mansi
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 11:02 AM
    Edited by: MANSI  ASNANI on Jan 9, 2009 7:31 AM

  • ALV F8 event + Checkbox?

    Hi,
    1. How to catch F8 event in an ALV?
    2. How to determine witch checkbox is checked.
    tnx!
    Simple ALV example:
    TYPE-POOLS: slis.
    DATA: g_repid LIKE sy-repid,
    gs_print            TYPE slis_print_alv,
    gt_list_top_of_page TYPE slis_t_listheader,
    gt_events           TYPE slis_t_event,
    gt_sort             TYPE slis_t_sortinfo_alv,
    gs_layout           TYPE slis_layout_alv,
    gt_fieldcat         TYPE slis_t_fieldcat_alv,
    fieldcat_ln LIKE LINE OF gt_fieldcat,
    col_pos TYPE i.
    DATA: BEGIN OF itab,
    sel,
      field1(5) TYPE c,
      field2(5) TYPE c,
      field3(5) TYPE p DECIMALS 2,
    END OF itab.
    DATA: BEGIN OF itab1 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA: END OF itab1.
    DATA: BEGIN OF itab_fieldcat OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA: END OF itab_fieldcat.
    INITIALIZATION.
      g_repid = sy-repid.
    " PERFORM print_build    USING gs_print.      "Print PARAMETERS
      gs_layout-box_fieldname = 'SEL'.
    START-OF-SELECTION.
    * TEST DATA
      MOVE 'TEST1' TO itab1-field1.
      MOVE 'TEST1' TO itab1-field2.
      MOVE '10.00' TO itab1-field3.
      APPEND itab1.
      MOVE 'TEST2' TO itab1-field1.
      MOVE 'TEST2' TO itab1-field2.
      MOVE '20.00' TO itab1-field3.
      APPEND itab1.
      DO 5 TIMES.
        APPEND itab1.
      ENDDO.
    END-OF-SELECTION.
      PERFORM build.
      PERFORM call_alv.
    *&      Form  BUILD
    *       text
    FORM build.
    * DATA FIELD CATALOG
    * Explain Field Description to ALV
      DATA: fieldcat_in TYPE slis_fieldcat_alv.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname = 'FIELD1'.
      fieldcat_ln-tabname   = 'ITAB1'.
    *FIELDCAT_LN-NO_OUT    = 'X'.  "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
      fieldcat_ln-key       = ' '.   "SUBTOTAL KEY
      fieldcat_ln-no_out    = ' '.
      fieldcat_ln-seltext_l = 'HEAD1'.
      APPEND fieldcat_ln TO gt_fieldcat.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname = 'FIELD2'.
      fieldcat_ln-tabname   = 'ITAB1'.
      fieldcat_ln-no_out    = 'X'.
      fieldcat_ln-seltext_l = 'HEAD2'.
      APPEND fieldcat_ln TO gt_fieldcat.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname     = 'FIELD3'.
      fieldcat_ln-tabname       = 'ITAB1'.
      fieldcat_ln-ref_fieldname = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
      fieldcat_ln-ref_tabname   = 'MSEG'.  "<- REF TABLE IN THE DICTIONNARY
      fieldcat_ln-no_out        = ' '.
      fieldcat_ln-do_sum        = 'X'.   "SUM UPON DISPLAY
      APPEND fieldcat_ln TO gt_fieldcat.
    * DATA SORTING AND SUBTOTAL
      DATA: gs_sort TYPE slis_sortinfo_alv.
      CLEAR gs_sort.
      gs_sort-fieldname = 'FIELD1'.
      gs_sort-spos      = 1.
      gs_sort-up        = 'X'.
      gs_sort-subtot    = 'X'.
      APPEND gs_sort TO gt_sort.
      CLEAR gs_sort.
      gs_sort-fieldname = 'FIELD2'.
      gs_sort-spos      = 2.
      gs_sort-up        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
      APPEND gs_sort TO gt_sort.
    ENDFORM.                    "BUILD
    *&      Form  CALL_ALV
    *       text
    FORM call_alv.
    * ABAP List Viewer
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
      i_callback_program = g_repid
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_USER_COMMAND = ' '
      i_structure_name = 'ITAB1'
      is_layout =  gs_layout
      it_fieldcat = gt_fieldcat[]
        it_sort = gt_sort[]
        it_events = gt_events[]
        is_print = gs_print
      TABLES
      t_outtab = itab1
      EXCEPTIONS
      program_error = 1
      OTHERS = 2.
    ENDFORM.                    "CALL_ALV

    Hi,
    stil not working..:(
    Please, could you use my code and fil up with yours?
    TYPE-POOLS: slis.
    DATA: g_repid LIKE sy-repid,
    gs_print            TYPE slis_print_alv,
    gt_list_top_of_page TYPE slis_t_listheader,
    gt_events           TYPE slis_t_event,
    gt_sort             TYPE slis_t_sortinfo_alv,
    gs_layout           TYPE slis_layout_alv,
    gt_fieldcat         TYPE slis_t_fieldcat_alv,
    fieldcat_ln LIKE LINE OF gt_fieldcat,
    col_pos TYPE i.
    DATA: BEGIN OF itab,
    sel,
      field1(5) TYPE c,
      field2(5) TYPE c,
      field3(5) TYPE p DECIMALS 2,
    END OF itab.
    DATA: BEGIN OF itab1 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA: END OF itab1.
    DATA: BEGIN OF itab_fieldcat OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA: END OF itab_fieldcat.
    INITIALIZATION.
      g_repid = sy-repid.
      " PERFORM print_build    USING gs_print.      "Print PARAMETERS
      gs_layout-box_fieldname = 'SEL'.
    START-OF-SELECTION.
    * TEST DATA
      MOVE 'TEST1' TO itab1-field1.
      MOVE 'TEST1' TO itab1-field2.
      MOVE '10.00' TO itab1-field3.
      APPEND itab1.
      MOVE 'TEST2' TO itab1-field1.
      MOVE 'TEST2' TO itab1-field2.
      MOVE '20.00' TO itab1-field3.
      APPEND itab1.
      DO 5 TIMES.
        APPEND itab1.
      ENDDO.
      gs_layout-get_selinfos = 'X'.
    END-OF-SELECTION.
      PERFORM build.
      PERFORM call_alv.
    *&      Form  BUILD
    *       text
    FORM build.
    * DATA FIELD CATALOG
    * Explain Field Description to ALV
      DATA: fieldcat_in TYPE slis_fieldcat_alv.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname = 'FIELD1'.
      fieldcat_ln-tabname   = 'ITAB1'.
    *FIELDCAT_LN-NO_OUT    = 'X'.  "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
      fieldcat_ln-key       = ' '.   "SUBTOTAL KEY
      fieldcat_ln-no_out    = ' '.
      fieldcat_ln-seltext_l = 'HEAD1'.
      APPEND fieldcat_ln TO gt_fieldcat.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname = 'FIELD2'.
      fieldcat_ln-tabname   = 'ITAB1'.
      fieldcat_ln-no_out    = 'X'.
      fieldcat_ln-seltext_l = 'HEAD2'.
      APPEND fieldcat_ln TO gt_fieldcat.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname     = 'FIELD3'.
      fieldcat_ln-tabname       = 'ITAB1'.
      fieldcat_ln-ref_fieldname = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
      fieldcat_ln-ref_tabname   = 'MSEG'.  "<- REF TABLE IN THE DICTIONNARY
      fieldcat_ln-no_out        = ' '.
      fieldcat_ln-do_sum        = 'X'.   "SUM UPON DISPLAY
      APPEND fieldcat_ln TO gt_fieldcat.
    * DATA SORTING AND SUBTOTAL
      DATA: gs_sort TYPE slis_sortinfo_alv.
      CLEAR gs_sort.
      gs_sort-fieldname = 'FIELD1'.
      gs_sort-spos      = 1.
      gs_sort-up        = 'X'.
      gs_sort-subtot    = 'X'.
      APPEND gs_sort TO gt_sort.
      CLEAR gs_sort.
      gs_sort-fieldname = 'FIELD2'.
      gs_sort-spos      = 2.
      gs_sort-up        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
      APPEND gs_sort TO gt_sort.
    ENDFORM.                    "BUILD
    *&      Form  CALL_ALV
    *       text
    FORM call_alv.
    * ABAP List Viewer
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
      i_callback_program = g_repid
    * I_CALLBACK_PF_STATUS_SET = ' '
      i_callback_user_command = 'form_user'
      i_structure_name = 'ITAB1'
      is_layout =  gs_layout
      it_fieldcat = gt_fieldcat[]
      it_sort = gt_sort[]
      it_events = gt_events[]
      is_print = gs_print
      TABLES
      t_outtab = itab1
      EXCEPTIONS
      program_error = 1
      OTHERS = 2.
    ENDFORM.                    "CALL_ALV
    *&      Form  form_user
    *       text
    FORM form_user.
      CASE sy-ucomm.
        WHEN 'ENTER' OR 'SPACE'.                                " for F8
    ***do coding
      ENDCASE.
    ENDFORM.                    "form_user

  • ALV Grid: event for user return in ALV Grid Control

    Hi developers,
    i'm wanna do something after a user has pressed the return button in a alv grid control. For that i need probably a event. But i can not find a proper event in the documentation. Could one of you guys help me?
    Best regards christian

    Hi Christian
    ALV grid is an encapsulated object, so it seems there is no way, you ought to implement the data_changed event. So if you want to make bulk data input and after trigger the event by pressing the return key, you should make the ALV Grid get your changes after pressing the key but not after a cell change of a modified cell.
    To set this attribute:
    CALL METHOD gr_alvgrid->register_edit_event
         EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter .
    This way "data_changed" event will be triggered whenever you press the return key while editing.
    For some more information you can also refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference for ALV Grid Control"</a>.
    Regards
    *--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

  • ALV GRID - EVENT HANDLING

    Hi all,
       Please let me know how to hanldle  event handling , making a cell in editable mode ,double click and hotspot creation,colorign a single cell,calling a transatcion when clicked on hotspot in a alv grid display program (not using OO   concepts).
    Looikng forward for a positive response.
    Reagrds,
    Mohinder.

    Hi,
    You can create your own custom status and asign it to your
    ALV GRID. Here is a sample code to add custom status and handling events.
    http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • ALV OO - event receiver issue

    Hi,
    in my ALV 00 program i have several simular ALV grids (with the same layout, fieldcat etc). The handling of the double click event in the different ALV grids is handled by different event receivers ( but type ref to the same event handler class).
    How can i see in the general event handler class, which event receiver reference has raised the event, so on which alv grid was the double click !
    As i said the ALV grids are lookalike, but only the data is different. So for the double click event i should read different data tables.
    Any one a solution ?
    regards,
    Hans

    Hi,
    you should have different event reciever. to respond the different grids to show the different grids....
    regards
    vijay

  • Reg ALV Hyperlink event handling in WDA

    Hi,
    I am using one ALV for Invoice in WDA. There in that ALV, column containing VBELN has been defined as Hyperlink. On clicking of VBELN, detail about that should be opened up as PDF.
    So far, this is working. But, my problem is, if once VBELN has been selected, next clicking does not pass diff VBELN.
    I need to know how can I handle  clicking on diff VBELN in my Invoice ALV?
    If there is anything like clear or refresh, that need to be invoked in Afteraction or Beforeaction or WdModifyView...?
    Or is there a syntax like
    wdContext.currentContextElement().setSpace(" ");
    for getElement( ) also...?
    Thanks.
    Kumar Saurav.
    Edited by: Kumar Saurav on Feb 5, 2010 8:55 AM

    Hi Arjun,
    I followed and implemented this line --
    In the DISPLAYPDF method, create a parameter ln_vbeln ref to vbeln.
    Now,
    Now when you call this method in the ON_CLICK event handler (use the help of code wizard to call the method),
    So, why should I call this method in ON_CLICK Event Handler?
    In ON_CLICK Method, this is my code that is being generated using Wizard --
    LO_EL_VBRKTAB_2->GET_ATTRIBUTE(
          EXPORTING
            NAME =  `VBELN`
          IMPORTING
            VALUE = LV_VBELN ).
    In addition, I am just firing the Plug to call View that has PDF Container - InteractiveForm Element.
    And, DISPLAYPDF is a Method defined in ComponentController Method Tab. There, I am employing the logic to fetch the data using Wizard from diff nodes and processing those to give the output from Smartforms as PDF.
    There, I've defined ln_vbeln, but, an error comes stating - ln_vbeln cannot be a table, a reference, a string, or contain any of these objects
    Here, my question is I've defined my steps. Let me do it in numbers--
    1) View for Input defined
    2) View to contain output ALV defined
    3) View to contain PDF defined
    4) Method ON_CLICK defined in second View
    5) Method DISPLAYPDF defined in COMPONENTCONTROLLER's Method Tab
    Now, suggest me what to do and where?
    Thanks.
    Kumar Saurav.

  • How to identify which ALV triggered event in split ALV

    Hi all,
    I'm using a split ALV like this:
    CREATE OBJECT ob_custom
      EXPORTING
        container_name = 'CONTAINER'.
    CREATE OBJECT ob_split1
      EXPORTING
        parent      = ob_custom
        orientation = cl_gui_easy_splitter_container=>orientation_vertical.
    CREATE OBJECT ob_grid1
      EXPORTING
        i_parent = ob_split1->top_left_container.
    CREATE OBJECT ob_grid2
      EXPORTING
        i_parent = ob_split1->bottom_right_container.
    I want to trigger double_click event:
    CREATE OBJECT ob_event.
      SET HANDLER ob_event->handle_double_click FOR ob_grid1.
      SET HANDLER ob_event->handle_double_click FOR ob_grid2.
    The problem is I don't know how to identify in which ALV the user double_clicked.
    Is there solution?
    Thanks in advance

    The trick is (just to help others):
    CLASS lcl_event_receiver1 DEFINITION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver1 IMPLEMENTATION.
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver2 DEFINITION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver2 IMPLEMENTATION.
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    and for data declaration:
    DATA: ob_event1  TYPE REF TO lcl_event_receiver1,
          ob_event2  TYPE REF TO lcl_event_receiver2.
    and then:
    CREATE OBJECT ob_event1.
    SET HANDLER ob_event1->handle_double_click FOR ob_grid1.
    CREATE OBJECT ob_event2.
    SET HANDLER ob_event1->handle_double_click FOR ob_grid2.
    Thanks a lot kiran kumar!
    Edited by: orgasmics on May 11, 2010 1:56 PM

Maybe you are looking for