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 combox refresh description

Former Member
0 Likes
521

Hi all,

I've a table with 2 columns : first a combox with identifier ; second the identifier description.

I'd like if possible to refresh in automatic the identifier description at each pick up combox identifier.

Best regards.

Miki

3 REPLIES 3
Read only

Sougata
Active Contributor
0 Likes
459

Hi Maurizio,

You might consider doing it as per instuctions below.

First, after you call the method to display the ALV Grid (call method gt_grid-><b>set_table_for_first_display</b>), add the following code as below:

* register ENTER to raise event DATA_CHANGED.
    call method gt_grid->register_edit_event
      exporting
        i_event_id = cl_gui_alv_grid=>mc_evt_modified.

* handle the events of grid after user changes grid data
    set handler go_ref->handle_data_changed for gt_grid.

Define and Implement the method handle_data_changed in your class definition followed by the method implementation as below:

class my_class definition.
 public section.
   methods: handle_data_changed for event data_changed of cl_gui_alv_grid
                                                  importing er_data_changed.
endclass

  method handle_data_changed.
    data: ls_good type lvc_s_modi.

    data_changed = abap_true.
    error_in_data = space.

* loop over table MT_GOOD_CELLS to check all values that are changed by user
    loop at er_data_changed->mt_good_cells into ls_good.
      case ls_good-fieldname.
        when 'COMBOX_ID'.
*         perform your_checks_here changing error_in_data.
*         Also Select/Move the description of the COMBOX_ID selected by user and 
*         pass it to the corresponding COMBOX_DESCRIPTION. Modify the main 
*         internal tab.that you pass to set_table_for_first_display
      endcase.
    endloop.

* display application log if an error has occured.
    if error_in_data = abap_true.
      call method er_data_changed->display_protocol.
    else.
*  No error in data is found and your main internal table is ready with all 
*  descriptions already updated - now refresh the ALV Grid
    call method gt_grid->refresh_table_display.
   endif.
  endmethod.                    "handle_data_changed

Hope this solves the problem.

Don't forget to reward points.

Cheers,

Sougata.

Read only

Former Member
0 Likes
459

Hi,

I've used REUSE_ALV_EVENTS_GET function con event DATA_CHANGED and corresponding Form for changing the description content of alv internal table(release 46c) but with the debugging the event not trigger.

Best regards.

Miki

Read only

0 Likes
459

Hi,

I suggest you don't use those Function Modules for ALV display but use method SET_TABLE_FOR_FIRST_DISPLAY of class CL_GUI_ALV_GRID to output your ALV grid. The reason being that event CHECKED_DATA_CHANGED will work every time user changes any data on the grid.

Then use the code I've provided in my previous post.

<b>I've spent a lot of time on your problem so please don't forget to reward points.</b>

Cheers,

Sougata.