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

validation on editable alv grid

former_member225134
Participant
0 Likes
813

Hi,

    I am using g_grid%->check_changed_data. (call method)

after typed the value in editable field ,then press enter ---it checks the condition and throws an error.

CALL METHOD p_er_data_changed->add_protocol_entry am using call method changed_data

how can i use these here.

Hi,

    I am using g_grid%->check_changed_data. (call method)

after typed the value in editable field ,then press enter ---it checks the condition and throws an error.

CALL METHOD p_er_data_changed->add_protocol_entry am using call method changed_data

how can i use these here.

2 REPLIES 2
Read only

Former Member
0 Likes
593

HI

after g_grid%->check_changed_data  call method you wil get changed data into your internal table

from that internal table you can put validation

regards

laxman

Read only

Former Member
0 Likes
593

Hi anitha

see the piece of code 

u can get the  changed values in mt_good_cells method there u can loop based on rownid ie TABIX then u can validate ur changed fields.finaly refresh ur grid using refresh_table_display

PUBLIC SECTION .

    METHODS:

**Handler to Check the Data Change

    handle_data_changed FOR EVENT data_changed

                         OF cl_gui_alv_grid

                         IMPORTING er_data_changed

                                   e_onf4

                                   e_onf4_before,

ENDCLASS.                    "lcl_event_receiver DEFINITION

*---------------------------------------------------------------------*

*       CLASS lcl_event_handler IMPLEMENTATION

*---------------------------------------------------------------------*

CLASS lcl_event_receiver IMPLEMENTATION.

*     **Handle Data Change

  METHOD handle_data_changed.

    DATA: x_change TYPE lvc_s_modi,

          x_final TYPE itab,

          l_flag,

          ls_outtab LIKE LINE OF itab.

    DATA: ls_edit TYPE lvc_s_styl,

          lt_edit TYPE lvc_t_styl,

          lv_tabix TYPE sy-tabix.

*    UNASSIGN :<fs_price>.

*    CREATE DATA fs_price LIKE LINE OF <ft_price>.

*    ASSIGN fs_price->* TO <fs_price>.

    LOOP AT er_data_changed->mt_good_cells INTO x_change.

      lv_tabix = x_change-row_id.

      READ TABLE  gt_final  INTO gs_final INDEX lv_tabix.

      IF sy-subrc EQ 0.

        MODIFY gt_final FROM gs_final INDEX lv_tabix.

      ENDIF.

      CLEAR :  lv_tabix,gs_final.

    ENDLOOP.

    "logic for refreshing the grid

    CALL METHOD o_so_alv->set_frontend_layout

      EXPORTING

        is_layout = l_layout.

    CALL METHOD o_so_alv->refresh_table_display .