Skip to Content
avatar image
Former Member

How to make ALV cell editable

Hi ,

I am using cl_gui_alv_grid .

please let me know how to make a particular cell is editable

eg: cell corresponding to first row second column should be editabel but remaining all are non editable

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jun 24, 2009 at 10:10 AM

    Hi,

    Refer the field catalog. There is an attribute as EDIT, pass the value of this attribute while creating field catalog to X.

    Regards,

    Tarun

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Loop at your internal table.

      Eg: i have total 5 fields in my internal table itab_zqmeinz. in that 3 fields are editable as below.

      declare DATA: lt_celltab TYPE lvc_t_styl.

      • internal table with celltab as one of the column

      DATA: BEGIN OF itab_zqmeinz OCCURS 0. "TYPE STANDARD TABLE OF zqmseqkopf

      INCLUDE STRUCTURE zqmseqeinz.

      DATA: celltab TYPE lvc_t_styl.

      DATA: END OF itab_zqmeinz.

      LOOP AT itab_zqmeinz INTO wa_zqmeinz.
            l_index = sy-tabix.
            REFRESH lt_celltab.
            CLEAR wa_zqmeinz-celltab.
            PERFORM fill_celltab1 USING 'RW'
                                    CHANGING lt_celltab.
            INSERT LINES OF lt_celltab INTO TABLE wa_zqmeinz-celltab.
            MODIFY  itab_zqmeinz FROM wa_zqmeinz INDEX l_index.
          ENDLOOP.
      
      
      FORM fill_celltab1 USING value(p_mode)
                        CHANGING pt_celltab TYPE lvc_t_styl.
       Refresh pt_celltab.
        clear ls_celltab.
      
        IF p_mode EQ 'RW'.
          l_mode = cl_gui_alv_grid=>mc_style_enabled.    "to enable the required fields
        ELSE.                                "p_mode eq 'RO'
          l_mode = cl_gui_alv_grid=>mc_style_disabled.
        ENDIF.
      
        ls_celltab-fieldname = 'NEBENSEQUEN'.   " field1
        ls_celltab-style = l_mode.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = 'BEZEICHNUNG'.     "field2
        ls_celltab-style = l_mode.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = 'SORTIERUNG'.         "field3
        ls_celltab-style = l_mode. 
        INSERT ls_celltab INTO TABLE pt_celltab.
      
      Endform.

      It works. I have done it in my program.

      Thanks,

  • avatar image
    Former Member
    Jun 24, 2009 at 10:13 AM

    Hi,

    In the field catalog,

    p_it_fcat-edit = ' '.

    Thanks,

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 24, 2009 at 11:37 AM

    standard report BCALV_TEST_GRID_EDITABLE

    Add comment
    10|10000 characters needed characters exceeded