Skip to Content
author's profile photo Former Member
Former Member

hotspot in interactive alv...

hi all,

i have made an interactive report through oops concept...in that when i m using hotspot in the field catalog then its not capturing the double click event... and when i m removing the hotspot then its working... but my need is to define hotspot...

hw to do that.. plz provide solution ASAP..

Thanks & Regards

Ashu Singh.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 11:55 AM

    Hi

    Go through the link given below :

    How to provide Hotspot in ALV tree????

    ALV hotspot

    With Regards

    Nikunj Shah

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      It's EASY

      1) define event handlers

      2) build field catalog and set 'X' for hotpot against fields you want "hotspotted"

      3) populate the table

      4) display grid

      snippets of code below.

      Build event handler for the hotspot

      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,
      .........rest of definitions
      
      class lcl_event_handler implementation.
      
      *Handle Hotspot Click
        method handle_hotspot_click .
          perform mouse_click
            using e_row_id
                  e_column_id.
          call method grid1->get_current_cell
             importing
               e_row     = ls_row
               e_value   = ls_value
               e_col     = ls_col
               es_row_id = ls_row_id
              es_col_id = ls_col_id
              es_row_no = es_row_no.
      
      
          call method grid1->refresh_table_display.
          call method grid1->set_current_cell_via_id
      
        exporting
          is_column_id =  e_column_id
          is_row_no  =  es_row_no.
      
      
      
        endmethod.                    "lcl_event_handler
      
      
      
      

      Get the components of your structure into a table of the form of a field catalog.

      now loop round it and set the hot spot to the field you want.

      When displaying the GRID you'll be able to single click on the hotspotted field. .

      
      * build a field catalog
      * First get your data structure into a field symbol
      data lr_rtti_struc type ref to cl_abap_structdescr .
      data:
          zog                     like line of lr_rtti_struc->components .
      data:
        zogt                    like table of zog,
      wa_it_fldcat type lvc_s_fcat,
      it_fldcat type lvc_t_fcat ,
      dy_line            type ref to data,
      dy_table           type ref to data.
      
      * Define any structure
      
      types:  begin of s_elements.
      
        include structure e1edl24.
      
      types:
      
      end of  s_elements.
      data: wa_elements type s_elements.
      data lr_rtti_struc type ref to cl_abap_structdescr .
      
      data:  dref               type ref to data.
      
      field-symbols: <fs> type any,
         <dyn_table>    type  standard table,
         <dyn_wa>.
      
      
        create data dref type s_elements.
        assign dref->* to <fs>.
      
        lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( <fs> ).
      
      
       zogt[]  = lr_rtti_struc->components.
        loop at zogt into zog.
          clear wa_it_fldcat.
          wa_it_fldcat-fieldname = zog-name .
          wa_it_fldcat-datatype = zog-type_kind.
          wa_it_fldcat-inttype = zog-type_kind.
          wa_it_fldcat-intlen = zog-length.
          wa_it_fldcat-decimals = zog-decimals.
          wa_it_fldcat-coltext = zog-name.
          wa_it_fldcat-lowercase = 'X'.
          if wa_it_fldcat-fieldname = 'VBELN'.
            wa_it_fldcat-hotspot = 'X'.
          endif.
          append wa_it_fldcat to it_fldcat.
      
        endloop.
      *
      * before displaying the grid instantiate your event handler
      
          create object g_handler.
        set handler g_handler->handle_double_click for class_object.
        set handler g_handler->handle_hotspot_click for class_object.
      
      
      * display your grid
      
      * I've used a dynamic table but you can use a "conventional "
      * itab -- so long as the field catalog has the 
      * hotspot indactor set for the correct fields.
      
            call method class_object->set_table_for_first_display
          exporting is_layout =  struct_grid_lset
          changing
                     it_outtab       = <dyn_table>
                     it_fieldcatalog = it_fldcat.
      
      

      Cheers

      jimbo

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 11:48 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 11:49 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 11:50 AM

    Hi ashu,

    Hope this link will help you

    [http://www.watto.org/program/abap/download/Z_ALV_TEMPLATE.abap]

    Regards,

    Sravanthi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 23, 2008 at 12:13 PM

    Check the sample code...

    Create a Empty screen 100. and don't place any custom Control on that.

    REPORT  ztest_oo_a.
    
    DATA: it_vbak TYPE vbak_t.
    DATA: dock TYPE REF TO cl_gui_docking_container,
          it_fcat TYPE lvc_t_fcat,
          wa_fcat TYPE lvc_s_fcat,
    
          grid TYPE REF TO cl_gui_alv_grid.
    
    *----------------------------------------------------------------------*
    *       CLASS lcl_handler DEFINITION
    *----------------------------------------------------------------------*
    *
    *----------------------------------------------------------------------*
    CLASS lcl_handler DEFINITION.
      PUBLIC SECTION.
        METHODS:  hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
        IMPORTING e_row_id e_column_id es_row_no.
    
    ENDCLASS.                    "lcl_handler DEFINITION
    
    
    *----------------------------------------------------------------------*
    *       CLASS lcl_handler IMPLEMENTATION
    *----------------------------------------------------------------------*
    *
    *----------------------------------------------------------------------*
    CLASS lcl_handler IMPLEMENTATION.
    
      METHOD hotspot_click.
        DATA:    row TYPE lvc_s_roid,
            wa_vbak TYPE vbak.
        row = es_row_no.
        READ TABLE it_vbak INTO wa_vbak INDEX row-row_id.
    
        SET PARAMETER ID 'AUN' FIELD wa_vbak-vbeln.
        CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    
      ENDMETHOD.                    "HOTSPOT_CLICK
    
    ENDCLASS.                    "lcl_handler IMPLEMENTATION
    
    
    START-OF-SELECTION.
    
      DATA: obj TYPE REF TO  lcl_handler.
      CREATE OBJECT obj.
      SELECT *
        FROM vbak
        INTO TABLE it_vbak
        UP TO 20 ROWS.
    
      CALL SCREEN 100.
    
    
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SATR'.
    
    
      CREATE OBJECT dock
        EXPORTING
          repid     = sy-repid
          dynnr     = '100'
          extension = '1500'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5
          OTHERS                      = 6
          .
      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 grid EXPORTING i_parent = dock.
    
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'VBAK'
        CHANGING
          ct_fieldcat            = it_fcat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    
      wa_fcat-hotspot = 'X'.
      MODIFY it_fcat FROM wa_fcat INDEX 2 TRANSPORTING hotspot .
    
      SET HANDLER obj->hotspot_click FOR grid.
    
      CALL METHOD grid->set_table_for_first_display
    *    EXPORTING
    *      i_structure_name              = 'VBAK'
        CHANGING
          it_outtab                     = it_vbak
          it_fieldcatalog               = it_fcat
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 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.
    
    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

    Flow logic

    PROCESS BEFORE OUTPUT.
     MODULE STATUS_0100.
    *
    PROCESS AFTER INPUT.
     MODULE USER_COMMAND_0100.

    Regards

    Vijay babu Dudla

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.