2013 Apr 04 12:02 PM
hi,
i did a development for alv report in object oriented .. but OO alv hotspot not work .
class lcl_report definition.
public section.
*----------------------------------------------------------------------*
* Final Output Table
*----------------------------------------------------------------------*
methods:generate_output,
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid " hotspot
IMPORTING e_row_id e_column_id es_row_no.
endclass.
class lcl_report implementation.
method: generate_output.
*****hotspot
data: lr_columns type ref to cl_salv_columns,
lr_column type ref to cl_salv_column_table.
lr_column ?= lr_columns->get_column( 'MATNR' ).
lr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
endmethod.
METHOD handle_hotspot_click.
PERFORM f_event_hotspot_click USING e_row_id e_column_id es_row_no.
ENDMETHOD.
FORM f_event_hotspot_click USING fp_row_id TYPE lvc_s_row
fp_column_id TYPE lvc_s_col
fp_row_no TYPE lvc_s_roid.
CLEAR: gs_final.
READ TABLE gt_final INTO gs_final INDEX fp_row_no-row_id.
IF sy-subrc EQ 0.
if fp_column_id = 'MATNR'.
SET PARAMETER ID 'MAT' FIELD gs_final-matnr.
CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.
ENDIF.
endif.
ENDFORM.
start-of-selection.
*----------------------------------------------------------------------*
data: lo_report type ref to lcl_report.
DATA: g_grid TYPE REF TO cl_gui_alv_grid,
g_receiver TYPE REF TO lcl_report. "handler.
create object lo_report.
lo_report->generate_output( ).
SET HANDLER g_receiver->handle_hotspot_click FOR g_grid .
i'm getting a dump says
SET HANDLER: Reference to handler object cannot be NULL..
please guide me ..
hi,
i did a development for alv report in object oriented .. but OO alv hotspot not work .
class lcl_report definition.
public section.
*----------------------------------------------------------------------*
* Final Output Table
*----------------------------------------------------------------------*
methods:generate_output,
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid " hotspot
IMPORTING e_row_id e_column_id es_row_no.
endclass.
class lcl_report implementation.
method: generate_output.
*****hotspot
data: lr_columns type ref to cl_salv_columns,
lr_column type ref to cl_salv_column_table.
lr_column ?= lr_columns->get_column( 'MATNR' ).
lr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
endmethod.
METHOD handle_hotspot_click.
PERFORM f_event_hotspot_click USING e_row_id e_column_id es_row_no.
ENDMETHOD.
FORM f_event_hotspot_click USING fp_row_id TYPE lvc_s_row
fp_column_id TYPE lvc_s_col
fp_row_no TYPE lvc_s_roid.
CLEAR: gs_final.
READ TABLE gt_final INTO gs_final INDEX fp_row_no-row_id.
IF sy-subrc EQ 0.
if fp_column_id = 'MATNR'.
SET PARAMETER ID 'MAT' FIELD gs_final-matnr.
CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.
ENDIF.
endif.
ENDFORM.
start-of-selection.
*----------------------------------------------------------------------*
data: lo_report type ref to lcl_report.
DATA: g_grid TYPE REF TO cl_gui_alv_grid,
g_receiver TYPE REF TO lcl_report. "handler.
create object lo_report.
lo_report->generate_output( ).
SET HANDLER g_receiver->handle_hotspot_click FOR g_grid .
i'm getting a dump says
SET HANDLER: Reference to handler object cannot be NULL..
please guide me ..
2013 Apr 04 12:09 PM
Hi,
Use
SET HANDLER lo_report->handle_hotspot_click FOR g_grid .
Thanks & Regards,
Tushar
2013 Apr 04 12:14 PM
Can you move the set handler statement before :
lo_report->generate_output( ).
2013 Apr 04 12:20 PM
2013 Apr 24 9:47 AM
2013 Apr 25 7:38 AM
Hi Nirgoe Tava,
Can u please say how you fixed this dump?
I am also facing a very similar problem.
Thanks,
Prabha
2013 Apr 26 3:53 AM
hey,
In my main class, i created the hotspot method & out put method.. in OO hotspot event shoud create before output method load... so i did created 2 classes like
***Class definition.
class lcl_event_handler definition deferred.
data: go_event type ref to cl_salv_events_table,
go_event_handler type ref to lcl_event_handler.
* *********************ALV Class definitions
class lcl_event_handler definition.
public section.
methods handle_hotspot_click for event link_click of cl_salv_events_table " hotspot
importing row column.
endclass.
class lcl_report definition.
public section.
*----------------------------------------------------------------------*
* Final Output Table
*----------------------------------------------------------------------*
data: o_alv type ref to cl_salv_table.
methods:generate_output.
private section.
*----------------------------------------------------------------------*
* Methods to Set PF-Status, Header and Footer
*----------------------------------------------------------------------*
methods: set_pf_status
changing
co_alv type ref to cl_salv_table, " Default Pf Status
set_top_of_page
changing
co_alv type ref to cl_salv_table. ", " Set Top of page
* set_end_of_page
* changing
* co_alv type ref to cl_salv_table. " Set End of page
endclass.
class lcl_event_handler implementation.
method handle_hotspot_click.
perform f_event_hotspot_click using row column. "handle_hotspot_click
endmethod. "handle_hotspot_click
endclass.
*Exception Class
data: lc_msg type ref to cx_salv_msg.
*----------------------------------------------------------------------*
* We are calling the static Factory method which will give back
* the ALV object reference.
*----------------------------------------------------------------------*
try.
call method cl_salv_table=>factory
importing
r_salv_table = o_alv
changing
t_table = gt_final.
catch cx_salv_msg into lc_msg .
endtry.
"Get Events
go_event = o_alv->get_event( ).
create object go_event_handler.
set handler go_event_handler->handle_hotspot_click for go_event.
endclass.
form f_event_hotspot_click using fp_row type salv_de_row
fp_column type salv_de_column.
clear: gs_final.
read table gt_final into gs_final index fp_row.
if sy-subrc eq 0.
if fp_column = 'MATNR'.
set parameter id 'MAT' field gs_final-matnr.
call transaction 'CS03' and skip first screen.
endif.
endif.
endform.
try this way
2013 May 10 5:10 AM
Hi,
The Problem is Solved.
Thanks,
Prabhakaran.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |