Skip to Content
avatar image
Former Member

How to make a row of ALV editable

can you give me a piece of code,which makes

a row of alv editable

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jul 05, 2004 at 06:39 AM

    Hello,

    You can have a look at the programs of which name start with BCALV_EDIT* in the package SLIS.

    Regards,

    Sükrü

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 05, 2004 at 09:30 AM

    Hello,

    1.If you want to make the whole ALV editable, call method set_ready_for_input of ALV class with parameter set to '1'

    2.If you want to make some rows of the ALV editable->

    In the example program BCALV_EDIT_2 there is a subroutine named fill_celltab. In this subroutine, the internal table attached to each row of the output table is filled which shows which fields of this row is editable. If you enter a row to this internal table without a fieldname, then the edit status of the entire row is affected.I hope this helps

    Regards,

    Sükrü

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello,

      The example programs BCALV_EDIT* are what I've been looking for for ages. I've just registered and find this forum extremely helpful.

      Regard,

      Jut

  • Jul 05, 2004 at 09:10 PM

    Hi! Just to expand Sukru's explanation (presumptuously), here is the all story:

    1. The internal table that you prepare to pass to ALV displaying method should contain a field of type "LVC_T_STYL". (Caution: By this way, your internal table has become deep!).

    2. Before displaying the grid, you should fill it for each row to define the editability status of each field of that row. Here's how you fill it.

    " ls_celltab-fieldname = 'PERNR'.

    ls_celltab-style = l_mode.

    INSERT ls_celltab INTO TABLE itab-style. "

    Here "l_mode" is a "raw4"-type field and should be equal to

    -> the static attribute "cl_gui_alv_grid=>mc_style_enabled" for the fields you want to make editable.

    -> the static attribute "cl_gui_alv_grid=>mc_style_disabled" for the fields you want to make uneditable.

    3. After calling the displaying method, you should register the edit event by calling the method "register_edit_event" for the ALV instance. Here you have two choices for the importing parameter "I_EVENT_ID".

    -> the static attribute "cl_gui_alv_grid=>mc_evt_enter" to make ALV events triggered after "ENTER" key is pressed

    -> the static attribute "cl_gui_alv_grid=>mc_evt_modified" to make ALV events triggered as soon as there is a field change.

    4. Call the method "set_ready_for_input" by passing "1" to the parameter "i_ready_for_input".

    5. If you want to control the inputs you can use an event handler instance implementing methods for the events "DATA_CHANGED" and "DATA_CHANGED_FINISHED" of ALV Grid class.

    Have a glance to the sample programs that Sukru recommended for illustration.

    Have fun!

    *--Serdar

    Add comment
    10|10000 characters needed characters exceeded