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

help me with this code please.

Former Member
0 Likes
586

Hi,

The following code is creating a problem, it's always saying this create object gt_event_handler. statement is not accessible can you tell me why it is happening?

CLASS lcl_event_handler DEFINITION .

PUBLIC SECTION .

METHODS:

*Double-click control

handle_double_click

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column .

PRIVATE SECTION.

ENDCLASS.

CLASS lcl_event_handler IMPLEMENTATION .

*Handle Double Click

METHOD handle_double_click .

PERFORM handle_double_click USING e_row

e_column.

  • es_row_no.

ENDMETHOD.

ENDCLASS.

FORM handle_double_click USING i_row TYPE lvc_s_row

i_column TYPE lvc_s_col.

*is_row_no TYPE lvc_s_roid.

READ TABLE GT_SUM_COPA INDEX I_ROW-INDEX.

IF sy-subrc = 0.

CALL SCREEN 200 .

ENDIF .

ENDFORM .

DATA gr_event_handler TYPE REF TO lcl_event_handler .

*--Creating an instance for the event handler

CREATE OBJECT gr_event_handler .

SET HANDLER gr_event_handler->handle_double_click FOR gr_COPA_FINAL.

Regards,

Swordfish.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
547

Hi,

Use START-OF-SELECTION.

DATA gr_event_handler TYPE REF TO lcl_event_handler .

START-OF-SELECTION.

*--Creating an instance for the event handler
CREATE OBJECT gr_event_handler .

4 REPLIES 4
Read only

Former Member
0 Likes
548

Hi,

Use START-OF-SELECTION.

DATA gr_event_handler TYPE REF TO lcl_event_handler .

START-OF-SELECTION.

*--Creating an instance for the event handler
CREATE OBJECT gr_event_handler .

Read only

Former Member
0 Likes
547

Your statements should either be:

1. between your class definition and implementation, or

2. seaparated by an event, e.g. START-OF-SELECTION

Read only

Former Member
0 Likes
547

Hi,

Define all Class definitions and implementations before any event, that is to declare them after data declarations.

Thanks,

Ravi K

Read only

Former Member
0 Likes
547

Thanks to all, problem solved.