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: 

refresh

Former Member
0 Kudos

Hi,

After entering some values into the cells of the ALV which are editable

these values are in the debugger not visible. What has to be done. ?

The entered values should be visible in the debugger

CALL METHOD ref_alv->register_edit_event
    EXPORTING
      i_event_id = cl_gui_alv_grid=>mc_evt_enter.


*  CALL METHOD ref_alv->set_ready_for_input
*    EXPORTING
*      i_ready_for_input = 1.


  CREATE OBJECT ref_alv_events.
  SET HANDLER ref_alv_events->handle_data_changed FOR ref_alv.



  CALL METHOD ref_alv->set_table_for_first_display
    EXPORTING
      is_layout            = gv_layout
      it_toolbar_excluding = it_toolbar_excluding  " TYPE UI_FUNCTIONS
    CHANGING
      it_fieldcatalog      = gt_fcat
      it_outtab            = <outtab>
    EXCEPTIONS
      OTHERS               = 4.

Please use an informative subject. I don't see what "refresh" has to do with the question or code you are posting.

Edited by: Rob Burbank on Mar 12, 2009 9:21 AM

1 ACCEPTED SOLUTION

I355602
Advisor
Advisor
0 Kudos

Hi,

Use this code to reflect data changes from alv output to internal table.


      " to reflect the data changed into internal table
      DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new

      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.

      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data.
      ENDIF.

Hope this helps you.

Regards,

Tarun

5 REPLIES 5

Former Member
0 Kudos

You need to use one method of class CL_GUI_ALV_GRID

The method name is CHECK_CHANGED_DATA.

call this method and you will get data in your internal table which you displayed in ALV.

I355602
Advisor
Advisor
0 Kudos

Hi,

Use this code to reflect data changes from alv output to internal table.


      " to reflect the data changed into internal table
      DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new

      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.

      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data.
      ENDIF.

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

Tarun where must this code be inserted. within local event class orbefore calling

CALL METHOD ref_alv->set_table_for_first_display

Regards

sas

0 Kudos

Hi,

As you are displaying data in ALV, you must be including code to handle the pf-status command in the program.

Say you have create a button with function code SAVE to save the changes into internal table done at runtime. So include this code when sy-ucomm = SAVE.


CASE sy-ucomm.
  WHEN 'SAVE'.
    " to reflect the data changed into internal table
    DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
 
    IF ref_grid IS INITIAL.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = ref_grid.
    ENDIF.
 
    IF NOT ref_grid IS INITIAL.
      CALL METHOD ref_grid->check_changed_data.
    ENDIF.
  
ENDCASE.

Now when you make changes in the editable alv grid and click SAVE button then the records will be modified in the internal table.

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

I have inserted this code within my local class for event handling .

THis method will be called if the user hits ENTER .

But this seems like a loop. It is not working

METHOD handle_data_changed.

    DATA: le_row TYPE i,
    le_value(15) TYPE c,
    le_col TYPE i,
    les_row_id TYPE lvc_s_row,
    les_col_id TYPE lvc_s_col,
    les_row_no TYPE lvc_s_roid.

    CLEAR: me->mo_data_changed.



    IF ref_alv IS INITIAL.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = ref_alv.
    ENDIF.

    IF NOT ref_alv IS INITIAL.
      CALL METHOD ref_alv->check_changed_data.
    ENDIF.

.....
.....