About double click event in ALV report

Hi all,
I want to program a double-click event in ALV reprot.
I am not suppose to use module pool approach for the same.
If a user double clicks on the any of the row of ALV report, the transaction should get called.
Again, I am using function 'REUSE_ALV_GRID_DISPLAY' for displaying ALV.
Can you please help me to solve this?
Thanks,
-Siddhi

Hi Sidhi,
You can do it easily by using Reuse_ALV_GRID_DISPALY.
The User Command subroutine which you pass to this function module in that you can check which field is selected and what is the value of that and also you can get the table index.
I am giving you a code example where interactivity of ALV report is done .
*& Report  ZRAIL_LOT_REPORT
REPORT  zrail_lot_report.
TABLES :qals,aufk.
TYPE-POOLS:slis.
TYPES:BEGIN OF x_lot,
      sel(1)   TYPE c,                    "SELECTION
      prueflos TYPE qals-prueflos,        "INSPECTION LOT NUMBER
      werk     TYPE qals-werk,            "PLANT
      losmenge TYPE qals-losmenge,        "LOT QUANTITY
      mengeneinh TYPE qals-mengeneinh,   "BASE UNIT OF MEASURE FOR THE INSPECTION LOT QUANTITY
      matnr   TYPE  qals-matnr,          " MATERIAL NO. ATTACHED TO ORDER
      zzequnr  TYPE qals-zzequnr,         "EQUIPMENT NO.
      zzassembly TYPE qals-zzassembly,    "ASSEMBLY
      herkunft  TYPE qals-herkunft,       "INSPECTION LOT ORIGIN
      aufnr     TYPE qals-aufnr,          "ORDER NO.
      sttxt     TYPE qals_d02-sttxt,      "LOT STATUS
      objnr     TYPE qals-objnr,          "OBJECT NUMBER
      enstehdat TYPE qals-enstehdat,      "lot creation date
      pruefer   TYPE qamr-pruefer,        "Name of the Inspector
      END OF x_lot.
TYPES:BEGIN OF x_ordmat,
      aufnr TYPE aufk-aufnr,             "Order No.
      equnr TYPE afih-equnr,             "Equipment No. attached to Order
      zmatnr TYPE aufk-zmatnr,           "Material No. attached to Order
      bautl  TYPE afih-bautl,            "Assembly attached to Order
      END OF x_ordmat.
TYPES:BEGIN OF x_status,
      objnr TYPE jest-objnr,
      stat  TYPE jest-stat,
      txt04 TYPE tj02t-txt04,
      END OF x_status.
DATA:it_qals TYPE STANDARD TABLE OF x_lot,
     wa_qals TYPE x_lot.
DATA:it_ordmat TYPE TABLE OF x_ordmat,
     wa_ordmat TYPE x_ordmat.
DATA:it_status TYPE STANDARD TABLE OF x_status,
     wa_status TYPE x_status.
DATA:mytabix TYPE sy-tabix.
DATA: wa_layout   TYPE slis_layout_alv,
      wa_fieldcat TYPE slis_fieldcat_alv,
      it_fieldcat TYPE TABLE OF slis_fieldcat_alv,
      it_fcat TYPE TABLE OF slis_fieldcat_alv.
DATA:mytabix1 TYPE sy-tabix.
SELECTION-SCREEN BEGIN OF BLOCK  b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_werks FOR qals-werk,
                s_zmatnr FOR aufk-zmatnr,
                s_assbly FOR qals-zzassembly,
                s_equnr FOR qals-zzequnr,
                s_lotor FOR qals-herkunft,
                s_lotdat FOR qals-enstehdat.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
  s_lotdat-low = sy-datum - 7.
  s_lotdat-high = sy-datum.
  APPEND s_lotdat.
START-OF-SELECTION.
  PERFORM get_data_qals.
  PERFORM build_fieldcat.
  PERFORM display_data.
  EXIT.
END-OF-SELECTION.
*&      Form  get_data_qals
      text
-->  p1        text
<--  p2        text
FORM get_data_qals .
  IF it_qals[] IS INITIAL.
    SELECT a~prueflos
           a~werk
           a~losmenge
           a~mengeneinh
           a~zzequnr
           a~zzassembly
           a~herkunft
           a~aufnr
           a~objnr
           a~matnr
           a~enstehdat
           b~pruefer
           FROM qals AS a INNER JOIN qamr AS b
           ON aprueflos = bprueflos
           INTO CORRESPONDING FIELDS OF TABLE it_qals
           WHERE werk IN s_werks
           AND   zzassembly IN s_assbly
           AND   zzequnr    IN s_equnr
           AND   herkunft   IN s_lotor
           AND   enstehdat  IN s_lotdat.
  ENDIF.
  IF it_ordmat[] IS INITIAL.
    SELECT a~aufnr
           a~zmatnr
           b~bautl
           b~equnr
           FROM aufk AS a INNER JOIN afih AS b
           ON aaufnr = baufnr
           INTO CORRESPONDING FIELDS OF TABLE it_ordmat FOR ALL ENTRIES IN it_qals
           WHERE a~aufnr = it_qals-aufnr
            AND zmatnr IN s_zmatnr.
  ENDIF.
  IF it_status[] IS INITIAL.
    SELECT a~objnr
           a~stat
           b~txt04
           FROM  tj02t AS b
           INNER JOIN jest AS a ON bistat = astat
           INTO CORRESPONDING FIELDS OF TABLE it_status FOR ALL ENTRIES IN it_qals
           WHERE a~objnr = it_qals-objnr
           AND   b~spras = sy-langu
           AND   a~inact = space.
  ENDIF.
  LOOP AT it_qals INTO wa_qals.
    mytabix = sy-tabix.
    READ TABLE it_ordmat INTO wa_ordmat WITH KEY aufnr = wa_qals-aufnr.
    IF sy-subrc = 0.
      IF wa_qals-herkunft = '14'.
        wa_qals-matnr = wa_ordmat-zmatnr.
        wa_qals-zzequnr =  wa_ordmat-equnr.
        wa_qals-zzassembly = wa_ordmat-bautl.
        MODIFY it_qals FROM wa_qals INDEX  mytabix TRANSPORTING matnr zzassembly zzequnr.
      ENDIF.
    ENDIF.
    LOOP AT it_status INTO wa_status WHERE objnr = wa_qals-objnr.
      CONCATENATE wa_qals-sttxt wa_status-txt04 INTO wa_qals-sttxt SEPARATED BY space.
      CLEAR :wa_status.
    ENDLOOP.
    MODIFY it_qals FROM wa_qals INDEX  mytabix TRANSPORTING sttxt.
    CLEAR :wa_qals,wa_ordmat,mytabix.
  ENDLOOP.
  IF s_zmatnr[] IS NOT INITIAL.
    DELETE it_qals WHERE matnr IS INITIAL.
  ENDIF.
ENDFORM.                    " get_data_qals
*&      Form  build_fieldcat
      text
-->  p1        text
<--  p2        text
FORM build_fieldcat .
  wa_layout-zebra = 'X'.
  wa_layout-colwidth_optimize = 'X'.
  wa_layout-box_fieldname = 'SEL'.
  wa_layout-box_tabname = 'IT_QALS'.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
   EXPORTING
    I_PROGRAM_NAME               =
      i_internal_tabname           = 'IT_QALS'
      i_structure_name             = 'QALS_D02'
    I_CLIENT_NEVER_DISPLAY       = 'X'
    I_INCLNAME                   =
    I_BYPASSING_BUFFER           =
    I_BUFFER_ACTIVE              =
    CHANGING
      ct_fieldcat                  = it_fieldcat
  IF sy-subrc = 0.
    LOOP AT  it_fieldcat INTO wa_fieldcat.
      CASE  wa_fieldcat-fieldname .
        WHEN  'PRUEFLOS'.
          wa_fieldcat-col_pos = 1.
          wa_fieldcat-hotspot = 'X'.
          APPEND wa_fieldcat TO it_fcat.
        WHEN   'WERK'.
          wa_fieldcat-col_pos = 3.
          APPEND wa_fieldcat TO it_fcat.
        WHEN  'LOSMENGE'.
          wa_fieldcat-col_pos = 4.
          wa_fieldcat-no_out = ''.
          APPEND wa_fieldcat TO it_fcat.
        WHEN  'MENGENEINH'.
          wa_fieldcat-col_pos = 5.
          wa_fieldcat-no_out = ''.
          APPEND wa_fieldcat TO it_fcat.
        WHEN 'ZZEQUNR'.
          wa_fieldcat-col_pos = 6.
          wa_fieldcat-no_out = ''.
          wa_fieldcat-hotspot = 'X'.
          APPEND wa_fieldcat TO it_fcat.
        WHEN  'ZZASSEMBLY'.
          wa_fieldcat-col_pos = 7.
          wa_fieldcat-no_out = ''.
          wa_fieldcat-hotspot = 'X'.
          APPEND wa_fieldcat TO it_fcat.
        WHEN  'HERKUNFT'.
          wa_fieldcat-col_pos = 8.
          APPEND wa_fieldcat TO it_fcat.
        WHEN  'AUFNR'.
          wa_fieldcat-col_pos = 9.
          wa_fieldcat-hotspot = 'X'.
          APPEND wa_fieldcat TO it_fcat.
        WHEN  'ENSTEHDAT'."enstehdat
          wa_fieldcat-col_pos = 10.
          APPEND wa_fieldcat TO it_fcat.
        WHEN  'STTXT'.
          wa_fieldcat-col_pos = 12.
          wa_fieldcat-hotspot = 'X'.
          APPEND wa_fieldcat TO it_fcat.
        WHEN OTHERS.
      ENDCASE.
      CLEAR wa_fieldcat.
    ENDLOOP.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-tabname  =  'IT_QALS'.
    wa_fieldcat-col_pos = 2.
    wa_fieldcat-ref_tabname = 'AUFK'.
    wa_fieldcat-hotspot = 'X'.
    wa_fieldcat-seltext_l = 'Material No.'.
    APPEND wa_fieldcat TO it_fcat.
    wa_fieldcat-fieldname = 'PRUEFER'.
    wa_fieldcat-tabname  =  'IT_QALS'.
    wa_fieldcat-col_pos = 11.
    wa_fieldcat-ref_tabname = 'QAMR'.
    wa_fieldcat-seltext_l = 'Name of the Inspector'.
    APPEND wa_fieldcat TO it_fcat.
  ENDIF.
ENDFORM.                    " build_fieldcat
*&      Form  display_data
      text
-->  p1        text
<--  p2        text
FORM display_data .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
   i_callback_program                = 'ZRAIL_LOT_REPORT'
  I_CALLBACK_PF_STATUS_SET          = ' '
     i_callback_user_command           = 'USER_COMMAND'
     is_layout                         = wa_layout
      it_fieldcat                       = it_fcat
  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        =
    TABLES
      t_outtab                          = it_qals
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.
ENDFORM.                    " display_data
*&      Form  USER_COMMAND
      text
     -->R_UCOMM      text
     -->RS_SELFIELD  text
FORM user_command USING r_ucomm TYPE sy-ucomm  rs_selfield TYPE slis_selfield.
  CASE rs_selfield-fieldname  .
    WHEN 'PRUEFLOS'.
      SET PARAMETER ID 'QLS' FIELD rs_selfield-value.
      CALL TRANSACTION 'QA03' AND SKIP FIRST SCREEN.
    WHEN 'ZZEQUNR'.
      SET PARAMETER ID 'EQN' FIELD  rs_selfield-value.
      CALL TRANSACTION 'IE03' AND SKIP FIRST SCREEN.
    WHEN 'ZMATNR'.
      SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
      CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    WHEN 'ZZASSEMBLY'.
      SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
      CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    WHEN 'AUFNR'.
      SET PARAMETER ID 'ANR' FIELD rs_selfield-value.
      CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
    WHEN 'STTXT'.
      MOVE rs_selfield-tabindex TO mytabix1.
      PERFORM show_status.
  ENDCASE.
ENDFORM.                    "USER_COMMAND
*&      Form  show_status
      text
-->  p1        text
<--  p2        text
FORM show_status .
  DATA:it_systat TYPE TABLE OF bapi2045ss,
       wa_sysstat TYPE bapi2045ss,
       it_bapi2045us TYPE TABLE OF bapi2045us.
  DATA:it_fsys TYPE TABLE OF slis_fieldcat_alv.
  DATA:insplot TYPE bapi2045d_il0-insplot.
  DATA:language TYPE bapi2045la.
  CLEAR wa_qals.
  READ TABLE it_qals INTO wa_qals INDEX mytabix1.
  insplot = wa_qals-prueflos.
  language-langu = sy-langu.
  CALL FUNCTION 'BAPI_INSPLOT_GETSTATUS'
    EXPORTING
      number        = insplot
      language      = language
    TABLES
      system_status = it_systat
      user_status   = it_bapi2045us.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name     = 'ZRAIL_LOT_REPORT'
      i_internal_tabname = 'IT_SYSTAT'
      i_structure_name   = 'BAPI2045SS'
    CHANGING
      ct_fieldcat        = it_fsys.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = 'ZRAIL_LOT_REPORT'
      it_fieldcat        = it_fsys
    TABLES
      t_outtab           = it_systat.
ENDFORM.                    " show_status
IIn the subrouitne the User command the Parameter rs_selfield will give you the selected or clicked field and its value its record no .
I hope this will help you.

Similar Messages

  • Double click event in ALV Display

    Hi
      I am using Reuse_alv_grid_display for dis[playing ALV. Now I want to handle double click event on a perticular Single column.
    Pls provide code.

    Hi,
    Check this example..If you double click on the purchase order field, it will take you to the corresponding PO in ME23N..
    TYPE-POOLS: slis.
    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: BEGIN OF wa_ekko,
    ebeln like ekko-ebeln,
    ekorg like ekko-ekorg,
    ekgrp like ekko-ekgrp,
    END OF wa_ekko.
    DATA: v_repid TYPE syrepid.
    v_repid = sy-repid.
    DATA it_ekko LIKE STANDARD TABLE OF wa_ekko WITH HEADER LINE.
    SELECT * UP TO 100 ROWS
    FROM ekko
    INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
         EXPORTING
              i_program_name     = v_repid
              i_internal_tabname = 'WA_EKKO'
              i_inclname         = v_repid
         CHANGING
              ct_fieldcat        = gt_fieldcat.
    Pass the program.
    v_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
         EXPORTING
              i_callback_program      = v_repid
              it_fieldcat             = gt_fieldcat
              i_callback_user_command = 'USER_COMMAND'
         TABLES
              t_outtab                = it_ekko.
          FORM display_detail                                           *
    -->  UCOMM                                                         *
    -->  SELFIELD                                                      *
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
      IF ucomm = '&IC1' AND selfield-fieldname = 'EBELN'.
        READ TABLE it_ekko INDEX selfield-tabindex.
        IF sy-subrc = 0.
          SET PARAMETER ID 'BES' FIELD it_ekko-ebeln.
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDIF.
    ENDFORM.
    Thanks,
    Naren

  • Double click event in alv oops

    Hi,
    can any one please help me out... i dont know how to call events in alv oops...so can any one provide me with some help..
    My requirment is i have to generate a mail grid containing customer details and if i double click on a customer it should go to the transaction XD03 second screen.....

    u have to declae an event like this.
    class event_receiver definition.
      public section.
        methods handle_double_click
          for event double_click of cl_gui_alv_grid
          importing e_row.
    endclass.
    then u have to implement it in the implementation
    class lcl_event_receiver implementation.
      method lmt_handle_double_click.
        perform double_click using e_row
                                   tbl_final_display.
      endmethod.                   
    endclass.
    form double_click
            using fu_e_row             type lvc_s_row
                  fu_tbl_final_display type typ_tbl_display.
      read table fu_tbl_final_display into l_h_tbl_final_display
                              index fu_e_row-index.
      if sy-subrc = 0.
        set parameter id cns_aun field l_h_tbl_final_display-vbeln.
        call transaction cns_trans and skip first screen.
      endif.
    endform.
    hope it will help u

  • Short dump while on double click event in ALV

    Hi ,
    I have created a ALV screen to display the customer number and NAme ,my requirement is that when i click on the Key field i.e. Customer number it should call the transaction xd03 for that  I have written the following code
    gs_layout-box_fieldname = 'SEL'.
    gs_layout-colwidth_optimize = 'X'.
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program       = gd_repid
       i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
        is_layout                = gs_layout
         it_fieldcat              = fieldcatalog[]
         i_callback_pf_status_set = 'PF_STATUS'
        i_callback_user_command  = 'USER_COMMAND'
      TABLES
        t_outtab                 = t_itab
      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.
    FORM user_command USING r_ucomm LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
          IF rs_selfield-fieldname = 'KUNNR'.
            READ TABLE t_itab INTO w_itab
            WITH KEY kunnr = rs_selfield-value.
            IF sy-subrc = 0.
              SET PARAMETER ID 'KUN' FIELD rs_selfield-value.
              CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
            ENDIF.
          ENDIF.
          CLEAR r_ucomm.
      ENDCASE.
    ENDFORM.                    "user_command
    FORM pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'STANDARD1'.
    ENDFORM.                    "pf_status
    Problem is when i double click on the Customer No field on the ALV ouput i Am getting a Short dump.. "MOVE_TO_LIT_NOTALLOWED_NODATA"..
    How should i overcome this runtime error....
    Thanks in advance,
    Nishant

    >
    Abhii wrote:
    > There was a problem in the SET PARAMETER ID statement.
    > Nishant, Make the code changes I have suggested, you will get the output.
    Either you possess telepathic skills or you are omniscient.
    Before asserting your solution on someone be sure what exactly is the problem. If you check the OP's code, CALL TRANSACTION will be called only when the READ TABLE is successful.
    So how does your solution add benefit to the existing one.
    BR,
    Suhas

  • Double Click Event In ALV Tree

    Hello guys,
    There is a requirement that when I double click on an item in ALV tree it takes me to a standard transaction code.
    Can anyone suggest me how to proceed on this.
    Thanks in Advance.
    Regards,
    Abhinav

    Hi,
    Refer:
    Get cursor field in ALV Tree
    Hope this helps you.
    Regards,
    Tarun

  • Problem in Double click event for ALV.

    Hi experts ,
    My scenario is one ALV is displayed in First screen and after double click  on particular column second screen is displayed with the other ALV.
    I have created 2 custom containers.
    My problem is that for the first double click every thing is fine,then i come back to first screen from second screen when i double click on different item the previous item is displayed which was for the first double click .
    I debugg the program ,  passing of data to the internal table is fine.
    Help me in the problem
    Thanks
    Aisurya

    Hi,
    You have to use refresh_table_dispaly  method to update the values. else it will display the same.
    try this logic
    if  cus_cont is initial.
    o_grid->set_table_for_first_display.
    else.
    o_grid->refresh_table_display.
    endif.,
    check BCALV_GRID_03 standard program for reference.
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • ALV OOPS Double-click event

    Hi,
    I want to handle the double-click event in ALV grid (OOPs).
    The output should be shown in the same fashion as it is shown in SE16 when we double-click on any record in the result set.
    i.e. if you have selected the ALV grid display for the Data browser in SE16 and when you double click on any record, the complete record is shown in a window.
    I want this in my ALV as well..
    Can anyone please suggest how to achieve this?
    Regards
    s.a.k

    Hi siemens.a.k ,
    The solution for the issue would be to create a  custom screen and add a custom table controller in a container.
    In this table controller you map the respective fields required for your output
    Now once you are done with data population in the custom controller for ALV grid display using cl_gui_alv_grid_display class...
    create events in your custom class to handle the on click event.
    If you observe the standard functionality it could be clearly seen that sap has created another screen for the display of records in different view.
    You could also replicate the similar thing by creating another screen and populating the required fields into the second screen.
    As of now i am providing this information ...I would even try to simulate the scenario at my system.
    So once i am done i would update you the same...
    Thanks
    M.Naveen Kumar....

  • In ALV reports how double click event works?

    in ALV reports how double click event works? Explain in detail.....

    hi,
    last lines is used for clicking
    *& Report  Z_SWAS_FUNCTIONAL
    report  z_swas_functional.
    tables: qmel,viqmel,iloa,afko.
    -- global data declerations--
    data: ok_code like sy-ucomm,
          gt_itab type table of zfunctional,
          t_output type table of zfunctional,
          g_container type scrfname value 'CUSTOM_CONTROL',
          grid1  type ref to cl_gui_alv_grid,
          g_custom_container type ref to cl_gui_custom_container,
          e_row type lvc_s_row,
          e_column type lvc_s_col,
          es_row_no type lvc_s_roid.
    *CLASS DECLARATION
    class z_functional definition.
    public section.
    class-methods : handle_double_click
                    for event double_click of cl_gui_alv_grid
                         importing e_row  e_column.
    endclass.
    *CLASS IMPLEMENTATION
    class z_functional implementation.
    method handle_double_click.
           perform handle_double_click using e_row e_column es_row_no.
    endmethod.
    endclass.
    *CODE FOR SELECTION SCREEN
    selection-screen begin of block 84433  with frame title text-t01.
    parameters : n_number like viqmel-qmnum,
                    n_type like qmel-qmart,
                    f_loca like iloa-tplnr,
                    name like qmel-qmnam.
    selection-screen end of block 84433.
                        screen validation event                          *
    at selection-screen on n_number.
      select single *
        from viqmel
          where qmnum eq n_number.
    if sy-subrc ne 0.
      MESSAGE 'NOTIFICATION NUMBER DOESNOT EXIST' TYPE 'E'.
    endif.
    select qmart from qmel into qmel where qmart eq N_TYPE.
    endselect.
    if sy-subrc ne 0.
      MESSAGE 'NOTIFICATION TYPE DOES NOT EXIST' TYPE 'E'.
    endif.
    *START OF SELECTION EVENT
    start-of-selection.
        perform fetchdata.
    end-of-selection.
    *Call screen event
    call screen 100.
    *PERFORM DISPLAY.
    *&      Form  FETCHDATA
          text
    -->  p1        text
    <--  p2        text
    form fetchdata .
    *SELECT VIQMEL~QMNUM VIQMEL~QMTXT VIQMEL~QMDAT VIQMEL~LTRMN VIQMEL~PRIOK
          VIQMELBEZDT VIQMELAUFNR VIQMELTPLNR AFKOGLTRP into corresponding fields of table GT_ITAB
             FROM VIQMEL INNER JOIN AFKO ON VIQMELAUFNR = AFKOAUFNR
                   WHERE VIQMELQMNUM IN N_NUMBER and VIQMELQMART IN N_TYPE AND VIQMEL~QMNAM IN NAME.
    call function 'ZSWAS_TEST'
      exporting
        qmnum         = n_number
       qmart         = n_type
       tplnr         = f_loca
       qmnam         = name
      tables
        output        = gt_itab
    if sy-subrc ne 0.
       message e000(z84433_msg_class).
    endif.
    endform.                    " FETCHDATA
    *&      Module  STATUS_0100  OUTPUT
          text
    module status_0100 output.
      set pf-status 'MAIN'.
    SET TITLEBAR 'xxx'.
    *creating custom container and grid instance
    if g_custom_container is initial.
        create object g_custom_container
               exporting container_name = g_container.
        create object grid1
               exporting i_parent = g_custom_container.
        call method grid1->set_table_for_first_display
          exporting
            i_structure_name = 'ZFUNCTIONAL'
          changing
            it_outtab        = gt_itab.
    *set handler events
        set handler z_functional=>handle_double_click for grid1.
      endif.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    module user_command_0100 input.
    case ok_code.
       when 'EXIT'.
        perform exit_program.
    endcase.
      clear ok_code.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  EXIT_PROGRAM
          text
    -->  p1        text
    <--  p2        text
    form exit_program .
    leave program.
    endform.                    " EXIT_PROGRAM
    *&      Form  handle_double_click
          text
         -->P_E_ROW  text
         -->P_E_COLUMN  text
         -->P_ES_ROW_NO  text
    form handle_double_click  using   e_row type lvc_s_row
                                      e_column type lvc_s_col
                                      es_row_no type lvc_s_roid.
    data: t_output type  zfunctional.
        read table gt_itab into t_output index e_row-index .
      if sy-subrc = 0 and e_column-fieldname eq 'QMNUM'.
        set parameter id 'K01' field t_output-qmnum.
        call transaction 'ZSMART' and skip first screen .
      endif.
    endform.                    " handle_double_click
    regards,
    swaroop.

  • ALV: Issue with double  click event after sorting the ALV

    Hello Experts,
    I have an internal table that populates an ALV grid. When the user doubleclicks a row, my method HANDLE_DOUBLE_CLICK returns the e_row-index value from the ALV Grid. I use this index value to read the internal table, then retrieve additional data.
    My problem is the user may sort the ALV grid before double clicking on a line. If this happens my internal table is not sorted to match the ALV grid, so reading the internal table with the e_row-index value returns the wrong information.
    When the double click event occurs, is it possible to capture the value in column 1 instead of a value for e_row-index?
    There is one more paramter in HANDLE_DOUBLE_CLICK for row id.   It is coming blank in debugging .  what is the purpose of this parameter and how i can make use of it ?
    Regards
    Vivek

    Hi,
    I am Posting The Code Which Uses Double Click Event.
    And This Code will provide the total information to you.
    REPORT  ZALVGRID_PG.
    TABLES: SSCRFIELDS.
    DATA: V_BELNR TYPE RBKP-BELNR.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: IRNO FOR V_BELNR.
    PARAMETERS: P_GJAHR TYPE RBKP-GJAHR.
    SELECTION-SCREEN END OF BLOCK B1.
    DATA: WA TYPE ZALVGRID_DISPLAY,
          ITAB TYPE STANDARD TABLE OF ZALVGRID_DISPLAY.
    DATA: IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: L_IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: L_TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.
    TYPE-POOLS: SLIS,SDYDO.
    DATA: L_LOGO TYPE SDYDO_VALUE,
          L_LIST TYPE SLIS_T_LISTHEADER.
    END-OF-SELECTION.
    CLASS CL_LC DEFINITION.
      PUBLIC SECTION.
        METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN.
    ENDCLASS.
    CLASS CL_LC IMPLEMENTATION.
      METHOD DC.
        DATA: WA1 TYPE ZALVGRID_DISPLAY.
        READ TABLE ITAB INTO WA1 INDEX E_ROW-INDEX.
        BREAK-POINT.
        SET PARAMETER ID 'BLN' FIELD WA1-BELNR.
        CALL TRANSACTION 'FB02'.
      ENDMETHOD.                    "DC
    ENDCLASS.
    DATA: OBJ_CL TYPE REF TO CL_LC.
    START-OF-SELECTION.
      PERFORM SELECT_DATA.
      IF SY-SUBRC = 0.
        CALL SCREEN 100.
      ELSE.
        MESSAGE E000(0) WITH 'DATA NOT FOUND'.
      ENDIF.
      INCLUDE ZALVGRID_PG_STATUS_0100O01.
      INCLUDE ZALVGRID_PG_LOGOSUBF01.
      INCLUDE ZALVGRID_PG_SELECT_DATAF01.
    INCLUDE ZALVGRID_PG_USER_COMMAND_01I01.
    ***INCLUDE ZALVGRID_PG_STATUS_0100O01 .
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'AB'.
    *  SET TITLEBAR 'xxx'.
      IF IDENTITY IS INITIAL.
        CREATE OBJECT IDENTITY
        EXPORTING
          CONTAINER_NAME = 'ALVCONTROL'.
        CREATE OBJECT GRID
        EXPORTING
          I_PARENT = IDENTITY.
        CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
             I_STRUCTURE_NAME              = 'ZALVGRID_DISPLAY'
          CHANGING
            IT_OUTTAB                     = ITAB.
        CREATE OBJECT OBJ_CL.
        SET HANDLER OBJ_CL->DC FOR GRID.
        ENDIF.
        IF L_IDENTITY IS INITIAL.
          CREATE OBJECT L_IDENTITY
          EXPORTING
            CONTAINER_NAME = 'LOGO'.
          CREATE OBJECT L_TREE
          EXPORTING
            I_PARENT = L_IDENTITY.
          PERFORM LOGOSUB USING L_LOGO.
          CALL METHOD L_TREE->CREATE_REPORT_HEADER
            EXPORTING
              IT_LIST_COMMENTARY    = L_LIST
              I_LOGO                = L_LOGO.
          ENDIF    .
    ENDMODULE.                 " STATUS_0100  OUTPUT
    ***INCLUDE ZALVGRID_PG_LOGOSUBF01 .
    FORM LOGOSUB  USING    P_L_LOGO.
      P_L_LOGO = 'ERPLOGO'.
    ENDFORM.                    " LOGOSUB
    ***INCLUDE ZALVGRID_PG_SELECT_DATAF01 .
    FORM SELECT_DATA .
      SELECT RBKP~BELNR
             RBKP~BLDAT
             RSEG~BUZEI
             RSEG~MATNR
             INTO TABLE ITAB
             FROM RBKP INNER JOIN RSEG
        ON RBKP~BELNR = RSEG~BELNR
        WHERE RBKP~BELNR IN IRNO
        AND RBKP~GJAHR = P_GJAHR.
    ENDFORM.                    " SELECT_DATA
    ***INCLUDE ZALVGRID_PG_USER_COMMAND_01I01 .
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
           EXIT.
           ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Warm Regards,
    PavanKumar.G
    Edited by: pavankumar.g on Jan 19, 2012 5:30 AM

  • ALV Class Double click event

    Hi All,
    I have created an alv report using alv class. I have handled the double click event in that i am calling transaction using row currenlty selected. But after doing subtotalling the list and then i double click a line it is passing wrong data.
    Points are awarded,
    Regards,
    Bharat Mistry
    Message was edited by: Bharat Mistry

    Hi Bharat,
    Read the internal table contents in double click event with e_row-index , then you will get the data of that particular row.
    check below code :
    local class to handle semantic checks
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    DATA: g_event_receiver TYPE REF TO lcl_event_receiver.
    LOCAL CLASS Definition
    *§4.Define and implement event handler to handle event DATA_CHANGED.
    CLASS lcl_event_receiver DEFINITION.
      public section.
        METHODS:
          handle_double_click
                 FOR EVENT double_click OF cl_gui_alv_grid
                 IMPORTING e_row e_column.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_double_click.
      read table gt_outtab index e_row-index into
    Regards
    Appana
    *Reward Points for helpful answers
    Message was edited by: L Appana

  • Handling double click event in oops alv

    I need to write a interactive alv where,can any one help me in handling double click event using oops.

    Hello,
    Demo program on interactive ALV using OOPS
    REPORT  ZALV_OOINTERACTIVE.*Class definition for handling double click
    CLASS event_class DEFINITION DEFERRED.*Internal table and work area declarations for dd02l and dd03l
    DATA : it_dd02l TYPE TABLE OF dd02l,
           wa_dd02l TYPE dd02l,
           it_dd03l TYPE TABLE OF dd03l,
           wa_dd03l TYPE dd03l.*data declarations for ALV Main list
    DATA : ty_lay1 TYPE lvc_s_layo,
           it_fieldcat TYPE lvc_t_fcat ,
           ty_fieldcat TYPE lvc_s_fcat ,
           c_alv1 TYPE REF TO cl_gui_alv_grid,
           c_cont1 TYPE REF TO cl_gui_custom_container,
           event_receiver TYPE REF TO event_class.*data declarations for ALV Interactive listDATA : ty_lay2 TYPE lvc_s_layo,
           it_fcat TYPE lvc_t_fcat ,
           ty_fcat TYPE lvc_s_fcat ,
           c_alv2 TYPE REF TO cl_gui_alv_grid,
           c_cont2 TYPE REF TO cl_gui_custom_container.
    **Select options for multiple values and NOT ranges
    SELECT-OPTIONS : s_table FOR wa_dd02l-tabname NO INTERVALS.
    Initialization event
    INITIALIZATION.*Start of selection event
    START-OF-SELECTION.*fetch data into table and field characteristics
      PERFORM fetch_data.*ALV display for output
      PERFORM alv_output.&----
    *&      Form  FETCH_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM fetch_data .*Select the table details
      SELECT * FROM dd02l INTO CORRESPONDING FIELDS OF TABLE it_dd02l 
    WHERE tabname IN s_table
      AND tabclass = 'TRANSP'.
    ENDFORM.                    " FETCH_DATA----* CLASS lcl_event_receiver DEFINITION----CLASS event_class DEFINITION.*Handling double click
      PUBLIC SECTION.    METHODS:
        handle_double_click
        FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row .ENDCLASS. "lcl_event_receiver DEFINITION
    ----* CLASS lcl_event_receiver IMPLEMENTATION
    ----CLASS event_class IMPLEMENTATION.  METHOD handle_double_click.    DATA : ls_dd02l LIKE LINE OF it_dd02l.*Reading the selected data into a variable
        READ TABLE it_dd02l INDEX e_row-index INTO ls_dd02l.*  *Select the field details of the selected table
        SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
        WHERE tabname EQ ls_dd02l-tabname.
    *calling the ALV containing the field values
        CALL SCREEN 101.  ENDMETHOD. "handle_double_clickENDCLASS. "lcl_event_receiver IMPLEMENTATION&----& Module pbo_100 OUTPUT&----
    *MODULE pbo_100 OUTPUT.
    *set pf-status 'XXX'.
    *set titlebar 'XXX'.
    ENDMODULE. " PBO_100 OUTPUT
    *& Module alv_100 OUTPUT
    &----MODULE alv_100 OUTPUT.*Check if there is no custom container in screen 100
      IF c_cont1 IS INITIAL.*Creating object of container
        CREATE OBJECT c_cont1
         EXPORTING
           container_name = 'CCONT'.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.*Creating object of alv
        CREATE OBJECT c_alv1
           EXPORTING
            i_parent = c_cont1.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.*alv layout
        PERFORM alv_100_layout.*alv field catalogue
        PERFORM alv_100_fieldcat.*Displaying the ALV grid
        CALL METHOD c_alv1->set_table_for_first_display
          EXPORTING
            is_layout       = ty_lay1
          CHANGING
            it_outtab       = it_dd02l[]
            it_fieldcatalog = it_fieldcat.    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.*Create object of the event class and setting handler for double click
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_double_click FOR c_alv1.  ENDIF.ENDMODULE. " ALV_100 OUTPUT&----& Module pai_100 INPUT&----
    *MODULE pai_100 INPUT.
    ENDMODULE. " pai_100 INPUT----* MODULE PBO_101 OUTPUT----MODULE pbo_101 OUTPUT.
    SET PF-STATUS 'XXX'.
    SET TITLEBAR 'XXX'.
    ENDMODULE. " PBO_101 INPUT----* MODULE ALV_101 OUTPUT----
    MODULE alv_101 OUTPUT.
    *Check if the Custom container exists.
      IF c_cont2 IS INITIAL.*Creating container object
        CREATE OBJECT c_cont2
          EXPORTING
            container_name = 'CDCONT'.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.*creating ALV grid for interactive list
        CREATE OBJECT c_alv2
          EXPORTING
           i_parent = c_cont2.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.*ALV layout
        PERFORM alv_101_layout.*ALV fieldcatalogue
        PERFORM alv_101_fieldcat.*Sorting the output by field position
        SORT it_dd03l BY position.*ALV for display field details
        CALL METHOD c_alv2->set_table_for_first_display
          EXPORTING
            is_layout       = ty_lay2
          CHANGING
            it_outtab       = it_dd03l[]
            it_fieldcatalog = it_fcat.
        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.ENDMODULE. " ALV_101 OUTPUT
    &----& Module PAI_101 INPUT&----
    *MODULE pai_101 INPUT.ENDMODULE. " PAI_101 INPUT
    *&      Form  ALV_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_output .
      CALL SCREEN 100.ENDFORM.                    " ALV_OUTPUT
    *&      Form  ALV_100_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_100_layout .  ty_lay1-grid_title = 'TABLES'.
      ty_lay1-zebra = 'X'.
      ty_lay1-no_toolbar = 'X'.ENDFORM.                    " ALV_100_LAYOUT
    *&      Form  ALV_100_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_100_fieldcat .
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 1.
      ty_fieldcat-fieldname = 'TABNAME'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'TableName'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.  ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 2.
      ty_fieldcat-fieldname = 'TABCLASS'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'CATEGORY'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.  ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 3.
      ty_fieldcat-fieldname = 'AS4USER'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'CREATED'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.  ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 4.
      ty_fieldcat-fieldname = 'AS4DATE'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'DATE'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 5.
      ty_fieldcat-fieldname = 'AS4TIME'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'TIME'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.  ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 6.
      ty_fieldcat-fieldname = 'CONTFLAG'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'Delivery Class'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.ENDFORM.                    " ALV_100_FIELDCAT
    *&      Form  ALV_101_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_101_layout .  ty_lay2-grid_title = 'FIELDS'.
      ty_lay2-zebra = 'X'.
      ty_lay2-no_toolbar = 'X'.ENDFORM.                    " ALV_101_LAYOUT
    *&      Form  ALV_101_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_101_fieldcat .  REFRESH it_fieldcat.
      REFRESH it_fcat.
      CLEAR ty_fcat.  ty_fcat-row_pos = 1.
      ty_fcat-col_pos = 1.
      ty_fcat-fieldname = 'FIELDNAME'.
      ty_fcat-tabname = 'GT_DD03L'.
      ty_fcat-coltext = 'Fieldname'.
      ty_fcat-outputlen = 10.
      APPEND ty_fcat TO it_fcat.
      ty_fcat-row_pos = 1.
      ty_fcat-col_pos = 2.
      ty_fcat-fieldname = 'CHECKTABLE'.
      ty_fcat-tabname = 'GT_DD03L'.
      ty_fcat-coltext = 'CHECKTABLE'.
      ty_fcat-outputlen = 10.
      APPEND ty_fcat TO it_fcat.  ty_fcat-row_pos = 1.
      ty_fcat-col_pos = 3.
      ty_fcat-fieldname = 'KEYFLAG'.
      ty_fcat-tabname = 'GT_DD03L'.
      ty_fcat-coltext = 'Key Flag'.
      ty_fcat-outputlen = 10.
      APPEND ty_fcat TO it_fcat.ENDFORM.                    " ALV_101_FIELDCAT

  • ALV GRID  - double click event - hot spot event

    Dear developers
    I am building a custom application using ALV GRID (OO method).
    I have three ALV's on the screen.
    User selects a cell on the first ALV from the list. say a specific product group.
    The second ALV displays the product records depnding on selection of first ALV. (this works fine).
    when the user selects a cell of a specific column on ALV grid 2 using double click event or hotspot I am always getting row ID as 1 , irrespective of the user clickin on row 2 or 3 on the specific cell.
    To carry out further processing , I need to get the exact row the user is selecting which I expected to be available in LVC_S_ROID. My further process works always with ROW ID as 1.
    I am using event hot spot in alv grid 1. In grid 2 I tried both hot spot and double click . But both returns the index value of row as 1 , irrespective of the cell being clicked is beyond row 1. in second grid.
    Looking forward for help or suggestion on this,
    Regards
    Kumar

    Hi
    The handler is implemented as follows for all ALV GRIDs.
    I give below only the relevant one grid 2 from my code.
    Class definition
    **03/17/2005 skulist hotspot
    handle_skulist FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING e_row_id e_column_id es_row_no,
    Class implementation
    **03/17/2005 sku list by currency hotspot on listprice
      METHOD handle_skulist .
        PERFORM handle_skulist USING e_row_id e_column_id es_row_no.
      ENDMETHOD.                    "HANDLE_HOTSPOT_CLICK
    DATA gr_event_handler TYPE REF TO lcl_event_handler.
    DATA gr_event_handler_4 TYPE REF TO lcl_event_handler.
    The above are done in an include and are public in nature.
    Also note that I have similar implementation for similar events for grid 1 bu the event handlers are registered in different names.
    The code below is in the maib program , under a custom container for grid 2
    CREATE OBJECT gr_event_handler_4.
        SET HANDLER gr_event_handler_4->handle_skulist FOR gr_alvgrid1.
    *Based on the user action on grid 2 this form is getting executed. But as I said earlier the parameter I am getting for index is 1 always.
    FORM handle_skulist USING i_row_id1 TYPE lvc_s_row
                                    i_column_id1 TYPE lvc_s_col
                                    is_row_no1 TYPE lvc_s_roid.

  • Methods for adding DBL click event in ALV

    Methods for adding DBL click event in ALV

    Hi Jagrut,
      If you are using CL_GUI_ALV_GRID class to display ALV report and want to add
      double clicking functionality to ALV need to handle event DOUBLE_CLICK
      in your local class.
      See the below code how you define it.
    *===============================================================
    * LOCAL CLASSES: Definition
    *===============================================================
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
    * § 2. Define a method for each print event you need.
        METHODS:
        TOP_OF_PAGE FOR EVENT TOP_OF_PAGE
                             OF CL_GUI_ALV_GRID
                             IMPORTING E_DYNDOC_ID,
        DOUBLE_CLICK FOR EVENT DOUBLE_CLICK
                             OF CL_GUI_ALV_GRID
                             importing E_ROW.
      PRIVATE SECTION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *===============================================================
    * LOCAL CLASSES: Implementation
    *===============================================================
    * class c_event_receiver (Implementation)
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD TOP_OF_PAGE.
    * Top-of-page event
        PERFORM EVENT_TOP_OF_PAGE USING G_DYNDOC_ID.
      ENDMETHOD.                            "top_of_page
      METHOD DOUBLE_CLICK.
    * Top-of-page event
        PERFORM list using e_row.
      ENDMETHOD.                            "DOUBLE_CLICK
      You also need to register the events.
      And also check the program BCALV_GRID_VERIFY.
    Hope this will help you.
    Thanks&Regards,
    Siri.

  • Handle single click event in ALV OOPS

    Hi,
    I have to display 2 ALV grid...one above the other.
    Top ALV will contain Header info and bottom ALV witll display line item.
    I am use ALV OOPS.
    Now when user will click on the top ALV ...bottom ALV should show corresponding data.
    I don't have to use HOTSPOT or Double click event.
    How can I handle single click event.
    Please guide me..thanks in advance
    Regards,
    Prasoon

    hi,
                    for this in ALV OOPS take <b>2 custom containers( cl_gui_custom_container)</b>in the same screen and on the 1st container display the header data<b>(use set_tale_for_first_display method of class cl_gui_alv_grid)</b>.
                   On the 2nd screen item data for  this  use<b> EVENT</b> handling(you want <b>single click</b>). use<b> hotspot_click</b> or <b>button_click </b>events. 
    for this you have to register the events.   the code for that.
    <b>CLASS lcl_event_handler DEFINITION .</b>
    PUBLIC SECTION .
    METHODS:
    *--Hotspot click control
    handle_hotspot_click
    FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING e_row_id e_column_id es_row_no ,
    *--To control button clicks
    handle_button_click
    FOR EVENT button_click OF cl_gui_alv_grid
    IMPORTING e_oject e_ucomm .
    PRIVATE SECTION.
    ENDCLASS.
    <b>CLASS lcl_event_handlerIMPLEMENTATION .</b>
    *--Handle Hotspot Click
    METHOD handle_hotspot_click .
    PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
    ENDMETHOD .
    METHOD handle_button_click .
    PERFORM handle_button_click USING e_object e_ucomm .
    ENDMETHOD .
    ENDCLASS .
    DATA gr_event_handler TYPE REF TO lcl_event_handler .
    <b>*--Creating an instance for the event handler</b>
    CREATE OBJECT gr_event_handler.
    <b>*--Registering handler methods to handle ALV Grid events</b>
    SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid .
    SET HANDLER gr_event_handler->handle_button_click FOR gr_alvgrid .
    do n't forget to use<b> refresh_table_display
    </b> other wise only the record which you first you clicked will display in the 2nd container.
    <b>Reward points for useful Answers</b>

  • How to handle double click event in a text control

    Hi,
       Will u please send me information on handling double click events inside text control and also about locking and unlocking of DB tables for updation.
    Regards,
    Praba.

    Hi Prabhavathi,
    Here is how you handle double click events in Textedit control.
    1)Create a custom control in screen (say TEXT_CONTROL)
    2)In main program,
    a) Declarations:
    data: obj type ref to cl_gui_custiom_control.
          text type ref to cl_gui_textedit.
    b) Create the instance of custom container
    c) Create the instance of textedit control.
    3)Now to handle double click events , create a local class as follows.
    class shail_event definition.
    public section.
    methods:
    handle_doubleclick for event dblclick of cl_gui_textedit .
    endclass.
    class shail_event implementation.
    method handle_doubleclick .
    here do the coding for handling the double click.
    endmethod.
    endclass.
    4) Create an instance of the handler class(ie.ZSHAIL_EVENT).Let it be named hand.
    5) Define varibles for event.
    DATA: i_events TYPE cntl_simple_events,
          wa_events TYPE cntl_simple_event.
    SET HANDLER hand->handle_doubleclick for text.
    wa_events-eventid = cl_gui_textedit=>event_double_click.
    wa_events-appl_event = 'X'. "This is an application event
    APPEND wa_events TO i_events.
    6)
        CALL METHOD texte->set_registered_events
          EXPORTING
            events                    = i_events
          EXCEPTIONS
            cntl_error                = 1
            cntl_system_error         = 2
            illegal_event_combination = 3
            OTHERS                    = 4.
        IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    These are the basic steps needed for handling events in Textedit control.You can go to SE24 and type CL_GUI_TEXTEDIT to find the associated events of the class.
    If you want the program, kindly send your mail-id so that I can mail it to you.
    Regards,
    Sylendra.

Maybe you are looking for

  • HP Pavilion g6 Notebook recovery following hard drive replacement

    After replacing a failed hard drive with the same Samsung/Seagate ST500LM012 that came in the notebook I now cannot recover the factory settings. I continue to get the "Bootmgr is missing" error, even after trying three different recovery oiptions th

  • Itunes crashed

    I connected my ist gen 2 gig nano last night and experienced some problems, ie it crashed 3 times. i connected it tonight after numerous restores, and itunes disappeared. this was after my computer failed to recognise my nano tonight. i restored it,

  • Error when i create accounting

    frist of all sorry if i put this message in wrong subject or wrong thread.this is my frist time in forum dear all, i use ebs r12 12.1.2 os Linux x86-64 when i create accounting i meet error this log : Application Object Library: Version : 12.0.0 Copy

  • Keep getting error ipod shuffle "error

    Keep getting error ipod shuffle "error # 1437" and get directed to apple page (that is no longer supported) to download a fix to restore ipod to factory settings. However, download is no longer available. BTW ipod is new and when put in sometimes win

  • Buttons not working in CRM 2015 Outlook client

    I have this strange problem where no user in an organisation (even administrators) can't click the new Account, Contact or Lead buttons in the CRM Outlook client. The button is visible and enabled but nothing happens when clicked. The CRM Activity bu