on 12-03-2009 8:20 AM
Hi all,
I'm trying to show data with Webdynpor ALV, but i met a question which blocked me. The situation is that there is a static context node and it's mapped to WD ALV, while programming I create a dynamic attribute to the context node. The dynamic column can be shown on the UI, but there is no any data in it. How can i deal with it?
Thanks a lot!
hi
u can bind a dynamic attribute under the dynamically created node in the same way ,
as u do for the attributes which are created at design time
To create a new node, the method add_new_child_node( ) can be used. This method hands back the reference to the metadata of the new node.
Dynamic Context AttributesAttributes for the dynamic nodes created can be created by calling the method add_attribute ( ) from the reference to the metadata of the node. This method has to be called once for each attribute.
However add_new_child_node ( ) method not only allows to create a context node, but also to create related attributes.
refer my wiki :
http://wiki.sdn.sap.com/wiki/display/stage/dynamiclayoutmanipulationinWD+ABAP
it can provide u sm assitance
regards ,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ,
try if this works ..
since u have got value into ls_column-id , declare a variable and pass this value
DATA : lv_var type string .
lv_var = ls_column-id .
make a cotext attribute (static ) under ur context node , set its value to lv_var
u can do it thru set_attribute method by using code wizard ( Control + F7 ) and choose read context node / attribute
DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
DATA ls_cn_node TYPE wd_this->element_cn_node .
* navigate from <CONTEXT> to <CN_NODE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
* get element via lead selection
lo_el_cn_node = lo_nd_cn_node->get_element( ).
* get single attribute
lo_el_cn_node->set_attribute(
EXPORTING
name = `CA_ATTR`
value = lv_var ).
//set context attribute CA_ATTR under node CN_NODE wid value LV_VAR
pls share if it works
regards,
amit
The ALV doesn't support the usage of dynamic attributes. That limitation is documented in the online help:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/42/b9ea094f4a3118e10000000a1553f7/frameset.htm
All the attributes are static, not dynamic.
Consider instead creating the entire node dynamically with an RTTI reference - so that all your attributes are technically static - but can be generated dynamically. Something like the following:
****ALV
struct_type = cl_abap_structdescr=>create( comp_tab ).
dyn_node_info = rootnode_info->add_new_child_node(
name = 'MDM_DATA'
is_mandatory = abap_false
is_mandatory_selection = abap_false
static_element_rtti = struct_type
is_multiple = abap_true
is_static = abap_false ).
* get instance of new node
dyn_node = wd_context->get_child_node( name = 'MDM_DATA' ).
dyn_node->bind_table( <table> ).
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
l_ref_interfacecontroller->set_data(
r_node_data = dyn_node ).
Hi,
Have you added it as dynamic column or not..
What you want to do next..
Using the get_columns of if_salv_wd_column_settings you can get that columns also..
If you want to get the data of the dynamic attribute, then using the node reference you can still get the attributes
get_attributes or GET_ATTRIBUTE_REF right of if_wd_context_node right...
Where are you facing problem..
Regards,
Lekha.
Edited by: Lekha on Dec 3, 2009 1:57 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lekha,
I hope the datas which I bind to the dynamic attribute can been shown on the UI.
In the table "lt_column" I can find the dynamic attribute.
lt_column = lo_col_settings->get_columns( ).
And I also can do some configuration to it, the configuration also can be recognized.
For example, the dyanmic attribute name is "SEQ".
WHEN 'SEQ'.
ls_column-r_column->set_position( 1 ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = ls_column-id.
lo_header->set_text( 'Sequence' ).
But after I bind data to the context node, of coures include the dynamic attribut, the data of the dynamic attribut cannot been shown.
I think maybe I lost any configuration for it.
Thank you very much!
Julia
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.