11-12-2010 7:25 PM
Hi All,
I need to find the method or object to use to set the callback status to my program so I may use forms that I have developed.
How do i do that?
thanks
KW
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_alv
CHANGING
t_table = gt_dev_task_display.
PERFORM f_display_settings.
gr_alv->set_screen_status(
pfstatus = 'ZALV_STANDARD_KW'
report = sy-repid
set_functions = gr_alv->c_functions_all ). "set all basic ALV funtions
gr_events = gr_alv->get_event( ).
**... optimize the column widths
TRY.
lr_columns = gr_alv->get_columns( ).
lr_columns->set_optimize( 'X' ).
CATCH cx_salv_not_found. "#EC NO_HANDLER
ENDTRY.
* get layout object
lo_layout = gr_alv->get_layout( ).
*
* set Layout save restriction
* 1. Set Layout Key .. Unique key identifies the Differenet ALVs
ls_key-report = sy-repid.
lo_layout->set_key( ls_key ).
* 2. Remove Save layout the restriction.
lo_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
lo_layout->set_default( abap_true ).
*
gr_functions = gr_alv->get_functions( ).
gr_functions->set_all('X').
gr_functions->set_group_filter( value = if_salv_c_bool_sap=>false ).
gr_alv->get_display_settings( ).
gr_alv->display( ).
CATCH cx_salv_msg.
MESSAGE 'ALV Display Not possible'(w02) TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
11-12-2010 8:09 PM
Since you are using the SALV, you need to use the Event Handler methods as the Callback.
You need to get the Event object from the SALV OM. Create the Event Handler Class. Set the event handler and you are all set to receive the Callback when the button is pressed on the PF-Status.
class lcl_handle_events definition.
public section.
methods:
on_user_command for event added_function of cl_salv_events
importing e_salv_function.
endclass.
...
data: lr_events type ref to cl_salv_events_table.
lr_events = gr_table->get_event( ).
data: gr_events type ref to lcl_handle_events.
create object gr_events.
set handler gr_events->on_user_command for lr_events.
Check the program SALV_DEMO_TABLE_FUNCTIONS.
Regards,
Naimesh Patel
11-12-2010 8:09 PM
Since you are using the SALV, you need to use the Event Handler methods as the Callback.
You need to get the Event object from the SALV OM. Create the Event Handler Class. Set the event handler and you are all set to receive the Callback when the button is pressed on the PF-Status.
class lcl_handle_events definition.
public section.
methods:
on_user_command for event added_function of cl_salv_events
importing e_salv_function.
endclass.
...
data: lr_events type ref to cl_salv_events_table.
lr_events = gr_table->get_event( ).
data: gr_events type ref to lcl_handle_events.
create object gr_events.
set handler gr_events->on_user_command for lr_events.
Check the program SALV_DEMO_TABLE_FUNCTIONS.
Regards,
Naimesh Patel
11-12-2010 8:33 PM
Namish,
thank you for the reply.
I have created the handle class but the issue I am having is in the PAI becuase the callback status is not set it keep going back to the SAPLSVC_FULLSCREEN pai and not to the PAI that I would like.
What I am trying to achieve can be done with this code:
* call list viever
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_user_command = gc_user_command
i_callback_pf_status_set = gc_pf_status
I_BYPASSING_BUFFER = 'X'
i_background_id = 'ALV_BACKGROUND'
i_callback_program = gv_repid
i_default = 'N' "use gs_variant
it_event_exit = gt_event_exit
it_fieldcat = gt_fieldcat
is_layout = gs_layout
i_save = gv_save
is_variant = gs_variant
it_special_groups = gt_special_groups
TABLES
* t_outtab = gt_report_list.
t_outtab = gt_report_list2.
the variable gc_user_command will bring it back to my calling program USER_COMMAND, this is what I am trying to achieve in OO
Thank you!
11-12-2010 8:50 PM
That's exactly what the test program SALV_DEMO_TABLE_FUNCTIONS does. If you put a breakpoint in the method ON_USER_COMMAND, it would stop there. This ON_USER_COMMAND method is similar to the GC_USER_COMMAND specified in the REUSE FM Call.
Regards,
Naimesh Patel
11-15-2010 3:17 PM
Hi Naimesh,
You are correct in your explanations, thank you. I now know I am looking to capture the event double click when the user double clicks on an area of the grid and not one of the button on the toolbar. Is it possible that when the user double clicks on an area of the grid to fire an event that I can capture back inside my own program?
thank you
KW
11-15-2010 3:22 PM
Yes, you can capture the Double Click event. You need to handle the DOUBLE_CLICK event for the ALV.
class lcl_handle_events definition.
public section.
methods:
on_double_click for event double_click of cl_salv_events_table
importing row column.
endclass.
...
data: lr_events type ref to cl_salv_events_table.
data: gr_events type ref to lcl_handle_events.
lr_events = gr_table->get_event( ).
*
create object gr_events.
set handler gr_events->on_double_click for lr_events.
Check the program SALV_DEMO_TABLE_EVENTS for more information.
Regards,
Naimesh Patel
11-15-2010 3:31 PM
Naimesh,
thanks for your guidance I was able to find use on_double_click to satisfy what I was looking to do.
A sincere thank you!
KW