on 12-15-2010 5:35 AM
Hi Masters,
I create a node dynamically from structure using CL_WD_DEMO_DYN_MODEL->create_nodeinfo_from_struct method. my code as
nd_field_info = nd_field->get_node_info( ).
wd_this->zwd_assist->create_nodeinfo_from_struct( EXPORTING
parent_info = nd_field_info
structure_name = dotablename
is_multiple = abap_true ).
When am set the data to context then it gives the error like node does not contain any elements, but i verified the attributes using nodeinfo then all attributes will be displayed, but when value inserting time it throws error.
Waiting for Your Response...
Advance Thankyou
Regards,
Sathya
Hi sathya ,
the method you using is absolute , the replacement for the methos is if_wd_context_node_info->add_new_child_node
pls refer the sample code to create a dynamic Node .
DATA: pa0001 TYPE REF TO cl_abap_structdescr,
comp_tab TYPE cl_abap_structdescr=>component_table,
struct_type TYPE REF TO cl_abap_structdescr,
ls_pa0001 ?= cl_abap_typedescr=>describe_by_name('P0001').
comp_tab = p0001->get_components( ).
struct_type = cl_abap_structdescr=>create( comp_tab ).
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 = 'MY_NODE'
IS_MANDATORY = ABAP_true
IS_MULTIPLE = ABAP_true
STATIC_ELEMENT_RTTI = struct_type
IS_STATIC = ABAP_false
).
refer DEMODYNAMIC component for dynamic creation of node
regards
Chinnaiya P
Edited by: chinnaiya pandiyan on Dec 15, 2010 2:07 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sathya ,
pls look into the below sdn wiki link . you can get better understanding what the runtime time type service class do
[http://wiki.sdn.sap.com/wiki/display/ABAP/RuntimeTypeServices%28RTTS%29|http://wiki.sdn.sap.com/wiki/display/ABAP/RuntimeTypeServices%28RTTS%29]
there are lot of post regarding thin in SDN
Regards
Chinnaiya P
Hi
it seems to be the issue of the cardinality. Your node is having attributes but the cardinality might me set to 0:n or 0:1 by default that's why node does not have any element Please make it 1:1 or 1:n as per your requirement.
You need to set IS_MANDATORY = ABAP_TRUE
now if is multiple is true, cardinality is 1:n and if is multiple is false then cardinality is 1:1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
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.