‎2006 Mar 10 2:17 PM
HI,
I have a method in Class definition which gets triggered on the EVENT AFTER_USER_COMMAND.
I wish to call method (get_filtered_entries) within the above method.
Is that possible. ? I am new to OO programming.
For your refernec I have my code snippets attached.
[code]CLASS lcl_event_receiver DEFINITION .
PUBLIC:
METHODS:
handle_user_command
FOR EVENT after_user_command OF cl_gui_alv_grid
IMPORTING e_ucomm e_not_processed.
ENDCLASS. "lcl_event_receiver CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_user_command.
* IF e_not_processed IS INITIAL.
<b> CALL METHOD cl_gui_alv_grid->get_filtered_entries
IMPORTING
et_filtered_entries = lt_entries.</b>
* ENDIF.
ENDMETHOD. "handle_user_commandENDCLASS. "lcl_event_receiver IMPLEMENTATION
DATA: g_event_receiver TYPE REF TO lcl_event_receiver,
g_grid_2000 TYPE REF TO lcl_method_call,
g_grid_3000 TYPE REF TO lcl_method_call.
INITIALIZATION.
perform check_screen.
START-OF-SELECTION.
perform get_data[/code]
The program dumps when it tries to call the method get_filtered_entries above.
Can you suggest where I am going wrong.
Regards
RK
‎2006 Mar 10 2:20 PM
Hi Rajiv,
You should call method g_grid_2000->get_filtered_entries. (or g_grid_3000) depending on which grid you are actually using.
Regards,
John.
‎2006 Mar 10 2:19 PM
Hi,
we don't see in the code where you have define the cl_gui_alv_grid and where you have create the grid object.
Rgd
Frédéric
‎2006 Mar 10 2:20 PM
Hi Rajiv,
You should call method g_grid_2000->get_filtered_entries. (or g_grid_3000) depending on which grid you are actually using.
Regards,
John.
‎2006 Mar 10 2:25 PM
‎2006 Mar 10 2:26 PM
‎2006 Mar 10 2:27 PM
‎2006 Mar 10 2:36 PM
What is g_custom_2000?
CALL METHOD
<b>g_custom_2000-></b>get_filtered_entries
IMPORTING
et_filtered_entries = lt_entries.the g_grid_2000 object is your alv_grid object since it inherits from cl_Gui_alv_grid. You should be calling the method against that object.
CALL METHOD
<b>g_grid_2000-></b>get_filtered_entries
IMPORTING
et_filtered_entries = lt_entries.Regards,
Rich Heilman
‎2006 Mar 10 2:32 PM
Hi All,
Infact I tried to cal the method from my GRID but its showing an syntax error.
I am attaching the code bit again with cl_gui_alv_grid implementation for your reference. Maybe you can tell me whats the mistake I am doing.
> [code]
[code]CLASS lcl_event_receiver DEFINITION .
PUBLIC:
METHODS:
handle_user_command
FOR EVENT after_user_command OF
r_command OF cl_gui_alv_grid
IMPORTING e_ucomm e_not_processed.
ENDCLASS. "lcl_event_receiver
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_user_command.
* IF e_not_processed IS INITIAL.
<b> CALL METHOD
g_custom_2000->get_filtered_entries
IMPORTING
et_filtered_entries = lt_entries.</b>
* ENDIF.
ENDMETHOD.
D.
"handle_user_command
ENDCLASS. "lcl_event_receiver
IMPLEMENTATION
DATA: g_event_receiver TYPE REF TO
lcl_event_receiver,
g_grid_2000 TYPE REF TO lcl_method_call,
g_grid_3000 TYPE REF TO lcl_method_call.
CLASS lcl_method_call DEFINITION INHERITING FROM cl_gui_alv_grid.
PUBLIC SECTION.
METHODS: get_row EXPORTING row TYPE lvc_s_row.
ENDCLASS. "lcl_method_call DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_method_cal IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_method_call IMPLEMENTATION.
METHOD get_row.
CALL METHOD me->get_current_cell_row_id
IMPORTING
row_id = row.
ENDMETHOD. "get_row
ENDCLASS. "lcl_method_call IMPLEMENTATION> INITIALIZATION.
> perform check_screen.
>
> START-OF-SELECTION.
> perform get_data[/code][/code]
‎2006 Mar 10 2:43 PM
Thanks Jhon and Rich,
I was calling the method from my ALV container and not the GRid as rightly pointed out by you.
The issue is sorted .
Thanks for the help.
Really appreciated
RK