cancel
Showing results for 
Search instead for 
Did you mean: 

Add a row in table

Pramanan
Active Participant
0 Kudos

Hi,

I have a node with one arrtribute and a child node. The parent node is bound to a table ui element.I want to add a new row to the table in a button click.

Before i have done with single node and it was working fine.But i have one child node inside the node.

That is the problem.

Accepted Solutions (0)

Answers (2)

Answers (2)

Pramanan
Active Participant
0 Kudos

solved

Former Member
0 Kudos

Hi Ramanan,

I think you are creating an element of the node (bounded to the table) and are facing problems.

Please create an element of the child node also and the add it to parent node.

I think this is the problem.

In case of issues please revert back with cardinalities of the nodes, your code and cardinalities of the nodes.

I hope it helps.

Regards,

Sumit Oberoi

Pramanan
Active Participant
0 Kudos

hi sumit,

My parent node is first_node under that i am having one attribute as emp_number and a child node as Emp_details.

I bound the first_node (parent node) to a table ui element. On the button click i need to add one new line.

Can you please give me the code for this scenario.

Former Member
0 Kudos

Hi Ramanan,

please see my below reply.

Sumit

Edited by: Sumit Oberoi on Oct 20, 2008 7:30 AM

Former Member
0 Kudos

Hi Ramanan,

Please make the 'emp detals' node as a singletn node.

Then apply the following code.


first_node_elem type ref to if_wd_context_element
child node type ref to if_wd_context_node
child_node_elem type ref to if_wd_context_element



first_node_elem = first_node->create_element(  ).

* Set attributes
first_node_elem->set_attribute(
name = 'Emp_number'
value = 10000
).

first_node-.bind_element(
new_item = first_node_elem
set_initial_elements = abap_false).

* Create Child node
child_node = wd_context->get_child_node(  'Emp_Details' ) .
child_node_elem = child_node->create_element( ).

*Set child attributes

child_node_elem->set_attributes(
name = 'Name'
value = 'Ramanan'
).

child_node->bind_element(
new_item = child_node_elem
set_initial_elements = abap_false).

I hope it helps.

Regards,

Sumit Oberoi

Former Member
0 Kudos

Hi Ramanan,

Please close the thread if your problem is solved and do provide the solution.

If you are still facing the problem please come up with the issues.

Regards,

Sumit Oberoi