| Home • Tips • Tutorials • Forums • Certification Q's • Interview Q's • Jobs • Testimonials • Contact Us | ||
Document Categories:
What's New?
Contribute?Sample SpecsWhat's Hot? |
Using an ALV with Dynamic Context Nodes in Web DynproBy Raja Narayanan, Kaavian Systems Create a Web Dynpro Component as ZZ_DYNAMIC_CONTEXT
Declare
the usage of the ALV component inside component
ZZ_DYNAMIC_CONTEXT
Create
view MAIN_VIEW
Declare
the usage of the ALV component inside view MAIN_VIEW
Create
context element and layout for storing DDIC table entry. In
the view MAIN_VIEW create a context node INPUT with an
attribute TABLENAME of type string.
Navigate to the layout tab and create the following
elements:
Now Your Layout look like this…
Navigate into the event handler method ONACTIONSHOW of view MAIN_VIEW
and write the following code method ONACTIONSHOW . DATA: *Node Info rootnode_info type ref to if_wd_context_node_info, *Context Nodes dyn_node type ref to if_wd_context_node, tabname_node type ref to if_wd_context_node, *String (for table name) tablename type string. *get node info of context root node rootnode_info = wd_context->get_node_info( ). *get the name of the table to be created.
tabname_node = wd_context->get_child_node( name = 'INPUT' ).
tabname_node->get_attribute( Exporting name = 'TABLENAME'
Importing value = tablename ).
translate tablename to upper case.
*create sub node named TEST1 of structure (tablename) cl_wd_dynamic_tool=>create_nodeinfo_from_struct( parent_info = rootnode_info node_name = tablename structure_name = tablename is_multiple = abap_true ). DATA: stru_tab type ref to data. field-symbols: <tab> type table. *Create Internal Table create data stru_tab type table of (tablename). assign stru_tab->* to <tab>. *Get table content select * from (tablename) into corresponding fields of table <tab>. *get instance of new node dyn_node = wd_context->get_child_node( name = tablename ). *Bind Internal table to context node. dyn_node->bind_table( <tab> ). *instantiate alv component data: l_ref_cmp_usage type ref to if_wd_component_usage. 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. *pass context node to alv data: l_ref_interfacecontroller type ref to iwci_salv_wd_table . l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ). l_ref_interfacecontroller->set_data( dyn_node ). endmethod.
Navigate to the window and into tab window and embed view MAIN_VIEW
into the window. Thereafter embed view TABLE of the ALV component
into the ViewContainerUIelement CONTAINER.
Create
a Web Dynpro application for your Web Dynpro component. Activate
your Web Dynpro component and execute. Output:
|
|
|
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us ©2006-2007 SAPTechnical.COM. All rights reserved. All
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG. Graphic Design by Round the Bend Wizards |
||