cancel
Showing results for 
Search instead for 
Did you mean: 

How to link a tree to a ALV table

0 Kudos

Hi Experts,

I have a tree node on the left side of my display.

Now according to the user selection on the tree node,

i need to populate the ALV table on the right.

That means selected value by the user is the input parameter

and should fetch the corresponding data accordingly and displays on the ALV table on the right.

Please advise.

Regards,

Chitrasen

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member210967
Participant
0 Kudos

Hi,

Define the ON_FUNCTION event in the view controller. This is an event of your ALV. In the coding of this event handler method put code like:

METHOD on_select .

DATA: temp TYPE string.

temp = r_param->id.

IF temp = 'LBUTTON'.

wd_comp_controller->get_selected_line_via lead_selection( ).

ENDIF.

ENDMETHOD.

What also needed is next code to be placed in method wdoinit of the component controller:

METHOD wddoinit .

DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage,

l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table.

DATA: lr_column TYPE REF TO cl_salv_wd_column.

l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).

IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.

l_ref_cmp_usage->create_component( ).

ENDIF.

l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).

wd_this->l_value = l_ref_interfacecontroller->get_model( ).

*&- Specify the display type

wd_this->l_value->if_salv_wd_table_settings~set_display_type(

if_salv_wd_c_table_settings=>display_type_hierarchy ).

wd_this->l_value->if_salv_wd_table_settings~set_enabled( abap_true ).

*&- Specify a hierarchy columns Bucket, RE, PE and AE

lr_column = wd_this->l_value->if_salv_wd_column_settings~get_column( 'BUCKET' ).

lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).

lr_column = wd_this->l_value->if_salv_wd_column_settings~get_column( 'RE' ).

lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).

lr_column = wd_this->l_value->if_salv_wd_column_settings~get_column( 'PE' ).

lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).

lr_column = wd_this->l_value->if_salv_wd_column_settings~get_column( 'AE' ).

lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).

*&- Display data of the last hierarchy as leaf

wd_this->l_value->if_salv_wd_table_hierarchy~set_last_hier_column_as_leaf( abap_true ).

*&- Create function in toolbar

DATA lr_button TYPE REF TO cl_salv_wd_fe_button.

DATA button1 TYPE REF TO cl_salv_wd_function.

CREATE OBJECT lr_button.

lr_button->set_text( 'SELECT' ).

button1 = wd_this->l_value->if_salv_wd_function_settings~create_function( id = 'LBUTTON' ).

button1->set_editor( lr_button ).

ENDMETHOD.

Cheers, John

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Refer to the below link.

[http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5cc6f&overridelayout=true]

Regards,

Priya