cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind table to a subnode

Former Member
0 Kudos

Hi

In my context i have Node called PARENT_NODE which contains a sub node called CHILD_NODE.

Is there a way to bind a table to the CHILD_NODE ? the sub node is in cardinality 0...n 

i wrote:

data: context_node type ref to if_wd_context_node.

data: lt_table type table of childe_node.

context_node = wd_context-> get_child_node( name = 'PARENT_NODE.CHILDE_NODE').

context_node->bind_table( lt_table ).

when i test my webdynpro i get the error

"SUBNODE.PARENT.CHILD_NODE DOES NOT EXIST".

Is there a way to correct that ???

Thanks Ami

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi AMI

In order to fill the data into sub-node (CHILD_NODE) you have to use the concept of SUPPLY FUNCTION.

  • Goto CONTEXT,
  • select subnode
  • Give some method name in the beside SUPPLY FUNCTION in properties of the child_node
  • Double click on the given name in the supply function field
  • Uncomment lines starting from 13 till end of the method
  • Implement the required coding before the BIND_TABLE method
  • here is the same code, EKKO is the parent node name and EKPO is the child node name
  • Based on lead selection in EKKO  automatically EKPO node entries are fetched using SUPPLY FUNCTION concept.

DATA ls_parent_attributes TYPE wd_this->element_ekko.

parent_element->get_static_attributes(
IMPORTING
static_attributes = ls_parent_attributes ).


* data declaration
DATA lt_ekpo TYPE wd_this->Elements_ekpo.
DATA ls_ekpo LIKE LINE OF lt_ekpo.
* @TODO compute values
* e.g. call a data providing FuBa

* Manual coding
SELECT * FROM EKPO
INTO CORRESPONDING FIELDS OF TABLE lt_ekpo
WHERE ebeln = ls_parent_attributes-ebeln.
* Manual coding

* bind all the elements
node->bind_table(
new_items            =  lt_ekpo
set_initial_elements = abap_true ).

Points Please if helpful

Regards

Subhash

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ami,

You should get the path of parent node, then you can bind anything to your child node.

lo_nd_<child_node> = wd_context->path_get_node( path = `<parent node name >.<child node name>` ).

Try this you will able to execute.

Regards

Ravindranath Reddy