2008 Feb 22 1:10 PM
Dear all,
i have 2 container with 2 OO ALV. In one of this Grids i like to change the assigned internal table data.
If i do this with pushbuttons from the Dynrpo Gui status, it is running.
But if i add Pushbuttons via method (->add_function) in one of the ALV grids and try to change table assignment in the event method, i get a dump raising CX_SALV_NO_NEW_DATA_ALLOWED.
In debugging i saw, that in case of calling the method via ALV pushbutton the attribute <function_call_active> is true, therefore no change in ALV is allowed:
if r_adapter->function_call_active eq abap_true.
value = abap_false.
endif.
My method to change ALV assigning:
class lcl_handle_events_post implementation.
method on_user_command.
data:
lv_header type lvc_title.
field-symbols:
<lv_tab> type any.
case e_salv_function.
when 'IFRS'.
v_list_type = const_ifrs.
assign t_ledger_ifrs to <lv_tab>.
lv_header = text-ifr.
when 'LOCAL'.
v_list_type = const_local.
assign t_ledger_local to <lv_tab>.
lv_header = text-lcl.
when 'TOTAL'.
v_list_type = const_total.
assign t_ledger_total to <lv_tab>.
lv_header = text-tot.
when 'POST'.
v_list_type = const_post.
assign t_posting to <lv_tab>.
lv_header = text-pst.
endcase.
ref_salvset_post->set_list_header( lv_header ).
try.
ref_salvtab_post->set_data(
changing t_table = <lv_tab> ).
catch cx_salv_no_new_data_allowed.
endtry.
ref_salvtab_post->refresh( refresh_mode = if_salv_c_refresh=>soft ).
endmethod. "on_user_command
endclass. "lcl_handle_events IMPLEMENTATION
Has anybody idea?
thanks a lot,
Wolfgang
2008 Apr 17 10:46 AM
Hello Wolfgang,
did you solve this problem? Doku of CL_SALV_TABLE->SET_DATA says that it is not allowed in eventhandler.
I am facing the same problem and tried to display new data in second grid with method REFRESH( full ) but it does not work. The grid does not change...
If you have a solution, please post it.
regards,
Herbert
2008 Oct 08 4:08 PM
Hello Herbert,
sorry, i havent seen your posting.
I only set a new okcode in this event so that i come into PAI and check the new okcode:
class lcl_handle_events_post implementation.
method on_user_command.
data:
rc type sysubrc.
b_list_button = true.
call method cl_gui_cfw=>set_new_ok_code
exporting
new_code = e_salv_function
importing
rc = rc.
endmethod. "on_user_command
endclass. "lcl_handle_events IMPLEMENTATION
module init_alv output.
* PBO is sent by function when pressing button in OO ALV
* to set new table assignment to OO ALV.
if b_list_button = true.
perform:
alv_fill_top,
alv_oo_fill_bottom.
...
form alv_oo_fill_bottom.
if ref_salvtab_post is initial.
...
else.
try.
ref_salvtab_post->set_data(
changing t_table = <lv_tab> ).
catch cx_salv_no_new_data_allowed.
endtry.
ref_salvset_post->set_list_header( lv_header ).
ref_salvcols_post = ref_salvtab_post->get_columns( ).
ref_salvcols_post->set_optimize( true ).
case v_list_type.
when const_total.
perform alv_oo_rename_cols.
when const_lines.
perform alv_oo_rename_col_name using:
'TYPE' text-a15 text-a16.
endcase.
free ref_salfun_post.
ref_salfun_post = ref_salvtab_post->get_functions( ).
ref_salfun_post->set_all( ).
* enable / disable functions
perform alv_oo_functions_status_set
using ref_salfun_post.
if b_color_table = true.
try.
ref_salvcols_post->set_color_column( 'COLOR' ).
catch cx_salv_data_error.
endtry.
endif.
ref_salvtab_post->refresh( refresh_mode = if_salv_c_refresh=>soft ).
regards Wolfgang