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 grid with editable fields

Former Member
0 Likes
703

Dear Colleagues,

I develop an ALV grid with OO standard methods. Before the first display of the table I define the editable fields. It works fine.

I have a problem : if the table is empty and I press the standard icons "Append a line" or "Insert a line", the new line don't have the defined editable characteristics.for fields. Is there a standard method which I have forgotten ?

Thanks a lot and kind regards

Peter

1 ACCEPTED SOLUTION
Read only

jyotheswar_p2
Active Participant
0 Likes
658

Hi

Since you have put only some fields as EDITABLE you might not need all these extra funtions and icons.Since all these separately will take time.So you can exclude those unwanted icons from there by using the below code.

You can remove the unwanted icons by excluding the toolbar

form exclude_tb_functions changing pt_exclude type ui_functions.

  • Only allow to change data not to create new entries (exclude

  • generic functions).

data ls_exclude type ui_func.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.

append ls_exclude to pt_exclude.

endform. " EXCLUDE_TB_FUNCTIONS

And pass this internal table to ls_exclude to set_Table_for_first_table.

Thanks & Regards

Jyo

Edited by: jyotheswar p on Feb 19, 2010 4:19 AM

4 REPLIES 4
Read only

Former Member
0 Likes
658

Hi Peter,

Please refer to following blog.

[Blog For Insert Row Function in ALV Grid|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3414800%29ID1658202250DB00188401149248675548End?blog=/pub/wlg/6303]

Hope this helps.

Regards,

Chandravadan

Read only

jyotheswar_p2
Active Participant
0 Likes
659

Hi

Since you have put only some fields as EDITABLE you might not need all these extra funtions and icons.Since all these separately will take time.So you can exclude those unwanted icons from there by using the below code.

You can remove the unwanted icons by excluding the toolbar

form exclude_tb_functions changing pt_exclude type ui_functions.

  • Only allow to change data not to create new entries (exclude

  • generic functions).

data ls_exclude type ui_func.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.

append ls_exclude to pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.

append ls_exclude to pt_exclude.

endform. " EXCLUDE_TB_FUNCTIONS

And pass this internal table to ls_exclude to set_Table_for_first_table.

Thanks & Regards

Jyo

Edited by: jyotheswar p on Feb 19, 2010 4:19 AM

Read only

Former Member
0 Likes
658

vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_delete_row.
    APPEND vs_toolbar_excluding TO i_toolbar_excluding.

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_append_row.
    APPEND vs_toolbar_excluding TO i_toolbar_excluding.

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy_row.
    APPEND vs_toolbar_excluding TO i_toolbar_excluding.

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_insert_row.
    APPEND vs_toolbar_excluding TO i_toolbar_excluding.

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy.
    APPEND vs_toolbar_excluding TO i_toolbar_excluding.

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_cut.
    APPEND vs_toolbar_excluding TO i_toolbar_excluding.

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste.
    APPEND vs_toolbar_excluding TO i_toolbar_excluding.

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_undo.
    APPEND vs_toolbar_excluding TO i_toolbar_excluding.

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
    APPEND vs_toolbar_excluding TO i_toolbar_excluding.

* Displaying the output in ALV Grid
    vs_layout_grid-no_rowmark = 'X'.
    vs_layout_grid-zebra      = 'X'.
    vs_layout_grid-cwidth_opt = 'X'.
    vs_layout_grid-edit       = 'X'.
    vs_layout_grid-ctab_fname = 'CT'.
    vs_layout_grid-stylefname = 'CELLTAB'.


    CALL METHOD v_grid->set_table_for_first_display
      EXPORTING
        i_save                        = 'X'
        is_layout                     = vs_layout_grid
        it_toolbar_excluding          = i_toolbar_excluding[]
      CHANGING
        it_outtab                     = itab[]
        it_fieldcatalog               = it_fieldcat[]
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        OTHERS                        = 4.
    IF sy-subrc NE 0.
      MESSAGE 'ALV Grid display unsuccessful' TYPE 'I'.
      STOP.
    ENDIF.                             " IF sy-subrc NE 0
  ELSE.                                " IF w_custom_container...
* Refresh the container if it already exists
    CALL METHOD v_grid->refresh_table_display
      EXCEPTIONS
        finished = 1
        OTHERS   = 2.
    IF sy-subrc NE 0.
      MESSAGE 'Refreshing the container is not successful' TYPE 'I'.
      STOP.
    ENDIF.                             
Read only

Former Member
0 Likes
658

This message was moderated.