Hot spot in ALV Report

Dear Experts,
I have a doubt in classical report.  I developed a classcial report and displayed a hotspot in top of page, so that the hotspot text will take me to the alv form of the classcial report.  it works fine.  But when i try to include that hotspot in pf status,  it doesnot work.  Please help. 
Shankar

Hi
Hotspot is linked to F2, so only thing you have to do is to assign a code to F2 in your status.
If you're using an ALV report you can do it without to create a new status, but seeting the code in layout structure:
GT_LAYOUT-F2CODE = <CODE>.
Now you have to manage that code in USER_COMAND routine:
FORM USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                        RS_SELFIELD TYPE SLIS_SELFIELD.
  CASE R_UCOMM.
   WHEN <CODE>. .........
ENDFORM.
So you should have a call of fm alv like this:
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
          I_CALLBACK_PROGRAM       = GT_REPID
         I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          IS_LAYOUT                = GT_LAYOUT
          IT_FIELDCAT              = GT_FIELDCAT
       TABLES
            T_OUTTAB                 = ITAB
Max

Similar Messages

  • Code for Hot spot in ALV report to call transaction

    Hi,
    I  hv never use hot spot to link as a call transaction can u give the link or code how to make hot spot on a particular fields  i am working on a ALV report in that report in the belnr coloumn when user click on belnr i want to call FB03 transaction ref. to that belnr number and fisacl year.
    regards,
      zafar

    Hi,
    In the fieldcatalog you will have to write the hotspot as shown below,
       wa_fieldcat-hotspot   =  'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program       = sy-repid
            i_callback_user_command  = 'USER_COMMAND'"----> this is important
         i_callback_pf_status_set = 'PFSTATUS'
            it_fieldcat              = it_fieldcat
            is_layout                = it_layout
         it_event_exit            = it_eventexit
         i_screen_start_column    = 10
         i_screen_start_line      = 20
         i_screen_end_column      = 70
         i_screen_end_line        = 45
            i_grid_title             = 'Customer-Order Details'
          TABLES
            t_outtab                 = it_data.
    then you will have to catch the user command as follows,
    FORM user_command USING r_ucomm TYPE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      DATA: alv_vbeln TYPE vbeln,
            mess_text(30) TYPE c,
            txt_vbeln(10) TYPE c.
    *User clicks a Order No. in ALV it passed to the following transaction.
      CASE r_ucomm.
        WHEN '&IC1'.
          READ TABLE it_data INDEX rs_selfield-tabindex INTO wa_data.
          alv_vbeln  = wa_data-vbeln..
          IF sy-subrc = 0.
            CLEAR: mess_text, txt_vbeln.
            SUBMIT zprogram
             WITH pr_vbeln = alv_vbeln AND RETURN.
    put your call transaction logic here
          ENDIF.
      ENDCASE.
    ENDFORM.                    "user_command
    Hope it helps you,
    Regards,
    Abhijit G. Borkar

  • Attaining Hot spot in ALV Tree Using OOPS concept

    Hi All,
    In our requirement we are displaying the data in ALV Tree Using OOPS.
    We need to achieve hot spot on one of the header field.
    I am using  Class 'CL_GUI_ALV_TREE'
    Ex:
    CreditAccnt/ Company codes            DSO    DDSO
    26                                                   15        15
       8000                                              5          5
       8545                                             10        10
    In the above example for every credit accnt in header we r displaying the values ( DSO ,DDSO) for all company codes.
    Now we require hot spot on Credit Accnt 26. Such that when user clicks on the credit accnt it should navigate to another transaction.
    NOTE: we havent build any field catalogue for field CreditAccnt/ Company codes .

    Hi,
    You can refer to the tutorial -
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
    Or try using the code below-
    CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION.
    PUBLIC SECTION.
    CLASS-METHODS:
    Hot Spot Click
    handle_hotspot
    FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING e_row_id
    e_column_id
    es_row_no,
    ENDCLASS.
    Implementation
    *& Method handle_hotspot
    This method is called when the user clicks on a hotspot to drill down.
    The following types are exported from the ALV
    LVC_S_ROW
    LVC_S_COL
    LVC_S_ROID
    METHOD handle_hotspot.
    The hotspot processing coded in the form below.
    PERFORM f9802_handle_hotspot USING e_row_id
    e_column_id
    es_row_no.
    ENDMETHOD.
    *& Form f9802_handle_hotspot
    This form is called when the user clicks on a hotspot on the ALV grid
    The parameters are of type
    -->P_E_ROW text
    -->P_E_COL text
    -->P_E_ROID text
    FORM f9802_handle_hotspot USING p_row
    p_col
    p_roid.
    DATA: lw_output LIKE LINE OF i_output.
    READ TABLE i_output INDEX p_row INTO lw_output.
    SET PARAMETER ID 'MAT' FIELD lw_output-matnr.
    CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
    ENDFORM. " f9802_handle_hotspot
    FORM f9300_modify_field_cat TABLES p_fieldcat STRUCTURE lvc_s_fcat.
    Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.
    LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.
    CASE <lfs_fieldcat>-fieldname.
    WHEN 'MATNR'.
    <lfs_fieldcat>-hotspot = c_x.
    <lfs_fieldcat>-key = c_x.
    WHEN OTHERS.
    ENDCASE.
    ENDLOOP.
    ENDFORM.
    In PBO,
    module STATUS_9001 output.
    Set handlers for events
    SET HANDLER o_eventreceiver->handle_hotspot FOR o_Alvgrid.
    ENDMODULE.
    Hope this helps

  • 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.

  • Hot spot event on alv tree

    hi.....
    whats the event for hotspot or single click on node event
    thanks.

    Hi,
    If you want to get it through grid you can go through the sample code...
    The sample program explains on how to achieve hotspot apply the same for alv tree...
    REPORT  Z_ALV_HOTSPOT.
    TABLES:EKKO.
    SELECT-OPTIONS:S_EBELN FOR EKKO-EBELN.
        INTERNAL TABLE FOR EKKO
    DATA: TB_EKKO TYPE STANDARD TABLE OF EKKO,
        INTERNAL TABLE FOR EKPO
          TB_EKPO TYPE STANDARD TABLE OF EKPO,
          DA_TOP  TYPE REF TO CL_DD_DOCUMENT,
          DW_TOP  TYPE REF TO CL_DD_DOCUMENT.
    DATA:
        GRIDS
          EKKO_GRID TYPE REF TO CL_GUI_ALV_GRID,
          EKPO_GRID TYPE REF TO CL_GUI_ALV_GRID,
        CONTAINERS
          EKKO_CONTAINER        TYPE REF TO CL_GUI_CONTAINER,
          EKPO_CONTAINER        TYPE REF TO CL_GUI_CONTAINER,
          TOP_OF_PAGE_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
          DTOP_OF_PAGE_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
          DMAIN_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          MAIN_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
          DSPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
        LAYOUT
          X_LAYOUT TYPE LVC_S_LAYO,
        WORK AREA
          X_EKKO LIKE EKKO.
      DATA: FLAG TYPE C,
            flag_top type c.
          CLASS LCL_HANDLER DEFINITION
    CLASS LCL_HANDLER DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:HANDLER_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF
         CL_GUI_ALV_GRID IMPORTING E_ROW_ID.
        CLASS-METHODS:HANDLER_TOP_OF_PAGE FOR EVENT TOP_OF_PAGE OF
         CL_GUI_ALV_GRID .
    ENDCLASS.                    "LCL_HANDLER DEFINITION
          CLASS LCL_HANDLER IMPLEMENTATION
    CLASS LCL_HANDLER IMPLEMENTATION.
      METHOD HANDLER_HOTSPOT_CLICK.
    CLEAR X_EKKO.
    CLEAR TB_EKKO.
        READ TABLE TB_EKKO INDEX E_ROW_ID-INDEX INTO X_EKKO.
        IF SY-SUBRC = 0.
          PERFORM GET_ITEM_DETAILS USING X_EKKO-EBELN.
        ENDIF.
      ENDMETHOD.                    "HANDLER_HOTSPOT_CLICK
      METHOD HANDLER_TOP_OF_PAGE.
        CALL METHOD DA_TOP->ADD_TEXT
          EXPORTING
            TEXT = 'Top Of Page'.
        CALL METHOD DA_TOP->DISPLAY_DOCUMENT
          EXPORTING
            PARENT = TOP_OF_PAGE_CONTAINER.
    if flag_top = 'X'.
    CALL METHOD DW_TOP->ADD_TEXT
          EXPORTING
            TEXT = 'ITEM Top Of Page '.
        CALL METHOD DW_TOP->DISPLAY_DOCUMENT
          EXPORTING
            PARENT = DTOP_OF_PAGE_CONTAINER.
      flag_top = ' '.
    endif.
      ENDMETHOD.                    "HANDLER_TOP_OF_PAGE
    ENDCLASS.                    "LCL_HANDLER IMPLEMENTATION
    *&      Module  STATUS_0100  OUTPUT
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'ABC'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Form  GET_DATA
    MODULE GET_DATA OUTPUT.
      SELECT * UP TO 5 ROWS INTO TABLE TB_EKKO FROM EKKO WHERE EBELN IN
      S_EBELN.
    ENDMODULE.                    " GET_DATA
                             START OF SELECTION.
    START-OF-SELECTION.
      CALL SCREEN 100.
    *&      Module  DISPLAY_DATA  OUTPUT
          text
    MODULE DISPLAY_DATA OUTPUT.
    CREATING CONTAINER OBJ*******
      CREATE OBJECT MAIN_CONTAINER
        EXPORTING
          CONTAINER_NAME               = 'CONT1'
        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 SPLITTER
                        EXPORTING TOP     = 5
                                  PARENT  = MAIN_CONTAINER
                                  ROWS    = 2
                                  COLUMNS = 1.
      CALL METHOD SPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 1
          COLUMN    = 1
        RECEIVING
          CONTAINER = TOP_OF_PAGE_CONTAINER.
      CALL METHOD SPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 2
          COLUMN    = 1
        RECEIVING
          CONTAINER = EKKO_CONTAINER.
    CREATING GRID OBJ AND ASSAIGNING TO CONTAINER ****
      CREATE OBJECT EKKO_GRID
        EXPORTING
          I_PARENT          =  EKKO_CONTAINER
        EXCEPTIONS
          ERROR_CNTL_CREATE = 1
          ERROR_CNTL_INIT   = 2
          ERROR_CNTL_LINK   = 3
          ERROR_DP_CREATE   = 4
          OTHERS            = 5
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    LAYOUT SETTINGS ***
      X_LAYOUT-ZEBRA  = 'X'.
      X_LAYOUT-KEYHOT = 'X'.
    TO DISPLAY TB_EKKO CONTENTS  ********
      CALL METHOD EKKO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'EKKO'
          IS_LAYOUT                     = X_LAYOUT
        CHANGING
          IT_OUTTAB                     = TB_EKKO
        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.
    ***REGESTRING HANDLER FOR HOT SPOT CLICK EVENT
      SET HANDLER LCL_HANDLER=>HANDLER_HOTSPOT_CLICK FOR EKKO_GRID.
      SET HANDLER LCL_HANDLER=>HANDLER_TOP_OF_PAGE FOR EKKO_GRID.
    For Top Of Page
      CREATE OBJECT DA_TOP
        EXPORTING STYLE = 'ALV_GRID'.
      CALL METHOD DA_TOP->INITIALIZE_DOCUMENT.
      CALL METHOD EKKO_GRID->LIST_PROCESSING_EVENTS
        EXPORTING
          I_EVENT_NAME = 'TOP_OF_PAGE'
          I_DYNDOC_ID  = DA_TOP.
    ENDMODULE.                 " DISPLAY_DATA  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CANCEL'.
          LEAVE TO SCREEN 0.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'OTHERS'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  GET_ITEM_DETAILS
    FORM GET_ITEM_DETAILS  USING  P_EKKO_EBELN TYPE EKKO-EBELN.
      CLEAR TB_EKPO[].
      SELECT * UP TO 5 ROWS INTO TABLE TB_EKPO FROM EKPO WHERE EBELN =
      P_EKKO_EBELN.
      IF FLAG IS INITIAL.
        FLAG = 'X'.
    CREATING CONTAINER OBJ*******
        CREATE OBJECT DMAIN_CONTAINER
          EXPORTING
            CONTAINER_NAME               = 'CONT2'
          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 DSPLITTER
                        EXPORTING TOP     = 5
                                  PARENT  = DMAIN_CONTAINER
                                  ROWS    = 2
                                  COLUMNS = 1.
      CALL METHOD DSPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 1
          COLUMN    = 1
        RECEIVING
          CONTAINER = DTOP_OF_PAGE_CONTAINER.
      CALL METHOD DSPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 2
          COLUMN    = 1
        RECEIVING
          CONTAINER = EKPO_CONTAINER.
    CREATING GRID OBJ AND ASSAIGNING TO CONTAINER ****
        CREATE OBJECT EKPO_GRID
          EXPORTING
            I_PARENT          =  EKPO_CONTAINER
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5
        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.
    LAYOUT SETTINGS ***
      X_LAYOUT-ZEBRA  = 'X'.
    TO DISPLAY TB_EKPO CONTENTS  ********
      CALL METHOD EKPO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'EKPO'
          IS_LAYOUT                     = X_LAYOUT
        CHANGING
          IT_OUTTAB                     = TB_EKPO
        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.
    SET HANDLER LCL_HANDLER=>HANDLER_TOP_OF_PAGE FOR EKPO_GRID.
    For Top Of Page
      CREATE OBJECT DW_TOP
        EXPORTING STYLE = 'ALV_GRID'.
      CALL METHOD DW_TOP->INITIALIZE_DOCUMENT.
    flag_top = 'X'.
      CALL METHOD EKPO_GRID->LIST_PROCESSING_EVENTS
        EXPORTING
          I_EVENT_NAME = 'TOP_OF_PAGE'
          I_DYNDOC_ID  = DW_TOP.
    ENDFORM.                    " GET_ITEM_DETAILS
    <b>Reward points for all helpful answers.</b>
    Regards,
    Azaz Ali.

  • Strange navigation in ALV hot-spot.

    Hi All,
    I have a strange problem, which I hope to get som advice about.
    Anyway I have created an ALV-report with hot-spot.
    The hot-spot executes the line below and of course it "jumps" to VA03.
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    The strange thing happens when I press 'F3' and returns to the ALV.
    The first time I do this, - it works fine, but when I 're-click' on the hot-spot Im again directed to transaction VA03.
    Now have to press 'F3' twice to get back to the ALV.
    Same thing happens when I 're-re-click' the hot-spot. But now I have to press 'F3' three times.
    Does anyone have an Idea how to solve this?
    I use the event to handle the hot-spot and I have attached the PBO snippet below to ease your understanding of my program.
    Please feel free to ask for more information
    Thanks in advance
    Lars Bernstorff Hansen
    CLASS cl_event_receiver DEFINITION.
      PUBLIC SECTION.
        DATA: t_utab_unsend TYPE zsd_tt_utab_unsend_mail
            , t_utab_send   TYPE zsd_tt_utab_send_mail.
        METHODS: handle_hotspot_click
          FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id.
    MODULE status_0100 OUTPUT.
      DATA: et_index_columns  TYPE lvc_t_col
          , i_structure_name  TYPE dd02l-tabname
          , is_layout         TYPE lvc_s_layo
          , it_fieldcatalog       TYPE lvc_t_fcat
          , i_gridtitle       TYPE lvc_title
          , linetype          TYPE string
          , itabref           TYPE REF TO data
          , ls_fcat           TYPE lvc_s_fcat.
      FIELD-SYMBOLS: <psaareatab>  TYPE STANDARD TABLE
                   , <psaareatab2> TYPE STANDARD TABLE.
      IF p_r1 = lcl_initialization=>c_x.
        linetype         = 'ZSD_UTAB_UNSEND_MAIL'.
        i_gridtitle      = 'Ukomplette ordrer - ej sendte'(200).
        i_structure_name = 'ZSD_UTAB_UNSEND_MAIL'.
      ELSE.
        linetype         = 'ZSD_UTAB_SEND_MAIL'.
        i_structure_name = 'ZSD_UTAB_SEND_MAIL'.
        i_gridtitle      = 'Komplette ordrer - sendte'(201).
      ENDIF.
      CREATE DATA itabref TYPE STANDARD TABLE OF (linetype).
      ASSIGN itabref->* TO <psaareatab>.
      IF p_r1 = gc_x.
        ASSIGN gt_utab_unsend TO <psaareatab>.
      ELSE.
        ASSIGN gt_utab_send TO <psaareatab>.
      ENDIF.
      SET TITLEBAR  'MAIN100'.
      SET PF-STATUS 'MAIN100'.
      IF go_custom_container IS INITIAL.
        CREATE OBJECT go_custom_container
          EXPORTING
            container_name = go_container.
        CREATE OBJECT go_grid
          EXPORTING
            i_appl_events = lcl_initialization=>c_x
            i_parent      = go_custom_container.
      ENDIF.
      lcl_initialization=>gxt_utab_unsend[] = gt_utab_unsend[].
      lcl_initialization=>gxt_utab_send[]   = gt_utab_send[].
      lcl_initialization=>bukrs             = p_bukrs.
      lcl_initialization=>r1                = p_r1.
      " Create handler.
      CREATE OBJECT event_receiver.
      " Register handler for events.
      SET HANDLER event_receiver->handle_hotspot_click FOR go_grid.
      CALL METHOD r_present_result->set_layout( CHANGING is_layout = is_layout ).
      " Create field catalog.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = i_structure_name
        CHANGING
          ct_fieldcat      = it_fieldcatalog.
      " Hotspot fields.
      CALL METHOD r_present_result->set_fieldcatalog
        EXPORTING
          i_r1            = p_r1
        CHANGING
          it_fieldcatalog = it_fieldcatalog.
      lcl_initialization=>it_fieldcatalog[] = it_fieldcatalog[].
      CALL METHOD go_grid->set_table_for_first_display
        EXPORTING
          i_structure_name = i_structure_name
          is_layout        = is_layout
        CHANGING
          it_fieldcatalog  = it_fieldcatalog
          it_outtab        = <psaareatab>.
      CALL METHOD go_grid->set_gridtitle
        EXPORTING
          i_gridtitle = i_gridtitle.
    ENDMODULE.                 " STATUS_0100  OUTPUT

    Hi.,
    Please Share your solution here.. It will be useful for others who are facing this kind of problem..!!
    Thanks & Regards,
    Kiran

  • Deactivate the double click/ hot spot for a particular row in alv grid.

    Hello,
       As per a certain condition how to deactivate the double click/ hot spot for a particular row in alv grid.
    Regards,
    Saroj

    where u define layout there is a field hotspot.like
    data: var.
    if con is true
    var = 'X'. (show hotspot)
    else.
    var = ' '. (deactive hotspot)
    elseif ws_fieldcat-fieldname = 'DMBTR'
                    AND ws_fieldcat-tabname = 'T_MTAB'.
          ws_fieldcat-do_sum = C_X.
          <b>ws_fieldcat-hotsopts = var.</b>
          MODIFY Wt_fieldcat FROM ws_fieldcat
                  TRANSPORTING   DO_SUM.
    It is helpful for u. if any problen send me ur coding i will change it.
    Regards
    Manish Kumar

  • Capture the ALV Hot Spot column on which the user had exactly clicked

    Hello Experts,
    I have an ALV in Web Dynpro with 4 columns of which two columns have hot spot action on them.
    Now when i click on the 1st column a pop up should appear and on click of the 2nd column a different Pop-up should appear.
    Now i have an even handler which handles the ON_CLICK event..
    Whenever i click on either of the columns the control will go to this event handler method.
    Now my doubt is how to capture the column on which the user had exactly clicked so that i can define actions seperately for each column.
    Reply is Appreciated.
    Thanks in Advance,
    Shravan

    Try This
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS:
          on_link_click FOR EVENT link_click OF cl_salv_events_table
            IMPORTING row column.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD on_link_click. 
       " Your business logic goes here. The variable *row* contains the row number and *column contains column name*.
      ENDMETHOD.
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    * Put this code just nefore you have used the display method of SALV.
        DATA: lo_event_handler TYPE REF TO lcl_event_handler.
        CREATE OBJECT lo_event_handler.
    * Register the event handler
        SET HANDLER lo_event_handler->on_link_click FOR lo_events.
    Hope this helps.
    Regards
    Mishra

  • View activity by clicking hotspot on ALV report

    Hi,
    I have a report with a ALV grid as output. This output cells represent different activities in CRM. By clicking on one cell, the hotspot gets activated and the selected activity should be opened.
    How can I implement to go into the selected activity?
    I already have implemented by method for the hotspot processing.
    What function do I have to use to jump into the activity?
    Thanks for your help!
    Caroline

    Hi,
    1. hotspot definition.
       **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,
    2.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.
      PERFORM HANDLE_HOTSPOT_CLICK USING E_ROW_ID E_COLUMN_ID ES_ROW_NO .
      ENDMETHOD.                    "lcl_event_handler
    FORM HANDLE_HOTSPOT_CLICK USING I_ROW_ID TYPE LVC_S_ROW
                                    I_COLUMN_ID TYPE LVC_S_COL
                                    IS_ROW_NO TYPE LVC_S_ROID.
      READ TABLE IT_FINAL INDEX I_ROW_ID  .
      IF SY-SUBRC = 0.
        IF I_COLUMN_ID-FIELDNAME = 'VGBEL'
                  AND NOT IT_FINAL-VGBEL IS INITIAL.
          PERFORM FORM_REFRESH.
          SET PARAMETER ID 'AUN' FIELD IT_FINAL-VGBEL.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
        ENDIF.
    **if user clicks on Delivery
        IF I_COLUMN_ID-FIELDNAME = 'VBELN'
                AND NOT IT_FINAL-VBELN IS INITIAL.
          PERFORM FORM_REFRESH.
          SET PARAMETER ID 'VL' FIELD IT_FINAL-VBELN.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        ENDIF.
    **if user clicks on Vendor Name
        IF I_COLUMN_ID-FIELDNAME = 'NAME'
                 AND NOT IT_FINAL-EBELN IS INITIAL.
          PERFORM FORM_REFRESH.
          SET PARAMETER ID 'BES' FIELD IT_FINAL-EBELN.
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDIF.
    ENDFORM.
    you need to use set_handler for hot_spot.
    regards
    vijay

  • Drill Down functionality in ALV Report

    Hi Experts,
    Gud Afternoon..!!!
    My Requirement: I have to display a report in ALV and if user click on vbeln the screen should go to transaction code VA43 for that particular contract.
    I used the below code,
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
    data:  w_vbeln type vbak-vbeln.
      IF r_ucomm EQ '&IC1' .   " Click value of hot spot
        CASE rs_selfield-fieldname.
          WHEN 'VBELN'.
            w_vbeln =  rs_selfield-value.
            SET PARAMETER ID 'AUN' FIELD w_vbeln.
            CALL TRANSACTION 'VA43' AND SKIP FIRST SCREEN.
        ENDCASE.
      ELSEIF r_ucomm EQ 'CANC'
            OR r_ucomm EQ 'BACK'
            OR r_ucomm EQ 'EXIT'.
        LEAVE PROGRAM.
      ENDIF.
    ENDFORM.                    " user_command
    I am getting error message in VA43 initial screen as "Enter the doc. no"
    Plz help me in this. Thanks in Advance..!!!
    Regards,
    Vadhu...

    Hi,
    Thanks Aakash Banga, Rimpa Abhishek..!!!
    I got the solution with help of SDN. The Solution as follows,
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      DATA:  w_vbeln TYPE vbak-vbeln.
      IF r_ucomm EQ '&IC1' .   " Click value of hot spot
        CASE rs_selfield-fieldname.
          WHEN 'VBELN'.
            w_vbeln =  rs_selfield-value.
            REFRESH t_bdcdata.
            CLEAR t_bdcdata.
            t_bdcdata-program  = 'SAPMV45A'.
            t_bdcdata-dynpro   = '102'.
            t_bdcdata-dynbegin = 'X'.
            APPEND t_bdcdata TO t_bdcdata.
            CLEAR t_bdcdata.
            t_bdcdata-fnam = 'BDC_CURSOR'.
            t_bdcdata-fval = 'VBAK-VBELN'.
            APPEND t_bdcdata TO t_bdcdata.
            CLEAR t_bdcdata.
            t_bdcdata-fnam = 'BDC_OKCODE'.
            t_bdcdata-fval = '=SUCH'.
            APPEND t_bdcdata TO t_bdcdata.
            CLEAR t_bdcdata.
            t_bdcdata-fnam = 'VBAK-VBELN'.
            t_bdcdata-fval = w_vbeln.
            APPEND t_bdcdata TO t_bdcdata.
            CLEAR t_bdcdata.
            t_bdcdata-program  = 'SAPMV45A'.
            t_bdcdata-dynpro   = '4001'.
            t_bdcdata-dynbegin = 'X'.
            APPEND t_bdcdata TO t_bdcdata.
            CALL TRANSACTION 'VA43' USING t_bdcdata MODE 'P' .
            CALL TRANSACTION 'VA43' AND SKIP FIRST SCREEN.
        ENDCASE.
      ELSEIF r_ucomm EQ 'CANC'
            OR r_ucomm EQ 'BACK'
            OR r_ucomm EQ 'EXIT'.
        LEAVE PROGRAM.
      ENDIF.
    ENDFORM.                    " user_command
    Thanks & Regards,
    Vadhu Duraisami

  • To change the colour of the particular cell of ALV report in Grid display.

    Hai Friends,
                      I have created an Alv report in grid display .In that i want to change the colour of the particular cell.Plz provide the answer with a solved example.
             Thank u.

    This works for a Custom Control and OO ALV in a Dialog Module
    TABLES: kna1.
    * Data (for the ALV Grid)
    TYPES:
      BEGIN OF t_alv_data,
        cust_id    TYPE kunnr,        "Customer Number
        cust_name  TYPE name1_gp,     "Customer Name
        cust_color TYPE i,
    *   cell coloring field
        color     TYPE lvc_t_scol,   "Cell coloring
      END OF t_alv_data.
    DATA:
      v_alv_data TYPE t_alv_data,
      i_alv_data TYPE STANDARD TABLE OF t_alv_data.
    * ALV grid containers and objects
    DATA:
      o_alv_grid TYPE REF TO cl_gui_alv_grid,
      o_alv_cont TYPE REF TO cl_gui_custom_container.
    * ALV field catalog
    DATA:
      i_alv_fc TYPE lvc_t_fcat,
      v_alv_fc LIKE lvc_s_fcat.
    * ALV Layout (colors)
    DATA:
      v_alv_layout TYPE lvc_s_layo,
      i_alv_color TYPE lvc_t_scol,
      v_alv_color TYPE lvc_s_scol,
      v_alv_color_cell TYPE lvc_s_colo.
    * ALV variant
    DATA:
      v_alv_variant  TYPE disvariant.
    PARAMETERS:
      p_alvvar TYPE disvariant-variant DEFAULT 'DEFAULT'.
    DATA: ok_code LIKE sy-ucomm.
    * Class for event handling
    *       CLASS lcl_event_receiver DEFINITION
    * [+] Event listener for the ALV grid
    * [+] Handles hotspots and data changes
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
    *     Hotspot clicking
          hotspot_click
               FOR EVENT hotspot_click OF cl_gui_alv_grid
                 IMPORTING e_row_id
                           e_column_id
                           es_row_no,
    *     Data changed (such as checkbox clicking)
          handle_data_changed
            FOR EVENT data_changed OF cl_gui_alv_grid
                IMPORTING er_data_changed.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    * [+] Implementation of the ALV Grid event handler class
    CLASS lcl_event_receiver IMPLEMENTATION.
    *       METHOD hotspot_click                                          *
    * [+] Calls evvent_hotspot_click when a hotspot is clicked in the ALV
      METHOD hotspot_click.
        PERFORM event_hotspot_click
                      USING e_row_id
                            e_column_id.
      ENDMETHOD.                    "hotspot_click
    *       METHOD handle_data_changed                                    *
    * [+] Updates the source data when the data in the ALV display has
    * been changed, such as by clicking a checkbox.
      METHOD handle_data_changed.
        DATA: lv_changed TYPE lvc_s_modi.
        LOOP AT er_data_changed->mt_good_cells INTO lv_changed
          WHERE fieldname = 'CUST_NAME'.
          READ TABLE i_alv_data INTO v_alv_data INDEX lv_changed-row_id.
          IF sy-subrc = 0.
            MOVE lv_changed-value TO v_alv_data-cust_name.
            MODIFY i_alv_data FROM v_alv_data INDEX lv_changed-row_id.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    * Reference to the event listener class
    DATA: event_receiver TYPE REF TO lcl_event_receiver.
    *       FORM build_event_listener
    * [+] Set the event handler on the ALV Grid
    FORM build_event_listener.
    * Assigning the event listener to the ALV
      CREATE OBJECT event_receiver.
      SET HANDLER event_receiver->handle_data_changed FOR o_alv_grid.
      SET HANDLER event_receiver->hotspot_click       FOR o_alv_grid.
    ENDFORM.                    "build_event_listener
    *       AT SELECTION-SCREEN
    *         ON VALUE-REQUEST FOR p_alvvar
    * [+] Calls choose_alv_variant to ask the user to select an alv grid
    *     layout variant
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_alvvar.
      PERFORM choose_alv_variant
        CHANGING
          p_alvvar
          v_alv_variant.
    *       START_OF_SELECTION
    START-OF-SELECTION.
      PERFORM get_data.
      SET PF-STATUS 'ALVSCREEN' IMMEDIATELY.
      CALL SCREEN 2000.
    *       FORM get_data
    * [+] Gets the data for the ALV grid
    FORM get_data.
      SELECT kunnr name1
        INTO (v_alv_data-cust_id,
              v_alv_data-cust_name)
        FROM kna1.
        APPEND v_alv_data TO i_alv_data.
      ENDSELECT.
    ENDFORM.                    "get_data
    *       MODULE build_alv_grid
    *   THIS SHOULD BE IN THE "PROCESS BEFORE OUTPUT" OF THE ALV SCREEN
    * [+] Builds the ALV Grid objects
    * [+] Calls to build the field catalog table
    * [+] Loads the field catalog table into the ALV Grid
    * [+] Loads the table data into the ALV Grid
    MODULE build_alv_grid OUTPUT.
      SET TITLEBAR  '2000'.
    * Also enables layout saving
      PERFORM set_alv_variant
        USING
          p_alvvar
        CHANGING
          v_alv_variant.
    * Building the grid and container on the screen
    * NOTE: the container name MUST be upper-case
    * Also, we don't want the objects to be created if in batch mode!
      IF sy-batch IS INITIAL.
        CREATE OBJECT o_alv_cont
          EXPORTING
            container_name = 'O_ALV_TABLE'.
      ENDIF.
      CREATE OBJECT o_alv_grid
        EXPORTING
          i_parent = o_alv_cont.
    * builds the event listener
      PERFORM build_event_listener.
    * Color the cells
      PERFORM color_cells.
    * Build the field catalog
      PERFORM build_alv_fc.
    * Loads the data into the grid
      CALL METHOD o_alv_grid->set_table_for_first_display
        EXPORTING
          i_save          = 'A'
          i_default       = 'X'
          is_variant      = v_alv_variant
          is_layout       = v_alv_layout
        CHANGING
          it_outtab       = i_alv_data
          it_fieldcatalog = i_alv_fc.
    ENDMODULE.                    "build_alv_grid OUTPUT
    *       FORM build_alv_fc
    * [+] Constructs the ALV Grid field catalog table
    FORM build_alv_fc.
      CLEAR i_alv_fc.
      REFRESH i_alv_fc.
    * NOTE: the field name MUST be upper-case
    *                   field       heading         hide  hot
    *                   name                        zero  spot  just
      PERFORM:
        alv_field USING 'CUST_ID'    'Cust ID'        ' '  'X'  'R',
        alv_field USING 'CUST_NAME'  'Customer Name'  ' '  ' '  'L',
        alv_field USING 'CUST_COLOR' 'Color'          ' '  ' '  'R'.
    ENDFORM.                    "build_alv_fc
    *       FORM alv_field
    * [+] Describes and constructs a single field for the ALV Grid field
    *     catalog. The field length and type are both obtained from the
    *     actual field passed in to this method.
    * [+] Adds the constructed field to the ALV Grid field catalog table
    FORM alv_field
      USING
        p_field_name TYPE c
        p_heading    TYPE c
        p_hide_zeros TYPE c
        p_hotspot    TYPE c
        p_justify    TYPE c.
      CLEAR v_alv_fc.
      DATA:
        lv_type(1) TYPE c,
        lv_length TYPE i,
        lv_heading_length TYPE i.
    * get the type and length of this field
      FIELD-SYMBOLS <field>.
      ASSIGN p_field_name TO <field>.
      DESCRIBE FIELD <field> TYPE lv_type OUTPUT-LENGTH lv_length.
    * re-adjust the length to the length of the header, if too short
      lv_heading_length = strlen( p_heading ).
      IF lv_length < lv_heading_length.
        lv_length = lv_heading_length.
      ENDIF.
    * NOTE: the field name MUST be upper-case
      v_alv_fc-fieldname = p_field_name.
      TRANSLATE v_alv_fc-fieldname TO UPPER CASE.
      v_alv_fc-inttype   = lv_type.
      v_alv_fc-outputlen = lv_length.
      v_alv_fc-coltext   = p_heading.
      v_alv_fc-seltext   = p_heading.
      v_alv_fc-hotspot   = p_hotspot.
    * Determining which fields should show zeros
      IF p_hide_zeros = 'X'.
        v_alv_fc-no_zero = 'X'.
        v_alv_fc-lzero   = ' '.
      ELSE.
        v_alv_fc-no_zero = ' '.
        v_alv_fc-lzero   = 'X'.
      ENDIF.
      v_alv_fc-just = p_justify.
    * Add the field to the field catalog
      APPEND v_alv_fc TO i_alv_fc.
    ENDFORM.                    "alv_field
    *       FORM choose_alv_variant
    * [+] Shows a popup that allows the user to choose the layout variant
    *     for the alv grid of the current program
    * [+] Usually called by an AT SELECTION-SCREEN method.
    FORM choose_alv_variant
      CHANGING
        p_variant_name TYPE disvariant-variant
        p_variant      TYPE disvariant.
      CLEAR p_variant.
      DATA:
        p_exit_check(1) TYPE c.
      MOVE sy-repid TO p_variant-report.
      CALL FUNCTION 'LVC_VARIANT_F4'
           EXPORTING
                is_variant = p_variant
                i_save     = 'A'
           IMPORTING
                e_exit     = p_exit_check
                es_variant = p_variant
           EXCEPTIONS
                not_found  = 1
                OTHERS     = 99.
      IF sy-subrc = 0.
        IF p_exit_check <> 'X'.
          p_variant_name = p_variant-variant.
        ENDIF.
      ENDIF.
    ENDFORM.                    "choose_alv_variant
    *       FORM set_alv_variant
    * [+] Sets the alv grid layout variant. Used for setting the variant
    *     when its name is entered in a parameter rather than by using the
    *     popup, or when loading the variant from a variable of type C
    FORM set_alv_variant
      USING
        p_variant_name TYPE disvariant-variant
      CHANGING
        p_variant      TYPE disvariant.
      MOVE sy-repid TO p_variant-report.
      p_variant-variant = p_variant_name.
    ENDFORM.                    "set_alv_variant
    *       FORM color_cells
    * [+] Loop through the data and apply coloring
    FORM color_cells.
      DATA:
        my_color  TYPE i.
    * tell the ALV grid what field in v_alv_data contains color information
      v_alv_layout-ctab_fname = 'COLOR'.
      my_color = 0.
    * loop through each row of the table
      LOOP AT i_alv_data INTO v_alv_data.
    *   clear the variables
        CLEAR:
          v_alv_color,
          v_alv_color_cell,
          i_alv_color.
        REFRESH:
          i_alv_color.
        v_alv_data-cust_color = my_color.
        PERFORM color_cell USING 'CUST_COLOR' my_color. "negative
    *   apply the colors
    *    IF v_alv_data-cust_name = 'Testing Credit'.
    *      PERFORM color_cell USING 'CUST_NAME' 6. "negative
    *    ELSEIF v_alv_data-cust_name = 'Goober Goober Also'.
    *      PERFORM color_cell USING 'CUST_NAME' 5. "positive
    *    ENDIF.
    *   set the color data for this table row
        v_alv_data-color = i_alv_color.
        MODIFY i_alv_data FROM v_alv_data.
        my_color = my_color + 1.
        IF my_color GT 7.
          CLEAR my_color.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "color_cells
    *       FORM color_cell
    * [+] Colors a cell in the ALV grid
    FORM color_cell
      USING
        p_cellname TYPE c
        p_color    TYPE i.
      CLEAR:
        v_alv_color_cell,
        v_alv_color.
    * set the color for the cell
    *  IF p_color = 0.
    *    v_alv_color_cell-col = 0. "cl_gui_resources=>list_col_background.
    *  ELSEIF p_color = 1.
    *    v_alv_color_cell-col = 1. "cl_gui_resources=>list_col_heading.
    *  ELSEIF p_color = 2.
    *    v_alv_color_cell-col = 2. "cl_gui_resources=>list_col_normal.
    *  ELSEIF p_color = 3.
    *    v_alv_color_cell-col = 3. "cl_gui_resources=>list_col_total.
    *  ELSEIF p_color = 4.
    *    v_alv_color_cell-col = 4. "cl_gui_resources=>list_col_key.
    *  ELSEIF p_color = 5.
    *    v_alv_color_cell-col = 5. "cl_gui_resources=>list_col_positive.
    *  ELSEIF p_color = 6.
    *    v_alv_color_cell-col = 6. "cl_gui_resources=>list_col_negative.
    *  ELSEIF p_color = 7.
    *    v_alv_color_cell-col = 7. "cl_gui_resources=>list_col_group.
    *  ENDIF.
      v_alv_color_cell-col = p_color.
      v_alv_color-nokeycol = 'X'.
      v_alv_color-fname = p_cellname.
    *  v_alv_color-color = p_color.
      v_alv_color-color = v_alv_color_cell.
      APPEND v_alv_color TO i_alv_color.
    ENDFORM.                    "color_cell
    *       FORM event_hotspot_click
    * [+] What to do when clicking on a hotspot in the ALV Grid
    FORM event_hotspot_click
      USING
        p_row    TYPE lvc_s_row
        p_column TYPE lvc_s_col.
      DATA:
        lv_docnum TYPE kunnr.
      READ TABLE i_alv_data INTO v_alv_data INDEX p_row-index.
      IF p_column = 'CUST_ID'.
    *   call a transaction when the cust_id is clicked
        SET PARAMETER ID 'AUN' FIELD v_alv_data-cust_id.
        CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      ENDIF.
    ENDFORM.                    "event_hotspot_click
    *&      Module  USER_COMMAND_2000  INPUT
    *       text
    MODULE user_command_2000 INPUT.
      CASE ok_code.
        WHEN 'BACK'
          OR 'STOP'
          OR 'CANCEL'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_2000  INPUT

  • Anyone know of an ALV report in SAP that has Hotspot logic?

    Howdy,
    Does Anyone know of an ALV report in SAP that has Hotspot logic?
    I just need to implement this logic into my report and I thought I'd copy what was there.
    Also, anyone know of a report where buttons are available in the cells of an ALV grid?
    Thanksing you kindly.

    Hi Steve,
    it'a a report with alv grid, where i use hot spot event,
    i hope it helps you.
    bye
    *& Report  ZMONITOR_IP                                                 *
    REPORT  zmonitor_ip                             .
    TABLES: mapl, plko
    *****SELECTION-SCREEN.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_matnr  FOR mapl-matnr,
                    s_plnty  FOR mapl-plnty,
                    s_zaehl  FOR plko-zaehl,
                    s_verwe  FOR plko-verwe,
                    s_plnnr  FOR plko-plnnr,
                    s_plnal  FOR plko-plnal,
                    s_plnty2 FOR plko-plnty.
    SELECTION-SCREEN: END OF BLOCK b1.
    **********TYPES:
    TYPES: BEGIN OF str_data,
             matnr    TYPE mapl-matnr,
             werks    TYPE plko-werks,
             plnal    TYPE plko-plnal,
             plnnr    TYPE plko-plnnr,
           END OF str_data.
    TYPES: BEGIN OF str_data2,
            prueflos TYPE qals-prueflos,
            art      TYPE qals-art,
            herkunft TYPE qals-herkunft,
            enstehdat TYPE qals-enstehdat,
            END OF str_data2.
    ****Global data.
    DATA: tb_plko TYPE TABLE OF plko,
          wa_plko TYPE plko,
          tb_mapl TYPE TABLE OF mapl,
          wa_mapl TYPE TABLE OF mapl,
          tb_data TYPE TABLE OF str_data,
          wa_data TYPE str_data,
          pos1 TYPE i,
          pos2 TYPE i,
          pos3 TYPE i,
          pos4 TYPE i,
          pos5 TYPE i,
          okcode_100 TYPE sy-ucomm,
          tb_data2 TYPE TABLE OF str_data2.
    ***********************VARIABILI E STRUTTURE PER ALV********************
    *       CLASS lcl_event_handler DEFINITION
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION .
        METHODS:
    *To add new functional buttons to the ALV toolbar
    *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,
    *Double-click control
    handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
                        IMPORTING e_row e_column es_row_no.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    *Handle Hotspot Click METHOD handle_hotspot_click .
        PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
      ENDMETHOD .                    "lcl_event_handler
    *Handle Double Click
      METHOD handle_double_click .
        PERFORM handle_double_click USING e_row e_column es_row_no .
      ENDMETHOD .                    "handle_double_click
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    *--- ALV Grid instance reference
    DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.
    DATA gr_alvgrid2 TYPE REF TO cl_gui_alv_grid.
    *--- Name of the custom control added on the screen
    DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
    DATA gc_custom_control_name2 TYPE scrfname VALUE 'CC_ALV2'.
    *--- Customer contanier instance reference
    DATA gr_ccontainer TYPE REF TO cl_gui_custom_container.
    DATA gr_ccontainer2 TYPE REF TO cl_gui_custom_container.
    *--- Field catalog table
    DATA gt_fieldcat TYPE lvc_t_fcat.
    DATA gt_fieldcat2 TYPE lvc_t_fcat.
    *--- Layout structure
    DATA gs_layout TYPE lvc_s_layo.
    DATA gs_layout2 TYPE lvc_s_layo.
    DATA ls_variant       TYPE disvariant.
    DATA gr_event_handler TYPE REF TO lcl_event_handler .
    ****INITIALIZZATION
    INITIALIZATION.
      pos1 = 4.
      pos2 = pos1 + 20.
      pos3 = pos2 + 10.
      pos4 = pos3 + 10.
      pos5 = pos4 + 10.
    *****TOP OF PAGE
    TOP-OF-PAGE.
      WRITE AT /pos1 'Material'.
      WRITE AT pos2  'Plan'.
      WRITE AT pos3 'Group'.
      WRITE AT pos4 'Group Count'.
      SKIP 1.
    *****AT USER COMMAND.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    AT LINE-SELECTION.
      PERFORM select_line.
    *****START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM output.
    END-OF-SELECTION.
    ****END-OF-SELCTION.
    *&      Form  select_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_data .
      SELECT   b~werks b~plnal b~plnnr a~matnr
               FROM plko AS b
               JOIN mapl AS a
               ON ( a~plnty = b~plnty AND
                   a~plnnr = b~plnnr AND
                   a~plnal = b~plnal )
               INTO CORRESPONDING FIELDS OF TABLE tb_data
               WHERE
                 a~matnr IN s_matnr  AND
                 a~plnty IN s_plnty  AND
                 b~zaehl IN s_zaehl  AND
                 b~verwe IN s_verwe  AND
                 b~plnnr IN s_plnnr  AND
                 b~plnal IN s_plnal  AND
                 b~plnty IN s_plnty2 .
    ENDFORM.                    " select_data
    *&      Form  OUTPUT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM output .
      CALL SCREEN '0100'.
    ENDFORM.                    " OUTPUT
    *&      Form  SELECT_LINE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_line .
      DATA line TYPE i.
      CLEAR wa_data.
      GET CURSOR LINE line.
      READ LINE line FIELD VALUE wa_data-matnr  INTO wa_data-matnr.
      READ LINE line FIELD VALUE wa_data-werks  INTO wa_data-werks.
      READ LINE line FIELD VALUE wa_data-plnnr  INTO wa_data-plnnr.
      READ LINE line FIELD VALUE wa_data-plnal  INTO wa_data-plnal.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      SET PARAMETER ID 'MAT' FIELD wa_data-matnr.
      SET PARAMETER ID 'WRK' FIELD wa_data-werks.
      SET PARAMETER ID 'QHK' FIELD '89'.
      SET PARAMETER ID 'PLN' FIELD wa_data-plnnr.
      SET PARAMETER ID 'PAL' FIELD wa_data-plnal.
      CALL TRANSACTION 'QA01' AND SKIP FIRST SCREEN.
      SET PARAMETER ID 'PLN' FIELD ' '.
      SET PARAMETER ID 'PAL' FIELD ' '.
    ENDFORM.                    " SELECT_LINE
    *&      Form  prepare_field_catalog
    *       text
    *      -->PT_FIELDCATtext
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat .
      DATA ls_fcat TYPE lvc_s_fcat .
      ls_fcat-fieldname = 'MATNR' .
    *  ls_fcat-inttype = 'C' .
      ls_fcat-outputlen = '18' .
      ls_fcat-hotspot = 'X'.
      ls_fcat-coltext = 'Material' .
      ls_fcat-seltext = 'Material' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'WERKS' .
    *  ls_fcat-outputlen = '30' .
      ls_fcat-coltext = 'Plant' .
      ls_fcat-seltext = 'Plant' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'PLNNR' .
    *  ls_fcat-outputlen = '6' .
      ls_fcat-coltext = 'Orig. IP' .
      ls_fcat-seltext = 'Orig. IP' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'PLNAL' .
    *  ls_fcat-outputlen = '6' .
      ls_fcat-coltext = 'Orig. IP Conuter' .
      ls_fcat-seltext = 'Orig. IP Conuter' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
    ENDFORM .                    "prepare_field_catalog
    *&      Form  prepare_layout
    *       text
    *      -->PS_LAYOUT  text
    FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
      ps_layout-zebra = 'X' .
      ps_layout-grid_title = '' .
      ps_layout-smalltitle = 'X' .
      ps_layout-sel_mode = 'B'.
    ENDFORM. " prepare_layout
    *&      Module  DISPLAY  OUTPUT
    *       text
    MODULE display OUTPUT.
    ***ALV.
      IF gr_alvgrid IS INITIAL AND
         gr_alvgrid2 IS INITIAL.
    *----Creating custom container instance
        CREATE OBJECT gr_ccontainer
           EXPORTING
           container_name = gc_custom_control_name
           EXCEPTIONS
           cntl_error = 1
           cntl_system_error = 2
           create_error = 3
           lifetime_error = 4
           lifetime_dynpro_dynpro_link = 5
           OTHERS = 6 .
        CREATE OBJECT gr_ccontainer2
            EXPORTING
            container_name = gc_custom_control_name2
            EXCEPTIONS
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS = 6 .
    *----creating alv grid instance
        CREATE OBJECT gr_alvgrid
        EXPORTING
        i_parent = gr_ccontainer
        EXCEPTIONS
        error_cntl_create = 1
        error_cntl_init = 2
        error_cntl_link = 3
        error_dp_create = 4
        OTHERS = 5 .
        CREATE OBJECT gr_event_handler .
        SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid .
        SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid .
    *----Preparing field catalog.
        PERFORM prepare_field_catalog CHANGING gt_fieldcat .
    *----Preparing layout structure
        PERFORM prepare_layout CHANGING gs_layout .
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
        CALL METHOD gr_alvgrid->set_table_for_first_display
        EXPORTING
    * I_BUFFER_ACTIVE =
    * I_CONSISTENCY_CHECK =
    * I_STRUCTURE_NAME =
    is_variant = ls_variant
    i_save = 'A'
    * I_DEFAULT = 'X'
        is_layout = gs_layout
    * IS_PRINT =
    * IT_SPECIAL_GROUPS =
    * IT_TOOLBAR_EXCLUDING =
    * IT_HYPERLINK =
        CHANGING
        it_outtab = tb_data
        it_fieldcatalog = gt_fieldcat
    * IT_SORT =
    * IT_FILTER =
        EXCEPTIONS
        invalid_parameter_combination = 1
        program_error = 2
        too_many_lines = 3
        OTHERS = 4 .
      ELSE .
        CALL METHOD gr_alvgrid->refresh_table_display
    * EXPORTING
    * IS_STABLE =
    * I_SOFT_REFRESH =
        EXCEPTIONS
        finished = 1
        OTHERS = 2 .
      ENDIF .
    ENDMODULE.                 " DISPLAY  OUTPUT
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'MONITOR'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE okcode_100.
        WHEN 'BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  handle_hotspot_click
    *       text
    *      -->I_ROW_ID   text
    *      -->I_COLUMN_IDtext
    *      -->IS_ROW_NO  text
    FORM handle_hotspot_click USING i_row_id TYPE lvc_s_row
                                    i_column_id TYPE lvc_s_col
                                    is_row_no TYPE lvc_s_roid.
      READ TABLE tb_data INDEX is_row_no-row_id INTO wa_data.
      SELECT * FROM qals INTO CORRESPONDING FIELDS OF TABLE tb_data2
                WHERE selmatnr = wa_data-matnr AND
                      werk     = wa_data-werks .
      IF gr_alvgrid2 IS INITIAL.
        CREATE OBJECT gr_alvgrid2
      EXPORTING
      i_parent = gr_ccontainer2
      EXCEPTIONS
      error_cntl_create = 1
      error_cntl_init = 2
      error_cntl_link = 3
      error_dp_create = 4
      OTHERS = 5 .
    *----preparing field catalog.
        PERFORM prepare_field_catalog2 CHANGING gt_fieldcat2 .
    *----Preparing layout structure
        PERFORM prepare_layout CHANGING gs_layout2 .
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
        CALL METHOD gr_alvgrid2->set_table_for_first_display
        EXPORTING
    * I_BUFFER_ACTIVE =
    * I_CONSISTENCY_CHECK =
    * I_STRUCTURE_NAME =
    is_variant = ls_variant
    i_save = 'A'
    * I_DEFAULT = 'X'
        is_layout = gs_layout2
    * IS_PRINT =
    * IT_SPECIAL_GROUPS =
    * IT_TOOLBAR_EXCLUDING =
    * IT_HYPERLINK =
        CHANGING
        it_outtab = tb_data2
        it_fieldcatalog = gt_fieldcat2
    * IT_SORT =
    * IT_FILTER =
        EXCEPTIONS
        invalid_parameter_combination = 1
        program_error = 2
        too_many_lines = 3
        OTHERS = 4 .
      ELSE.
        CALL METHOD gr_alvgrid2->refresh_table_display
    * EXPORTING
    * IS_STABLE =
    * I_SOFT_REFRESH =
      EXCEPTIONS
      finished = 1
      OTHERS = 2 .
      ENDIF.
    *  call screen 100.
    ENDFORM .                    "handle_hotspot_click
    *&      Form  prepare_field_catalog2
    *       text
    *      <--P_GT_FIELDCAT2  text
    FORM prepare_field_catalog2 CHANGING pt_fieldcat TYPE lvc_t_fcat .
      DATA ls_fcat TYPE lvc_s_fcat .
      ls_fcat-fieldname = 'PRUEFLOS' .
      ls_fcat-outputlen = '23' .
      ls_fcat-coltext = 'Inspection Lot Number' .
      ls_fcat-seltext = 'Inspection Lot Number' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'ART' .
      ls_fcat-coltext = 'Inspection Type' .
      ls_fcat-seltext = 'Inspection Type' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'HERKUNFT' .
      ls_fcat-coltext = 'Inspection Lot Origin' .
      ls_fcat-seltext = 'Inspection Lot Origin' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'ENSTEHDAT' .
      ls_fcat-coltext = 'Date of Lot Creation' .
      ls_fcat-seltext = 'Date of Lot Creation' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
    ENDFORM.                    " prepare_field_catalog2
    *&      Form  handle_double_click
    *       text
    *      -->I_ROW      text
    *      -->I_COLUMN   text
    *      -->IS_ROW_NO  text
    FORM handle_double_click USING i_row TYPE lvc_s_row
                                   i_column TYPE lvc_s_col
                                   is_row_no TYPE lvc_s_roid.
      CLEAR wa_data.
      READ TABLE tb_data INDEX i_row-index INTO wa_data.
      SET PARAMETER ID 'MAT' FIELD wa_data-matnr.
      SET PARAMETER ID 'WRK' FIELD wa_data-werks.
      SET PARAMETER ID 'QHK' FIELD '89'.
      SET PARAMETER ID 'PLN' FIELD wa_data-plnnr.
      SET PARAMETER ID 'PAL' FIELD wa_data-plnal.
      CALL TRANSACTION 'QA01' AND SKIP FIRST SCREEN.
      SET PARAMETER ID 'PLN' FIELD ' '.
      SET PARAMETER ID 'PAL' FIELD ' '.
    ENDFORM .                    "handle_double_click

  • ALV report using OOPS concept.

    Hi,
    Please help me in writing ALV report using OOPS concept as i have never used this concept before.Please post a clear picture for this.
    Thanks in advance.

    Hi
    Refer this code:
    REPORT zcls_alv_oops MESSAGE-ID z1.
    TABLES : mara.
    Types Declaration..\
    TYPES :
    BEGIN OF t_mara,
    matnr TYPE matnr,
    mtart TYPE mtart,
    maktx TYPE maktx,
    END OF t_mara,
    BEGIN OF t_marc,
    matnr TYPE matnr,
    werks TYPE werks_d,
    mtart TYPE mtart,
    maktx TYPE maktx,
    END OF t_marc.
    Internal Tables Declaration..\
    DATA :
    i_mara TYPE TABLE OF t_mara,
    i_marc TYPE TABLE OF t_marc,
    i_fcat1 TYPE lvc_t_fcat,
    i_fcat2 TYPE lvc_t_fcat.
    Constants Declaration..\
    CONSTANTS :
    c_cont1 TYPE scrfname VALUE 'CONT1',
    c_cont2 TYPE scrfname VALUE 'CONT2'.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    SELECT-OPTIONS:
    s_matnr FOR mara-matnr NO INTERVALS.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS :
    p_hotspt RADIOBUTTON GROUP r1 DEFAULT 'X',
    p_bttn RADIOBUTTON GROUP r1.
    SELECTION-SCREEN END OF BLOCK b1.
    \* Class forward referncing.
    CLASS lcl_rcvr_class DEFINITION DEFERRED.
    \* Pointers Declaration..
    DATA :
    lp_rcvr TYPE REF TO lcl_rcvr_class,
    lp_cont1 TYPE REF TO cl_gui_custom_container,
    lp_cont2 TYPE REF TO cl_gui_custom_container,
    lp_grid1 TYPE REF TO cl_gui_alv_grid,
    lp_grid2 TYPE REF TO cl_gui_alv_grid.
    \* Local Class Definiton.
    CLASS lcl_rcvr_class 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,
    handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
    IMPORTING e_row e_column.
    ENDCLASS.
    \* Local Class Implementation.
    CLASS lcl_rcvr_class IMPLEMENTATION.
    METHOD hotspot_click.
    DATA :
    wa_mara TYPE t_mara,
    wa_marc TYPE t_marc.
    DATA :
    l_index TYPE sy-tabix.
    READ TABLE i_mara INTO wa_mara INDEX e_row_id-index.
    IF sy-subrc EQ 0.
    REFRESH i_marc.
    SELECT matnr
    werks
    INTO TABLE i_marc
    FROM marc
    WHERE matnr EQ wa_mara-matnr.
    IF sy-subrc EQ 0.
    LOOP AT i_marc INTO wa_marc.
    l_index = sy-tabix.
    wa_marc-mtart = wa_mara-mtart.
    wa_marc-maktx = wa_mara-maktx.
    MODIFY i_marc FROM wa_marc INDEX l_index
    TRANSPORTING mtart maktx.
    ENDLOOP.
    CALL SCREEN 200.
    ELSE.
    MESSAGE e121 WITH text-005 wa_mara-matnr.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD handle_double_click.
    DATA :
    wa_mara TYPE t_mara,
    wa_marc TYPE t_marc.
    DATA :
    l_index TYPE sy-tabix.
    READ TABLE i_mara INTO wa_mara INDEX e_row-index.
    IF sy-subrc EQ 0.
    REFRESH i_marc.
    SELECT matnr
    werks
    INTO TABLE i_marc
    FROM marc
    WHERE matnr EQ wa_mara-matnr.
    IF sy-subrc EQ 0.
    LOOP AT i_marc INTO wa_marc.
    l_index = sy-tabix.
    wa_marc-mtart = wa_mara-mtart.
    wa_marc-maktx = wa_mara-maktx.
    MODIFY i_marc FROM wa_marc INDEX l_index
    TRANSPORTING mtart maktx.
    ENDLOOP.
    CALL SCREEN 200.
    ELSE.
    MESSAGE e121 WITH text-005 wa_mara-matnr.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    ENDCLASS.
    \* Start of Selection
    START-OF-SELECTION.
    \* Extract the Material Master data for the Input Material.
    SELECT a~matnr
    a~mtart
    b~maktx
    INTO TABLE i_mara
    FROM mara AS a
    INNER JOIN makt AS b
    ON a~matnr EQ b~matnr
    WHERE a~matnr IN s_matnr
    AND b~spras EQ sy-langu.
    END-OF-SELECTION.
    IF NOT i_mara\[\] IS INITIAL.
    \* Call Screen to display the Material Master data.
    CALL SCREEN 100.
    ELSE.
    MESSAGE s121 WITH text-006.
    ENDIF.
    \*& Module DISP_GRID OUTPUT
    \* text
    MODULE disp_grid OUTPUT.
    \* Build the Field catelog for Material Master data.
    PERFORM build_fcat.
    \* Display the Material Master data using ALV.
    PERFORM disp_alv.
    ENDMODULE. " DISP_GRID OUTPUT
    \*& Module USER_COMMAND_0100 INPUT
    \* text
    MODULE user_command_0100 INPUT.
    \*when exit or cancel is clicked program has to come out
    CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC'.
    LEAVE PROGRAM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    \*& Form build_fcat
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM build_fcat.
    DATA : ws_fcat TYPE lvc_s_fcat.
    ws_fcat-fieldname = 'MATNR'.
    ws_fcat-scrtext_m = text-001.
    ws_fcat-tabname = 'I_MARA'.
    IF p_hotspt EQ 'X'.
    ws_fcat-hotspot = 'X'.
    ENDIF.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MTART'.
    ws_fcat-scrtext_m = text-002.
    ws_fcat-tabname = 'I_MARA'.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MAKTX'.
    ws_fcat-scrtext_m = text-003.
    ws_fcat-tabname = 'I_MARA'.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ENDFORM. " build_fcat
    \*& Form disp_alv
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM disp_alv.
    IF lp_cont1 IS INITIAL.
    \* Create the Container Object of Material Master.
    CREATE OBJECT lp_cont1
    EXPORTING
    container_name = c_cont1
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6 .
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Create the Object for Grid of Material Master.
    CREATE OBJECT lp_grid1
    EXPORTING
    i_parent = lp_cont1
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Dipslay Material Master data by calling method.
    CALL METHOD lp_grid1->set_table_for_first_display
    CHANGING
    it_outtab = i_mara
    it_fieldcatalog = i_fcat1
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Set Handler for the Hot Spot Event.
    CREATE OBJECT lp_rcvr.
    IF p_hotspt EQ 'X'.
    SET HANDLER lp_rcvr->hotspot_click FOR lp_grid1.
    ELSE.
    SET HANDLER lp_rcvr->handle_double_click FOR lp_grid1.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDFORM. " disp_alv
    \*& Module STATUS_0100 OUTPUT
    \* text
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'MAIN_STAT'.
    SET TITLEBAR 'T_100'.
    ENDMODULE. " STATUS_0100 OUTPUT
    \*& Module STATUS_0200 OUTPUT
    \* text
    MODULE status_0200 OUTPUT.
    SET PF-STATUS 'PLANT_STAT'.
    SET TITLEBAR 'T_200'.
    ENDMODULE. " STATUS_0200 OUTPUT
    \*& Module DISP_GRID_plant OUTPUT
    \* text
    MODULE disp_grid_plant OUTPUT.
    \* Build the Field catelog for Material Plant data.
    PERFORM build_fcat_plant.
    \* Display the Material Master Plant data using ALV.
    PERFORM disp_alv_plant.
    ENDMODULE. " DISP_GRID_plant OUTPUT
    \*& Module USER_COMMAND_0200 INPUT
    \* text
    MODULE user_command_0200 INPUT.
    \*when exit or cancel is clicked program has to come out
    CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC'.
    LEAVE PROGRAM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0200 INPUT
    \*& Form build_fcat_plant
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM build_fcat_plant.
    DATA : ws_fcat TYPE lvc_s_fcat.
    ws_fcat-fieldname = 'MATNR'.
    ws_fcat-scrtext_m = text-001.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'WERKS'.
    ws_fcat-scrtext_m = text-004.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MTART'.
    ws_fcat-scrtext_m = text-002.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MAKTX'.
    ws_fcat-scrtext_m = text-003.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ENDFORM. " build_fcat_plant
    \*& Form disp_alv_plant
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM disp_alv_plant.
    IF lp_cont2 IS INITIAL.
    \* Create the Container Object of Material Plant data.
    CREATE OBJECT lp_cont2
    EXPORTING
    container_name = c_cont2
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Create the Object for Grid of Material Plant data.
    CREATE OBJECT lp_grid2
    EXPORTING
    i_parent = lp_cont2
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Dipslay Material Plant data by calling method.
    CALL METHOD lp_grid2->set_table_for_first_display
    CHANGING
    it_outtab = i_marc
    it_fieldcatalog = i_fcat2
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    ENDIF.
    ELSE.
    \* Call method 'REFRESH_TABLE_DISPLAY' to refresh the grid data.
    CALL METHOD lp_grid2->refresh_table_display.
    ENDIF.
    ENDFORM. " disp_alv_plant
    Thanks
    Vasudha

  • Removing undeline from the hot spot column ( REUSE_ALV_GRID_DISPLAY )

    Hi
    I am using the Hot Spot for the columns in ALV report.
    I need to remove the underline from the column values here.
    How to do that.
    Amol

    One thing we have done with ALV is to not use the hotspots. We have the users double click on a cell, rather than single click. In the command processing routine, the system still receives the correct field name for deterining the processing, etc.
    The other advantage is that this allows us to copy and paste much easier individual fields fdrom the ALV without jumping to a new function unintentionally. The disadvantage is that you cannot see which fields have links.
    Remove the hotspot from the field, run the program, and double click on the field. It will still call the command processor, and the underline is gone.
    Just an idea based on something we had to do becuase of the copy/paste issue.

  • Hot spot for field based on field value

    Hi,
    Im using ALV list to display report. And I have enable hot spot for that field based on field value. For example, If the field has value " 0 " then hotspot should be enabled for that field. If the field has value " 1 " then it should be displayed as normal field without hotspot.
    Can anyone tell me how to do this?
    Thanks,
    Amal

    Hi Amal
    Do this
    In your final internal table
    add a table type
    gi_cellstyles TYPE lvc_t_styl
    Then (while populating output)
    FORM prepare_edit_output.
    * say your field is 'field'
      DATA : lw_stylerow TYPE lvc_s_styl,
             li_styletab TYPE lvc_t_styl.
      IF gw_output-field = '0'.
        CLEAR lw_stylerow.
        lw_stylerow-fieldname = 'FIELD'.
        lw_stylerow-style     = cl_gui_alv_grid=>mc_style_hotspot.
        APPEND lw_stylerow TO li_styletab.
      ELSEIF gw_output-field = '1'.
        CLEAR lw_stylerow.
        lw_stylerow-fieldname = 'FIELD'.
        lw_stylerow-style     = cl_gui_alv_grid=>mc_style_hotspot_no.
        APPEND lw_stylerow TO li_styletab.
      ENDIF.
      INSERT LINES OF li_styletab INTO TABLE gw_output-gi_cellstyles.
    ENDFORM.
    In your layout building
        gw_layout-stylefname = 'GI_CELLSTYLES'.
    Pushpraj

Maybe you are looking for