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 GRID.

Former Member
0 Likes
1,040

Dear All,

I am working on editable alv grid and kind of stuck at a point.

I have got an internal table which has got the fields lifnr and name1.

When the user executes the report, an empty record comes up with lifnr as editable. The times users enter a lifnr and press enter then the corresponding name will come up.

So to accomplish this requirement I am using the events data_changed and data_changed_finished of cl_gui_alv_grid.

And my code looks something like this.


form DATA_CHANGED  using    p_er_data_changed
                   TYPE REF TO cl_alv_changed_data_protocol.
  DATA: ls_mod_cells TYPE lvc_s_modi.
  DATA: ls_cells TYPE lvc_s_modi,
        l_lifnr TYPE lifnr.

LOOP AT p_er_data_changed->mt_good_cells INTO ls_mod_cells.
  CALL METHOD p_er_data_changed->get_cell_value
              EXPORTING
              i_row_id = ls_mod_cells-row_id
              i_fieldname = 'LIFNR'
              IMPORTING
              e_value = l_lifnr.
  g_lifnr = l_lifnr.
ENDLOOP.
ENDFORM.       

the corresponding data_changed_finished look like this.


 METHOD handle_data_changed_finished.
   IF e_modified = 'X'.
     SELECT SINGLE * FROM zemp_rem
                  INTO CORRESPONDING FIELDS OF  it_zemp
                  WHERE lifnr = g_lifnr.
       IF sy-subrc eq 0.
                ENDIF.
    ENDIF.
   ENDMETHOD.

Now my problem is after entering the lifnr and pressing enter the name dosn't show up, but when executed in debuging mode, the name is populating into the internal table.

Can anybody please help me in this regard.

Regards,

Abhinab Mishra

Dear All,

I am working on editable alv grid and kind of stuck at a point.

I have got an internal table which has got the fields lifnr and name1.

When the user executes the report, an empty record comes up with lifnr as editable. The times users enter a lifnr and press enter then the corresponding name will come up.

So to accomplish this requirement I am using the events data_changed and data_changed_finished of cl_gui_alv_grid.

And my code looks something like this.


form DATA_CHANGED  using    p_er_data_changed
                   TYPE REF TO cl_alv_changed_data_protocol.
  DATA: ls_mod_cells TYPE lvc_s_modi.
  DATA: ls_cells TYPE lvc_s_modi,
        l_lifnr TYPE lifnr.

LOOP AT p_er_data_changed->mt_good_cells INTO ls_mod_cells.
  CALL METHOD p_er_data_changed->get_cell_value
              EXPORTING
              i_row_id = ls_mod_cells-row_id
              i_fieldname = 'LIFNR'
              IMPORTING
              e_value = l_lifnr.
  g_lifnr = l_lifnr.
ENDLOOP.
ENDFORM.       

the corresponding data_changed_finished look like this.


 METHOD handle_data_changed_finished.
   IF e_modified = 'X'.
     SELECT SINGLE * FROM zemp_rem
                  INTO CORRESPONDING FIELDS OF  it_zemp
                  WHERE lifnr = g_lifnr.
       IF sy-subrc eq 0.
                ENDIF.
    ENDIF.
   ENDMETHOD.

Now my problem is after entering the lifnr and pressing enter the name dosn't show up, but when executed in debuging mode, the name is populating into the internal table.

Can anybody please help me in this regard.

Regards,

Abhinab Mishra

7 REPLIES 7
Read only

Former Member
0 Likes
1,008

can anybody throw some light into this please.

Read only

0 Likes
1,008

after populating the values, you need to refresh your grid

call method <grid>->refresh_table_display .

Read only

0 Likes
1,008

Dear Durairaj,

Thank you for the response.

I have already tried refreshing the table but the result is same.

I have refreshed the table in the handle_data_changed_finished methods implemantation.

Is it the write place to refresh the table or do i need to code that some where else.

Regards,

Abhinab Mishra

Read only

0 Likes
1,008

in my case i have done it in user_command event. (in your case its the enter press user command)

Read only

0 Likes
1,008

Nothing is working in my case.

Is there any other way to do it??

I have tried in the PAI event also but nothing works.

In PAI.


if cl_gui_alv_grid=>mc_evnt_enter is not initial.
select data
then grid->refresh_table_display.
endif

But nothing is working in my case.

Can anybody provide me with a sample report.

Regards,

Abhinab Mishra

Read only

0 Likes
1,008

Hi Abhinab,

your code does not look like ABAP.

I use this method to refresh the table display after making changes to the table displayed:

METHOD refresh_display_stable.
  DATA:
    ls_stbl     TYPE lvc_s_stbl.
  ls_stbl-row =
  ls_stbl-col = abap_true.
  mo_grid->refresh_table_display( is_stable = ls_stbl ).
ENDMETHOD.

You must make sure that the table you change is really the one you actually display. When working in OO context, it may happen that you use another instance of an attribute.

If you don't get it working, please post some essential lines of your code: The ones with set_table_for_first_display including all parameters and the one where you handle the enter event (did you activate it using method register_edit_event?) and modify/refresh the table.

Regards,

Clemens

Read only

Former Member
0 Likes
1,008

Problem Solved !!