Application Development 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: 

Check box in ALV Grid Report

Former Member
0 Kudos

Dear Experts,

I need to add a Check box at beginning of every row while displaying the ALV Grid report and the Application Toolbar should display Edit Icon and Execute Icon.

Could anyone give the guidence to do it.

Thanks

karthik

5 REPLIES 5

Former Member
0 Kudos

In the field catalog Pass the <b>CHECKBOX = 'X'</b> for that first field. For geting the EDIT and EXECUTE button While calling the screen give that in the application toolbar of <b>SET PF-STATUS 'STATUS9000'</b>.

Regards,

PRakash.

<b></b>

Former Member
0 Kudos

Hello,

Just in the fieldcatalog property CHECK, pass the value 'X' to it. For this u need to add one column in the internal table.

ls_fcat-CHECK = 'X'.

append ls_fcat to lt_fcat.

Regs,

Venkat Ramanan N

0 Kudos

For the check box just append the field catalog property of check box to your currently used FIELD CATALOG. so when ever u select it, it is 'X'.

You will have to set a PF Status.

SET Pf-status 'STATUS NAME' which leads to SE41.in this in teh Application toolbar you can create new buttons required on ur tool bar.

Regards

Gopi

Former Member
0 Kudos

Hi karthick,

See the following code,

form build_fieldcatalog1 .

fieldcatalog1-fieldname = 'MARKFIELD'.

fieldcatalog1-seltext_m = 'Check'.

fieldcatalog1-checkbox = 'X'.

fieldcatalog1-outputlen = '4'.

fieldcatalog1-col_pos = '1'.

fieldcatalog1-input = 'X'.

fieldcatalog1-edit = 'X'.

append fieldcatalog1 to fieldcatalog1.

clear fieldcatalog1.

fieldcatalog1-fieldname = 'FKDAT'.

fieldcatalog1-seltext_m = 'Billing Date'.

fieldcatalog1-col_pos = 2.

fieldcatalog1-outputlen = 10.

fieldcatalog1-emphasize = 'X'.

fieldcatalog1-key = 'X'.

append fieldcatalog1 to fieldcatalog1.

clear fieldcatalog1.

fieldcatalog1-fieldname = 'VBELN'.

fieldcatalog1-seltext_m = 'Invoice Number'.

fieldcatalog1-col_pos = 3.

append fieldcatalog1 to fieldcatalog1.

clear fieldcatalog1.

fieldcatalog1-fieldname = 'KUNAG'.

fieldcatalog1-seltext_m = 'Customer'.

fieldcatalog1-col_pos = 4.

append fieldcatalog1 to fieldcatalog1.

clear fieldcatalog1.

fieldcatalog1-fieldname = 'NETWR'.

fieldcatalog1-seltext_m = 'Amount'.

fieldcatalog1-col_pos = 5.

append fieldcatalog1 to fieldcatalog1.

clear fieldcatalog1.

fieldcatalog1-fieldname = 'WAERK'.

fieldcatalog1-seltext_m = 'Currency'.

fieldcatalog1-col_pos = 6.

append fieldcatalog1 to fieldcatalog1.

clear fieldcatalog1.

endform. " build_fieldcatalog1

&----


*& Form alv_display1

&----


form alv_display1 .

gd_repid = sy-repid.

set pf-status '1001'.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP_OF_PAGE'

i_callback_user_command = 'USER_COMMAND_SET'

i_callback_pf_status_set = 'PF_STATUS_SET'

is_layout = gd_layout

it_fieldcat = fieldcatalog1[]

it_events = gt_events

is_print = gd_prntparams

i_save = 'X'

tables

t_outtab = inv_cancel

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. " alv_display1

----


  • FORM PF_STATUS_SET *

----


  • ........ *

----


  • --> RT_EXTAB *

----


form pf_status_set using rt_extab type slis_t_extab.

set pf-status '1001' excluding rt_extab.

endform.

&----


*& Form build_layout1

&----


form build_layout1 .

gd_layout-colwidth_optimize = 'X'.

gd_layout-totals_text = 'Totals'(201).

gd_layout-info_fieldname = 'LISTINFO'.

gd_layout-get_selinfos = 'X'.

gd_layout-group_change_edit = 'X'.

endform. " build_layout1

&----


*& Form build_events1

&----


form build_events1 .

data: ls_event type slis_alv_event.

call function 'REUSE_ALV_EVENTS_GET'

exporting

i_list_type = 0

importing

et_events = gt_events1[].

read table gt_events1 with key name = slis_ev_end_of_list

into ls_event.

if sy-subrc = 0.

move 'END_OF_LIST' to ls_event-form.

append ls_event to gt_events1.

endif.

endform. " build_events1

----


  • FORM USER_COMMAND_SET *

----


  • ........ *

----


  • --> RF_UCOMM *

  • --> RS_SELFIELD *

----


form user_command_set using rf_ucomm like sy-ucomm

rs_selfield type slis_selfield.

data: gd_repid like sy-repid.

data ref_grid type ref to cl_gui_alv_grid.

lines = sy-linno.

case rf_ucomm.

when 'execut'.

if ref_grid is initial.

call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'

importing

e_grid = ref_grid.

endif.

if ref_grid is not initial.

call method ref_grid->check_changed_data.

endif.

when 'edit'.

.

.

.

endcase

endform.

It will surely help u,

Regards,

Rajesh.

Please do not forget to Reward points if it was usefull

Former Member
0 Kudos

hi,

Add a column in your internal table and in field catalog mark the property CHECK as X.

For adding edit or other buttons just define a pf-status and set the pf-status. You can also use some standard pf-status.

Regards,

Richa