Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

hotspot functionality in OO ALV

Former Member
0 Likes
20,032

In my report, I am using set_table_for_first_display to display purchase order number, material docu. number.

I had used the splitter control to show two internal tables .

I had created hotspots for purchasing docu number in the first table .

If I click on purchasing docu number it has to call transaction ME23N for the purchase order number .

But while debugging I can not pass the row id and column id. I had used set handler methods and all properly. I doubt the problem with capturing column and row id for the hotspot field .Following is my code.

CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS on_hotspot_click
       FOR EVENT hotspot_click OF cl_gui_alv_grid
       IMPORTING
         !e_row_id
         !es_row_no .


ENDCLASS.                    "lcl_event_receiver DEFINITION
PERFORM display_data.
*----------------------------------------------------------------------*
*       CLASS lcl_event_receiver IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.


  METHOD  on_hotspot_click.
    DATA: ls_output LIKE LINE OF it_zadcstohdr_new .
    DATA : l_columnid TYPE lvc_s_col,
           l_roid TYPE lvc_s_roid.
    

    READ TABLE it_zadcstohdr_new INTO wa_zadcstohdr_new INDEX l_roid-row_id.
    IF sy-subrc = 0 AND l_columnid-fieldname = 'VBELN'.
*SELECT SINGLE * FROM LFB1 INTO LFB1 WHERE lifnr = ls_output-lifnr.

      SET PARAMETER ID 'VL' FIELD wa_zadcstohdr_new-vbeln.

      CALL TRANSACTION 'VL03N'.
    ENDIF.
  ENDMETHOD.                    "handle_double_clickENDCLASS.

Moderator message - Please use code tags to format your code

Edited by: Rob Burbank on Jan 20, 2010 9:52 AM

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
5,996

set the event handler after the grid has been called.

check this link for reference link:[http://wiki.sdn.sap.com/wiki/display/Snippets/InteractiveALVUsingABAPObjects]

Edited by: Keshav.T on Jan 20, 2010 8:31 PM

5 REPLIES 5
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
5,997

set the event handler after the grid has been called.

check this link for reference link:[http://wiki.sdn.sap.com/wiki/display/Snippets/InteractiveALVUsingABAPObjects]

Edited by: Keshav.T on Jan 20, 2010 8:31 PM

Read only

guilherme_frisoni
Contributor
0 Likes
5,996

Hi,

you should use e_row_id, don't need to declare l_roid.

Regards,

Frisoni

Read only

Former Member
0 Likes
5,996

Hello gayathri,

Use the link..Hope your issue will be resolved.

http://wiki.sdn.sap.com/wiki/display/HOME/objectorientedProgramminginALV

Read only

Former Member
0 Likes
5,996

hi,

CLASS LCL_EVENT_RECEIVER DEFINITION .

  PUBLIC SECTION.
*---Method to handel hotspot
    METHODS :
    HANDEL_HOTSPOT_CLICK
      FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
      IMPORTING E_ROW_ID E_COLUMN_ID.

ENDCLASS .

CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.

*-----Logic to handle the HOTSPOT click
  METHOD HANDEL_HOTSPOT_CLICK.
*---To handel hotspot in the firstlist
    PERFORM HANDEL_HOTSPOT_CLICK USING E_ROW_ID E_COLUMN_ID.

  ENDMETHOD.                    "HANDEL_HOTSPOT_CLICK

ENDCLASS.

FORM HANDEL_HOTSPOT_CLICK  USING    P_E_ROW_ID TYPE ANY
                                    P_E_COLUMN_ID TYPE ANY.

" logic
ENDFORM.

regards

Gaurav

Read only

Former Member
0 Likes
5,996

Hi

check this code for reference

CLASS ZCL_EVENT_HANDLER DEFINITION.     " To handle events of first screen oops alv
  PUBLIC SECTION.
    METHODS:
    HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW_ID E_COLUMN_ID,
"method to handle hotspot event
ENDCLASS.                    "Zcl_event_handler DEFINITION

CLASS ZCL_EVENT_HANDLER IMPLEMENTATION.
 METHOD HANDLE_HOTSPOT_CLICK.
    IF E_COLUMN_ID = 'KUNNR'.
      PERFORM HANDLE_HOTSPOT_ON_CUSTOMER_NUM USING E_ROW_ID.   " Subroutine to handle hotspot on customer number
    ENDIF.
  ENDMETHOD.                    "HANDLE_HOTSPOT_CLICK

FORM HANDLE_HOTSPOT_ON_CUSTOMER_NUM USING VALUE(P_E_ROW_ID).

*-------------------------------------------------------------Pass the customer number clicked
  SET PARAMETER ID 'KUN' FIELD WA_DISP1-KUNNR.
*-------------------------------------------------------------call transaction to display tghe vendor
  CALL TRANSACTION 'XD03'.
ENDFORM.                    " HANDLE_HOTSPOT_ON_CUSTOMER_NUM

CALL METHOD MY_ALV1->SET_TABLE_FOR_FIRST_DISPLAY

"now set the handler
*-------------------------------------------------------------set handler for hotspot click on oops alv
    SET HANDLER EVENT->HANDLE_HOTSPOT_CLICK FOR MY_ALV1.

Regards Anshul