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

ALV Using Method & Classes -- Problem

Former Member
0 Likes
402

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
375

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.

2 REPLIES 2
Read only

uwe_schieferstein
Active Contributor
0 Likes
375

Hello Bobby

Regarding (1) have a look at thread .

Regarding (2) have a look at thread .

Regards

Uwe

Read only

Former Member
0 Likes
376

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.