on 05-21-2009 7:12 AM
Hi All,
I have this requirement that I need to display three different kind of structures in ALV one at a time. Based on specific conditions I need to bind a structure and display in ALV. But under controller usage for ALV we have only one DATA node. Can we dynamically bind any of my structures to the only DATA node?
Please suggest me the way to do it.
Thanks in advance.
Regards
Archana Dvivedi
Hi Archana,
Refer this article: [Using ALV with a Dynamic Context Node in Web Dynpro for ABAP|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/4c70444a-0801-0010-7688-9e4bd844b783]. This might help you.
Regards
Arjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Archana,
If you are note sure what kind of structure need to be asssigned at the design time you can create the context node dynamically with the structure you want and bind the same to the DATA node property of ALV. Please check the following code.
before the code create a view level attribute DYN_NODE of type if_wd_context_node.
*****Creating the node dynamically and set it in ALV ******
data : rootnode_info type ref to if_wd_context_node_info,
table_name type string,
it_table type table of (table_name). "populate it from the data base table
rootnode_info = wd_context->get_node_info( ).
table_name = structure_name. " this is the structure of table you want to use
CALL METHOD cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = table_name
structure_name = table_name
is_multiple = abap_true
).
"storing the node to view level attribute DYN_NODE
wd_this->dyn_node = wd_context->get_child_node( name = table_name ).
wd_this->dyn_node->bind_table( it_table ).
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_cds_alv( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
lo_INTERFACECONTROLLER = wd_this->wd_cpifc_cds_alv( ).
lo_interfacecontroller->set_data(
only_if_new_descr = " wdy_boolean
r_node_data = wd_this->dyn_node " ref to if_wd_context_node
).
Regards,
Anil kumar G
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I guess everytime you will have to remove the node, recreate the node with a different structure and rebind.
* delete the node
node_info = wd_context->get_node_info( ).
lt_nodes = node_info->get_child_nodes( ).
READ TABLE lt_nodes INTO ls_nodes WITH KEY name = 'MY_NODE'.
IF sy-subrc EQ 0.
node_info->remove_child_node( name = 'MY_NODE' ).
ENDIF.
Regards,
Radhika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.