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 checkbox - disable

Former Member
0 Likes
794

Hi,

How to implement in an ALV list, a column with checkboxes, but only some of the checkboxes to be enable ( if a field in that row meet a condititon)?

Thks

Bogdan

Message was edited by: Bogdan Cojocaru

1 ACCEPTED SOLUTION
Read only

vidya_gugnani
Product and Topic Expert
Product and Topic Expert
0 Likes
720

hI,

I want to get the checkbox displayed but am unable to do so.I have done what is suggested as in code below:

" For checkbox

insert initial line into table ch_fieldcat assigning <wa_catalogue>.

<wa_catalogue>-col_pos = lines( ch_fieldcat ).

<wa_catalogue>-row_pos = 0.

<wa_catalogue>-fieldname = 'CHECKBOX'.

<wa_catalogue>-inttype = 'C'.

<wa_catalogue>-edit = 'X'.

<wa_catalogue>-seltext =

<wa_catalogue>-coltext = 'Choose test class for tagging'.

<wa_catalogue>-checkbox = abap_true.

<wa_catalogue>-outputlen = 10.

call function 'LVC_FIELDCATALOG_MERGE'

exporting

i_structure_name = im_structure_name

changing

ct_fieldcat = ch_fieldcat

exceptions

others = 1.

if sy-subrc <> 0.

raise exception type cx_pak_gui_error.

endif.

describe table ch_fieldcat lines l_lin.

loop at ch_fieldcat assigning <lfs_field>.

case <lfs_field>-fieldname.

when 'SOBJ_NAME'.

<lfs_field>-coltext = 'Test Class'(002).

<lfs_field>-outputlen = 30.

<lfs_field>-key = 'X'.

when 'CHECKBOX'.

<lfs_field>-coltext = 'Choose TestClass for Tagging'(003).

<lfs_field>-outputlen = 30.

<lfs_field>-row_pos = 0.

<lfs_field>-key = 'X'.

when l_fieldname. " ICON*

<lfs_field>-icon = abap_true.

<lfs_field>-no_out = 'X'.

when others.

<lfs_field>-key = 'X'.

<lfs_field>-no_out = 'X'.

endcase.

endloop.

call function 'LVC_FIELDCATALOG_MERGE'

exporting

i_structure_name = im_structure_name

changing

ct_fieldcat = ch_fieldcat

exceptions

others = 1.

Please advise.

Regards,

VG

hI,

I want to get the checkbox displayed but am unable to do so.I have done what is suggested as in code below:

" For checkbox

insert initial line into table ch_fieldcat assigning <wa_catalogue>.

<wa_catalogue>-col_pos = lines( ch_fieldcat ).

<wa_catalogue>-row_pos = 0.

<wa_catalogue>-fieldname = 'CHECKBOX'.

<wa_catalogue>-inttype = 'C'.

<wa_catalogue>-edit = 'X'.

<wa_catalogue>-seltext =

<wa_catalogue>-coltext = 'Choose test class for tagging'.

<wa_catalogue>-checkbox = abap_true.

<wa_catalogue>-outputlen = 10.

call function 'LVC_FIELDCATALOG_MERGE'

exporting

i_structure_name = im_structure_name

changing

ct_fieldcat = ch_fieldcat

exceptions

others = 1.

if sy-subrc <> 0.

raise exception type cx_pak_gui_error.

endif.

describe table ch_fieldcat lines l_lin.

loop at ch_fieldcat assigning <lfs_field>.

case <lfs_field>-fieldname.

when 'SOBJ_NAME'.

<lfs_field>-coltext = 'Test Class'(002).

<lfs_field>-outputlen = 30.

<lfs_field>-key = 'X'.

when 'CHECKBOX'.

<lfs_field>-coltext = 'Choose TestClass for Tagging'(003).

<lfs_field>-outputlen = 30.

<lfs_field>-row_pos = 0.

<lfs_field>-key = 'X'.

when l_fieldname. " ICON*

<lfs_field>-icon = abap_true.

<lfs_field>-no_out = 'X'.

when others.

<lfs_field>-key = 'X'.

<lfs_field>-no_out = 'X'.

endcase.

endloop.

call function 'LVC_FIELDCATALOG_MERGE'

exporting

i_structure_name = im_structure_name

changing

ct_fieldcat = ch_fieldcat

exceptions

others = 1.

Please advise.

Regards,

VG

4 REPLIES 4
Read only

Former Member
0 Likes
720

Refer this sample program <b>BCALV_EDIT_05</b>

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
720

Hi,

To output a column with checkbox,you need to code like below in fieldcat.

DATA: i_fieldcat TYPE slis_t_fieldcat_alv.

DATA: line_fieldcat TYPE slis_fieldcat_alv.

CLEAR line_fieldcat.

line_fieldcat-fieldname = 'CHK'.

line_fieldcat-tabname = 'I_DATA'.

line_fieldcat-seltext_l = 'Checkbox'.

line_fieldcat-checkbox = 'X'. " Display this field as a checkbox

line_fieldcat-edit = 'X'. " This option ensures that you can

" edit the checkbox. Else it will

" be protected.

APPEND line_fieldcat TO i_fieldcat.

But I don't think you can selectively enable some rows to check the checkbox.

Kindly reward points if it helps.

Read only

vidya_gugnani
Product and Topic Expert
Product and Topic Expert
0 Likes
721

hI,

I want to get the checkbox displayed but am unable to do so.I have done what is suggested as in code below:

" For checkbox

insert initial line into table ch_fieldcat assigning <wa_catalogue>.

<wa_catalogue>-col_pos = lines( ch_fieldcat ).

<wa_catalogue>-row_pos = 0.

<wa_catalogue>-fieldname = 'CHECKBOX'.

<wa_catalogue>-inttype = 'C'.

<wa_catalogue>-edit = 'X'.

<wa_catalogue>-seltext =

<wa_catalogue>-coltext = 'Choose test class for tagging'.

<wa_catalogue>-checkbox = abap_true.

<wa_catalogue>-outputlen = 10.

call function 'LVC_FIELDCATALOG_MERGE'

exporting

i_structure_name = im_structure_name

changing

ct_fieldcat = ch_fieldcat

exceptions

others = 1.

if sy-subrc <> 0.

raise exception type cx_pak_gui_error.

endif.

describe table ch_fieldcat lines l_lin.

loop at ch_fieldcat assigning <lfs_field>.

case <lfs_field>-fieldname.

when 'SOBJ_NAME'.

<lfs_field>-coltext = 'Test Class'(002).

<lfs_field>-outputlen = 30.

<lfs_field>-key = 'X'.

when 'CHECKBOX'.

<lfs_field>-coltext = 'Choose TestClass for Tagging'(003).

<lfs_field>-outputlen = 30.

<lfs_field>-row_pos = 0.

<lfs_field>-key = 'X'.

when l_fieldname. " ICON*

<lfs_field>-icon = abap_true.

<lfs_field>-no_out = 'X'.

when others.

<lfs_field>-key = 'X'.

<lfs_field>-no_out = 'X'.

endcase.

endloop.

call function 'LVC_FIELDCATALOG_MERGE'

exporting

i_structure_name = im_structure_name

changing

ct_fieldcat = ch_fieldcat

exceptions

others = 1.

Please advise.

Regards,

VG

Read only

Former Member
0 Likes
720

are you using ALV GRID/ ALV LIST/ ALV Grid class..

if it is using classes let me know,...

vijay

Message was edited by: Vijay Babu Dudla