Skip to Content
0
Former Member
Jan 20, 2011 at 06:29 PM

CL_SALV_TABLE Refresh

3365 Views

Hi all,

I have 2 ALVS in a report. when I click the customer in first(top) ALV it should show data related to that customer in second(bottom) ALV.

Everything is working fine. First time when I click it showing the data of that customer perfectly. But when I clcik another customer its still showing the old data. I tried different ways to refresh. But no success.

Anyhelp will be appreciated.

Code :

Click Method:

METHOD on_link_click.

FIELD-SYMBOLS : <fs_customer> TYPE ty_parent.

READ TABLE gt_parent ASSIGNING <fs_customer>

INDEX row.

IF <fs_customer> IS ASSIGNED.

if gr_table2 is bound.

.

clear : g_custom_container2

, gr_table2

.

endif.

IF column EQ 'CUSTOMER'.

gt_child1[] = gt_child[].

DELETE gt_child1 WHERE distributor NE <fs_customer>-customer.

ENDIF.

w_flag = 'X'.

CALL SCREEN 100.

CLEAR w_flag.

.

ENDMETHOD. "on_single_click

Display ALV:

IF w_flag = 'X'.

IF g_custom_container2 IS NOT BOUND.

IF cl_salv_table=>is_offline( ) EQ if_salv_c_bool_sap=>false.

CREATE OBJECT g_custom_container2

EXPORTING

container_name = 'CUSTOM2'.

ENDIF.

TRY.

cl_salv_table=>factory(

EXPORTING

r_container = g_custom_container2

container_name = 'CUSTOM2'

IMPORTING

r_salv_table = gr_table2

CHANGING

t_table = gt_child1 ).

CATCH cx_salv_msg. "#EC NO_HANDLER

ENDTRY.

lr_functions = gr_table2->get_functions( ).

lr_functions->set_all( gc_true ).

lr_columns = gr_table2->get_columns( ).

lr_columns->set_optimize( gc_true ).

lr_display_settings = gr_table2->get_display_settings( ).

lr_display_settings->set_list_header( l_title ).

lr_display_settings->set_striped_pattern( cl_salv_display_settings=>true ).

gr_table2->display( ).

CLEAR w_flag.

gr_table2->refresh( ).

ENDIF.

Any help will be greatly appreciated

Thanks