cancel
Showing results for 
Search instead for 
Did you mean: 

create new child-node in supply-function

Former Member
0 Kudos

I want create a new node in a Supply-Function and fill them with data.

It is possible to create the node,

cl_wd_dynamic_tool=>create_nodeinfo_from_struct(

parent_info = node_info

node_name = 'NODE_3'

structure_name = l_structure_name

is_multiple = abap_true

is_mandatory = abap_false ).

but I canu2019t get access to it.

l_cntx_nd_result = node->get_child_node( 'NODE_3' ).

(l_cntx_nd_result is initial)

Node_1 has already one Child-node u2018NODE_2u2019 created at Design time.

I also canu2019t get access to this node in the Supply-Function.

l_cntx_nd_result = node->get_child_node( 'NODE_2' ).

I get Access to the new Node (NODE_3) in the NODE_1-Action, but not in the Supply-Function.

Do I make any a mistake?

Thanks for Help.

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

It should fetch the child node.

can you post the complete code of ur supply function.

thanks

sarbjeet singh

Former Member
0 Kudos

Hallo sarbjeet singh,

thank you for your 1th answer, here the complete Supply-Function-code

DATA: lt_node_1 TYPE wd_this->Elements_node_1,

ls_node_1 LIKE LINE OF lt_node_1.

data: l_cntx_nd_info_self TYPE REF TO if_wd_context_node_info,

l_cntx_nd_result TYPE REF TO if_wd_context_node.

l_cntx_nd_info_self = node->get_node_info( ).

cl_wd_dynamic_tool=>create_nodeinfo_from_struct(

parent_info = l_cntx_nd_info_self

node_name = 'NODE_2'

structure_name = 'mystruct'

is_multiple = abap_true

is_mandatory = abap_false ).

"node->set_lead_selection( parent_element ).

l_cntx_nd_result = node->get_child_node( 'NODE_2' ).

" !!! l_cntx_nd_result is initial !!!

"fill node with data....

"...

"node->bind_table(...

Former Member
0 Kudos

" !!! l_cntx_nd_result is initial !!! suggest me that the cl_wd_dynamic_tool=>create_nodeinfo_from_struct did not create a child node.

You can try the following code ,which works for me. However i suspect now that the structure name is not correct.

If it is your local structure then i would have expected a Zmystruct, name space is also missing if it is a not a local object. So please check this out if your mystruct structure exists in DDIC.

lv_struct-name = 'mystruct'.
  call method l_cntx_nd_info_self>add_new_child_node
    exporting
*    supply_method                =
*    supply_object                =
*    dispose_method               =
*    dispose_object               =
      static_element_type          = lv_struct_name
      name                         = `NODE_2`
*    is_mandatory                 = ABAP_FALSE
*    is_mandatory_selection       = ABAP_FALSE
      is_multiple                  = abap_true
*    is_multiple_selection        = ABAP_TRUE
*    is_singleton                 = ABAP_FALSE
*    is_initialize_lead_selection = ABAP_TRUE
*    static_element_rtti          = lv_struct_name
      is_static                    = abap_false
*    attributes                   =
    receiving
      child_node_info              = lo_child_node_info
      .
 
 
  if not lo_child_node_info is initial.
 
     l_cntx_nd_result = nodt->get_child_node( name = `NODE_2` ).
endif.

Former Member
0 Kudos

After

call method l_cntx_nd_info_self>add_new_child_node

the lo_child_node_info isn't initial, but

after

l_cntx_nd_result = node->get_child_node( name = `NODE_2` ).

l_cntx_nd_result ist still initial.

Former Member
0 Kudos

Hi,

whats the cardinality and selection property values for 'node'??

I guess if it has got multi cardinality, then you may need to get the child node using the lead selected element of the node 'node'.

Hope this helps!

Regards,

Srilatha

Former Member
0 Kudos

Hi,

I suspect this is something to do with Supply function.

I would suggest to copy the code and place it in a method and test it.

Former Member
0 Kudos

I suspect this is something to do with Supply function.

I would suggest to copy the code and place it in a method and test it.

I think, I shouldnu2019t fill the new node in the Supply-Function, maybe in u2018onLoadChildrenu2019.

Thanks for Help.

Answers (0)