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: 

How to control Enter key (or data changed) using REUSE_ALV_GRID_DISPLAY?

Former Member
0 Kudos

Hi all,

I have an editable ALV, using FM "REUSE_ALV_GRID_DISPLAY". I like to check when user changes the data from a cell or when press Enter key. How can I do it?

REMEMBER: It's isn't a OO ALV, I'm showing it througth FM.

Regards,

Roberto Campo

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

i_yatthdr_old[] = i_yatthdr[].  " keep the old value
    call function 'REUSE_ALV_GRID_DISPLAY'
      exporting
        it_fieldcat                 = i_fieldcat[]
        is_layout                   = pt_grplayout2
        i_callback_program          = 'YATTU0007'
        i_callback_html_top_of_page = p_header
        i_callback_user_command     = 'F_USER_COMMAND1'
        it_events                   = i_events[]
      tables
        t_outtab                    = i_yatthdr.
  else.
    message i012(yscc).
  endif.
endform.                                 " F_alv_edit_oruser
*
*&---------------------------------------------------------------------*
* Form  f_user_command1                                                *
*&---------------------------------------------------------------------*
* This form will handle the user command from fm REUSE                 *
*----------------------------------------------------------------------*
form f_user_command1 using p_ucomm type sy-ucomm
                     rs_selfield type  slis_selfield.

  data p_ref1 type ref to cl_gui_alv_grid.
  call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    importing
      e_grid = p_ref1.
  call method p_ref1->check_changed_data.
 if i_yatthdr_old[] ne i_yatthdr[].
   " Then do something
endif.

5 REPLIES 5

former_member194669
Active Contributor
0 Kudos

i_yatthdr_old[] = i_yatthdr[].  " keep the old value
    call function 'REUSE_ALV_GRID_DISPLAY'
      exporting
        it_fieldcat                 = i_fieldcat[]
        is_layout                   = pt_grplayout2
        i_callback_program          = 'YATTU0007'
        i_callback_html_top_of_page = p_header
        i_callback_user_command     = 'F_USER_COMMAND1'
        it_events                   = i_events[]
      tables
        t_outtab                    = i_yatthdr.
  else.
    message i012(yscc).
  endif.
endform.                                 " F_alv_edit_oruser
*
*&---------------------------------------------------------------------*
* Form  f_user_command1                                                *
*&---------------------------------------------------------------------*
* This form will handle the user command from fm REUSE                 *
*----------------------------------------------------------------------*
form f_user_command1 using p_ucomm type sy-ucomm
                     rs_selfield type  slis_selfield.

  data p_ref1 type ref to cl_gui_alv_grid.
  call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    importing
      e_grid = p_ref1.
  call method p_ref1->check_changed_data.
 if i_yatthdr_old[] ne i_yatthdr[].
   " Then do something
endif.

0 Kudos

Sorry, but this solution isn't correct.

The program don't execute form F_USER_COMMAND1 when user change alv data or press enter key.

More suggestions please?

Regards,

Roberto Campo

0 Kudos

No help?

Thanks in advance. Regards,

Roberto Campo

Former Member
0 Kudos

Have you seen if there is some events (parameters IT_EVENT_EXIT) that triggere the key pressed or cell changed??

0 Kudos

Yes, I've allready checked this.

Event "DATA_CHANGED" only is triggered when user press cell matchcode. When data is changed the event isn't triggered.

We've changed plans. We will change this ALV for OO ALV one. So I'll don't need more help.

Thanks all!

Regards,

Roberto Campo

Edited by: Roberto Campo on Feb 27, 2008 11:58 AM