I've created a component for displaying data in an ALV, with the intention of using it in other components.
The component controller has two methods:
SET_DATA_STRUCTURE (parameter I_attributes IMPORTING type WDR_CONTEXT_ATTR_INFO_MAP).
SET_CONTENTS (parameter i_reference_contents IMPORTING type ref to data).
The both trigger similarly named events which are reacted to by the view controller.
The handler for the data structure is this:
data root_info type ref to if_wd_context_node_info.
root_info = wd_context->get_node_info( ).
data data_node type ref to if_wd_context_node_info.
data_node = root_info->add_new_child_node( name = 'DATA'
is_initialize_lead_selection = abap_false
is_static = abap_false
is_multiple = abap_true
attributes = i_structure ).
The handler for set_contents sets the view attribute reference_to_contents.
The WDDOMODIFYVIEW method handles the contents (only when there is new data).
data lo_nd_table_contents type ref to if_wd_context_node.
lo_nd_table_contents = wd_context->get_child_node( name = 'DATA' ).
field-symbols <table_contents> type any table.
assign wd_this->reference_to_contents->* to <table_contents>.
if <table_contents> is assigned.
lo_nd_table_contents->bind_table( new_items = <table_contents> set_initial_elements = abap_true ).
endif.
data lo_interfacecontroller type ref to iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
lo_interfacecontroller->set_data( r_node_data = lo_nd_table_contents ).
wd_this->new_contents = abap_false.
When I test my application, I can see inthe debugger that the context is correctly created and populated. The data is bound correctly to the context. But no data is displayed in the grid.
I've looked through the various tutorials, and can't see what I've missed.
I've instantiated the usage in WDOINIT of the view. I've embedded the control in the window. Every step checks out - but still no data is seen. I've tried the refresh method on the interface controller of the usage - nothing.
I've just checked, and the field order and field names of the data being sent in reference_to_contents are identical to that in i_attributes.