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 issue

Former Member
0 Likes
595

Hi Experts,

When i modifying the rows on the output ALV the event   mp_mod_rows is capturing only the last record how to capture all the modified records.

Thanks in Advance.

Pavan.N

3 REPLIES 3
Read only

sivaganesh_krishnan
Contributor
0 Likes
550

HI Pavan ,

try like this, its working correctly.

data: er_data_changed type ref to cl_alv_changed_data_protocol.

FIELD-SYMBOLS: <zfield> TYPE ANY.

ASSIGN er_data_changed->mp_mod_rows->* TO <zfield>.

Check out the entire program.

TYPE-POOLS: SLIS.

data: er_data_changed type ref to cl_alv_changed_data_protocol.

FIELD-SYMBOLS: <zfield> TYPE ANY.

DATA: T_SFLIGHT     TYPE STANDARD TABLE OF SFLIGHT.

DATA: IS_LAYOUT_LVC TYPE  LVC_S_LAYO.

DATA: IT_EVENTS     TYPE  SLIS_T_EVENT.

DATA: LT_EVENT      TYPE  SLIS_ALV_EVENT.

DATA: L_REPORT      TYPE SY-REPID.



START-OF-SELECTION.
*

  IS_LAYOUT_LVC-EDIT = 'X'.

  LT_EVENT-NAME      = 'DATA_CHANGED'.

  LT_EVENT-FORM      = 'ALV_DATA_CHANGED'.

  APPEND LT_EVENT TO IT_EVENTS.

*

  L_REPORT = SY-REPID.

*

  SELECT * UP TO 10 ROWS INTO TABLE T_SFLIGHT

    FROM SFLIGHT.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

    EXPORTING

      I_CALLBACK_PROGRAM = L_REPORT

      I_STRUCTURE_NAME   = 'SFLIGHT'

      IS_LAYOUT_LVC      = IS_LAYOUT_LVC

      IT_EVENTS          = IT_EVENTS

    TABLES

      T_OUTTAB           = T_SFLIGHT.

FORM ALV_DATA_CHANGED  USING

         ER_DATA_CHANGED TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.

  DATA: LS_GOOD TYPE LVC_S_MODI.

ASSIGN er_data_changed->mp_mod_rows->* TO <zfield>.



  LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO LS_GOOD.

    MESSAGE I208(00) WITH 'Data changed'.

    EXIT.

  ENDLOOP.

ENDFORM

Regards,

Sivaganesh

Read only

Former Member
0 Likes
550

Hi,

Check these standard programs

1 BCALV_EDIT_01                  Switch on and off the ready-for-inp

2 BCALV_EDIT_02                  Define ready-for-input status at ce

3 BCALV_EDIT_03                  Verification of modified cells    

4 BCALV_EDIT_04                  Delete and append rows            

5 BCALV_EDIT_05

Check these links for some Useful info on ALV:

Possible functionalities in ALV

Read only

Former Member
0 Likes
550

Are you using OOPS ALV? If so then we need to define an event and a method to handle changed data.

class lcl_event_receiver definition.

  public section.


     methods:
       handle_data_changed
          for event data_changed of cl_gui_alv_grid
              importing er_data_changed.


class lcl_event_receiver implementation.


   method handle_data_changed.

     data: ls_good type lvc_s_modi.

     data: ls_fld1_new like table-field1.

   loop at er_data_changed->mt_good_cells into ls_good.
       case ls_good-fieldname.

                   

          WHEN 'FIELD1'.

* This Method below returns your new value 

             CALL METHOD er_data_changed->get_cell_value

                 EXPORTING i_row_id = ls_good-row_id

                                        i_fieldname = ls_good-fieldname

                IMPORTING e_value = ls_fld1_new.

* Do your processing with the changed value.          

     endcase.

  endloop.