Application Development 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: 

Row id in editable ALV while using MP_MOD_ROWS

suniljith_ss
Explorer
0 Kudos

Hi Experts

I have an editable alv with 13 fields editable in it. Inside the DATA_CHANGED event i am making use of the attribute MP_MOD_ROWS for doing some specific validations. But I am not able to pass the row_id to the the mehod add_protocal_entry while multiple rows are in MP_MOD_ROWS ,since its not available MP_MOD_ROWS .

Can anyone tell me how i can get the row_id for each row in MP_MOD_ROWS.

Since I need the full row for validations , i cant use MT_MOD_CELLS.

Regards,

Suniljith.SS

8 REPLIES 8

Former Member
0 Kudos

Hi,

Try using the method DATA_CHANGED_FINISHED.

Regards,

Ernesto.

0 Kudos

Hi.

Thanks for ur response.

But i dont think its possible to call the method add_protocal_entry inside DATA_CHANGE_FINISHED.

My purpose is to get the row ids for each row in MP_MOD_ROWS for highlighting the wrong entries after validations.

Regards,

Suniljith.S.S

0 Kudos

You can try then method CHECK_CHANGED_DATA where inside you get the column position and then it calls method DATA_CHANGED.

0 Kudos

Hi,

My requirements is as follows.

Suppose I have 5 modified rows in MP_MOD_ROWS out of the 10 rows in the alv grid. I am looping this five rows and doing validations and needs to raise pop up error message using the method add_protocal_entry. Here I need the row_id to pass to the method add_protocol_entry inorder to highlight the wrong entry in each row.

Please advise.

Regards,

Suniljith.SS

0 Kudos

Hi Experts,

I am still waiting for a solution.

Regards,

Suniljith.S.S

0 Kudos

Hi,

this is an excerpt of what we dir:

METHOD handle_data_changed.
...
  FIELD-SYMBOLS:
    <dat> TYPE ANY,
    <mod> TYPE LINE OF lvc_t_modi,
...
  LOOP AT er_data_changed->mt_mod_cells ASSIGNING <mod>.
...
* error case, sy-subrc <> 0 returned by MESSAGE ... RAISING
      symsg2alv_changed_data_prot( ir_cl_alv_changed_data_prot  = er_data_changed
                                   is_modi                      = <mod> ).
      DELETE er_data_changed->mt_mod_cells.
...

using the method

METHOD symsg2alv_changed_data_prot.

  MESSAGE
    ID sy-msgid
    TYPE sy-msgty
    NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
    INTO mv_msg. "for debug transparancy
  ir_cl_alv_changed_data_prot->add_protocol_entry(
    i_msgid     = sy-msgid
    i_msgty     = sy-msgty
    i_msgno     = sy-msgno
    i_msgv1     = sy-msgv1
    i_msgv2     = sy-msgv2
    i_msgv3     = sy-msgv3
    i_msgv4     = sy-msgv4
    i_fieldname = is_modi-fieldname
    i_row_id    = is_modi-row_id
*      i_tabix     = i_tabix
       ).

ENDMETHOD.

I do not understand your question about row_id as this is a component lvc_t_modi table. I don't know MP_MOD_ROWS as there is only attribute MT_MOD_ROWS of parameter ER_DATA_CHANGED of event DATA_CHANGED of CL_GUI_ALV_GRID.

Regards,

Clemens

0 Kudos

Hi,

Check it out,

PUBLIC SECTION.
CLASS-METHODS : m_data_changed FOR EVENT data_changed OF
cl_gui_alv_grid IMPORTING er_data_changed.

CLASS data_changed IMPLEMENTATION.
LOOP AT er_data_changed->mt_mod_cells INTO x_mod_cells.

CALL METHOD er_data_changed->modify_cell
EXPORTING
i_row_id = x_mod_cells-row_id
* i_tabix = x_MOD_CELLS-tabix
i_fieldname = x_mod_cells-fieldname
i_value = x_mod_cells-value
.
IF sy-subrc EQ 0.
MOVE er_data_changed->mt_mod_cells TO itab.
loop at itab INTO xtab.

ENDLOOP.

ENDIF.
ENDLOOP.
endclass.

Jshree

Former Member
0 Kudos

After editing all the fields, you can select all the rows you edited and

Use this method of CL_GUI_ALV_GRID class

CALL METHOD r_grid->get_selected_rows

IMPORTING

et_index_rows = gint_selected_rows.

all the selected row indexes will be in gint_selected_rows....

you can use those indexes to read the contents.