‎2008 Nov 25 9:31 AM
Hi All,
1. I need the event for selecting a row in ALV Grid, which I am calling through method, means is there any way that when I select a row , I can do any processing.
2. Can Check box be displayed in ALV grid using method, if yes how and how to use that check box.
thanks
bobby
‎2008 Nov 25 12:00 PM
Hi Bobby,
You can use the following things for solution of your problem:
1) for your first problem, (see standard report called by transaction WE02 - IDoc Monitor). As a template for event handling you can take my sample report ZUS_SDN_TWO_ALV_GRIDS
in thread alv
Instead of the DOUBLE-CLICK event you may define a column as hotspot (raises event HOTSPOT_CLICK) or you can register event DELAYED_CHANGED_SEL_CALLBACK by calling method go_grid->REGISTER_DELAYED_EVENT.
If you are using the delayed event then you must disable multiple selection of rows.
2) For your second problem,if you want Check box to be displayed in ALV grid using method, then you can use the following code:
You need to declare a field in your internal table which you can use as check box and manipulations later.
types: begin of t_alv.
include structure zrfid.
types: chb type char1,
end of t_alv.
data: i_alv type standard table of t_data.
After field catalog population via FM, you can add check box field to the field catalog.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZRFID'
CHANGING
ct_fieldcat = lt_fct1.
CLEAR ls_fcat.
ls_fcat-fieldname = 'CHB'.
ls_fcat-CHECKBOX = 'X'.
ls_fcat-EDIT = 'X'.
ls_fcat-outputlen = 2.
APPEND ls_fcat TO lt_fct1.
Now display data w.r.t your field catalog:
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'ZRFID'
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = lt_alv
it_fieldcatalog = lt_fct1
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
So later on when the function SELECT_ALL is selected you can set the value for CHB as 'X' and refresh display.
hope this will help you and solve your query.
‎2008 Nov 25 11:36 AM
Hello Bobby
Regarding (1) have a look at thread .
Regarding (2) have a look at thread .
Regards
Uwe
‎2008 Nov 25 12:00 PM
Hi Bobby,
You can use the following things for solution of your problem:
1) for your first problem, (see standard report called by transaction WE02 - IDoc Monitor). As a template for event handling you can take my sample report ZUS_SDN_TWO_ALV_GRIDS
in thread alv
Instead of the DOUBLE-CLICK event you may define a column as hotspot (raises event HOTSPOT_CLICK) or you can register event DELAYED_CHANGED_SEL_CALLBACK by calling method go_grid->REGISTER_DELAYED_EVENT.
If you are using the delayed event then you must disable multiple selection of rows.
2) For your second problem,if you want Check box to be displayed in ALV grid using method, then you can use the following code:
You need to declare a field in your internal table which you can use as check box and manipulations later.
types: begin of t_alv.
include structure zrfid.
types: chb type char1,
end of t_alv.
data: i_alv type standard table of t_data.
After field catalog population via FM, you can add check box field to the field catalog.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZRFID'
CHANGING
ct_fieldcat = lt_fct1.
CLEAR ls_fcat.
ls_fcat-fieldname = 'CHB'.
ls_fcat-CHECKBOX = 'X'.
ls_fcat-EDIT = 'X'.
ls_fcat-outputlen = 2.
APPEND ls_fcat TO lt_fct1.
Now display data w.r.t your field catalog:
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'ZRFID'
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = lt_alv
it_fieldcatalog = lt_fct1
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
So later on when the function SELECT_ALL is selected you can set the value for CHB as 'X' and refresh display.
hope this will help you and solve your query.