on 01-17-2008 5:35 AM
Hi,
Can anyone help me out with this...
I've a table in my UI. But depending on various actions clicked on the screen i need to bring in different set of values and attributes on to this table.
Is there any way out to bind a table dynamically in the program based on the requirement (or click). Basically i want to load different tables into the table element in the UI at different button clicks.
Regards,
Jomy
Hi George
in the WDDOMODIFYVIEW of your view you can use this method to create a table dynamically and bind it dynamically.
CL_WD_DYNAMIC_TOOL=>CREATE_TABLE_FROM_NODE
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
I've found this method pretty useful. But i can't quite understand its signature. This is the calling method
CALL METHOD CL_WD_DYNAMIC_TOOL=>CREATE_TABLE_FROM_NODE
EXPORTING
UI_PARENT =
TABLE_ID = tbl_results
NODE =
ON_LEAD_SELECT =
RECEIVING
TABLE =
This is the signature given
Importing UI_PARENT UI Container in which Table Is to Be Located
Importing TABLE_ID Table ID
Importing NODE Reference to the Context Node
Returning VALUE( TABLE ) Reference to New Table
therefore, what are the parameters that i need to send?
Hi Marcel,
You can use the following code. It will dynamically create a node and table. This is for ALV table. So you just have to Instantiate the ALV Component and Use Set data method after that. You would be able to see your data in the ouput.
If you would like to change the structure after any button even, you can use Remove Node method and again call the code to create a dynamic node and table.
***********************************************************************************************
DATA: node_info TYPE REF TO if_wd_context_node_info,
struct_type TYPE REF TO cl_abap_structdescr,
table_type TYPE REF TO cl_abap_tabledescr,
comp_tab TYPE cl_abap_structdescr=>component_table,
comp LIKE LINE OF comp_tab,
my_table TYPE REF TO data,
my_struc TYPE REF TO data .
FIELD-SYMBOLS: <table> TYPE table,
<strc> TYPE data,
<table1> TYPE table,
<data> TYPE ANY .
comp-name = 'COL1'.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'DATA ELEMENT' ).
APPEND comp TO comp_tab.
comp-name = 'COL2'.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'DATA ELEMENT' ).
APPEND comp TO comp_tab.
this structure contains the abovefields
struct_type = cl_abap_structdescr=>create( comp_tab ).
now the nodeinfo is created
node_info = wd_context->get_node_info( ).
node_info = node_info->add_new_child_node(
name = 'DYN_NODE'
is_mandatory = abap_true
is_multiple = abap_true
static_element_rtti = struct_type
is_static = abap_false ).
*----If you could create a local data type, would be fine, but if you
have to do it dynamically ...
struct_type = node_info->get_static_attributes_type( ).
*---Create tabledescriptor from structdescription
(standard table, no keys)
table_type = cl_abap_tabledescr=>create( p_line_type = struct_type ).
CREATE DATA my_table TYPE HANDLE table_type.
ASSIGN my_table->* TO <table1>.
CREATE DATA my_struc TYPE HANDLE struct_type.
ASSIGN my_struc->* TO <strc>.
the above code creates table and a node with 2 columns COL1 and COL2.
To Remove Node
DATA: node_info TYPE REF TO if_wd_context_node_info.
node_info = wd_context->get_node_info( ).
node_info = node_info->get_child_node( 'DYN_NODE' ).
node_info = node_info->get_parent( ).
node_info->remove_child_node( 'DYN_NODE' ).
Let me know if that helps or if you need more Info.
Thank You,
Gajendra.
hi george.......
you can make use of the class cl_wd_table.... which has the method bind_data_source... for practice you make use of the method bound_data_source.... which will give you an idea of how the values must be passed.
---regards,
alex b justin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.