Skip to Content
avatar image
Former Member

check box in Grid display

when i check checkbox it is not updated in internal table.

Final Internal Tbale:

Data: BEGIN OF T_FINAL occurs 0,

CHK_BOX,

……………………………..

……………………………..

……………………………….

END OF T_FINAL.

-


LS_FIELDCAT-TABNAME = t_final.

LS_FIELDCAT-COL_POS = 1.

LS_FIELDCAT-FIELDNAME = 'CHK_BOX'.

LS_FIELDCAT-SELTEXT_S = ‘check box’.

LS_FIELDCAT-INPUT = 'X'.

LS_FIELDCAT-OUTPUTLEN = 1.

LS_FIELDCAT-CHECKBOX = 'X'.

LS_FIELDCAT-EDIT = 'X'.

APPEND LS_FIELDCAT TO LT_FIELDCAT.

CLEAR LS_FIELDCAT.

-


DATA: I_CHECK TYPE TABLE OF T_FINAL,

WA_CHECK TYPE T_FINAL.

LOOP AT I_FINAL INTO WA_FINAL.

IF WA_FINAL-CHK_BOX = 'X'.

APPEND WA_FINAL TO I_CHECK.

ENDIF.

ENDLOOP.

-


In layout:

LS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

LS_LAYOUT-BOX_FIELDNAME = 'CHK_BOX'.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Oct 11, 2007 at 06:55 AM

    Hi

    Types: begin of lt_io.

    include structure mara. " Your Structure

    Types: style_table type lvc_t_style.

    Types: end of lt_io.

    data: lt_io type table of lt_io,

    ls_layout type lvc_s_layo,

    lt_fcat type lvc_t_fcat,

    lo_grid type ref to cl_gui_alv_grid.

    field-symbols: <io> type lt_io,

    <fcat> type lvc_s_fcat.

    ... fill your output table ....

    ls_layout-stylefname = 'STYLE_TABLE'.

    loop at lt_io assigning <io>.

    PERFORM set_style USING 'CHECKBOX' "Your Filename

    CHANGING <io>.

    endloop.

    ... Fill Your Field Catalog lt_fcat

    read table lt_fcat assigning <fcat>

    where fieldname = 'CHECKBOX'.

    <fcat>-checkbox = 'X'.

    ...

    create grid control lo_grid.

    ...

    CALL METHOD lo_grid->set_table_for_first_display

    EXPORTING

    is_layout = ls_layout

    CHANGING

    it_fieldcatalog = lt_fcat

    it_outtab = lt_io[].

    ...

    FORM set_button_to_line

    USING iv_fieldname TYPE lvc_fname

    CHANGING cs_io TYPE io.

    DATA: ls_style TYPE lvc_s_styl,

    lt_style TYPE lvc_t_styl.

    ls_style-fieldname = iv_fieldname.

    if cs_io-checkbox = ' '.

    ls_style-style = cl_gui_alv_grid=>mc_style_enabled.

    else.

    ls_style-style = cl_gui_alv_grid=>mc_style_disabled.

    endif.

    ls_style-maxlen = 2.

    INSERT ls_style INTO TABLE io-style_table.

    ENDFORM. "set_icon_to_status_line

    [/code].

    /community [original link is broken]

    <b>

    Rewar di fusefull</b>

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 06:57 AM

    Hi,

    In the user command of the ALV, write the following code.

    DATA l_ref1 type ref to cl_gui_alv_grid.

    call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'

    importing

    e_grid = l_ref1.

    call method l_ref1->check_changed_data.

    <<Write your logic here>>

    <b><<at this points ur selected check box will be captured>></b>

    Regards,

    Niyaz

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 06:59 AM

    hi,

    in ur code small modification here.

    LOOP AT I_FINAL INTO WA_FINAL.

    IF WA_FINAL-CHK_BOX = 'X'.

    APPEND WA_FINAL TO I_CHECK[ ].

    ENDIF.

    ENDLOOP.

    // i_check is a internal table with out header line so u have to add it directly to body or to external workarea associated with dat internal table and to internal table itself.

    if helpful reward some points.

    with regards,

    Suresh Aluri.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 07:03 AM

    Hi

    To make a column as check box set the parameter

    <wa_fieldcat>-checkbox = 'X'.

    try like this

    
    LOOP AT I_FINAL INTO WA_FINAL.
    IF WA_FINAL-CHK_BOX = 'X'.
    APPEND WA_FINAL TO I_CHECK[ ].
    ENDIF.
    ENDLOOP.

    check the program BCALV_TEST_GRID_EDITABLE there is a checkbox there.

    can you explain how to add the checkbox there

    chk this std pgm BCALV_EDIT_05

    BCALV_EDIT_05 This example shows how to use checkboxes within an ALV Grid Control. You learn:

    (1) how to define a column for editable checkboxes for an attribute of your list

    (2) how to evaluate the checked checkboxes

    (3) how to switch between editable and non-editable checkboxes

    Checkthis link

    Checkbox in ALV Grid

    http://www.sapdevelopment.co.uk/reporting/alv/alvscr.htm

    Regards

    Pavan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 07:04 AM

    Hi,

    In building the layout dont specify the box name. like this.

    LS_LAYOUT-box_fieldname = '' .

    LS_LAYOUT-box_tabname = '' .

    regards,

    Niyaz

    Add comment
    10|10000 characters needed characters exceeded