cancel
Showing results for 
Search instead for 
Did you mean: 

how to insert data from a form into a table

Former Member
0 Kudos

hai i have two views

my first view is a table with 2 columns

my second view is a form with 2 input fields with a button

i want to display this input field data into table when i submit button

thanks in advance

mohammad khajamiya

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Mohammad

1. Creata a value node with 2 attributes.

Say Sample

attA

attB

create this node in the view context where your table is present.

2. Bind this value node to the table.

3. In the view where your input fields are there say the context attributes is inpA,inpB

4. Right click on your webdynpro component and open diagram view and create a outbound plug from the view where you have input fields to the view where you have table. Pass the context attributes inpA,inpB as paramters to the outbound plug.

5. In the onPlug<...> of the second view where your table is present populate the node sample

Kishore

5.

Former Member
0 Kudos

Hi

Ok say your input fields are bound to context attributes "inp1" and "inp2" of type string.

You have a value node in the second view say "TableNode" of cardinality 0..N and having two value attributes "Col1" and "Col2".

This value node is bound to the table UI Element.

Note : Before that in your case you have 2 views. Now in the second view containing the table create 2 context attributes say "inp1" and "inp2". In the Component Controller create 2 context attributes say "inp1" and "inp2" again. Now do a context mapping between this view1 and component controller and then from the component controller to the view2 so that the values from the form are available to the second view containing the table.

Now on click of submit button you would like to add the values from the form to the table.

Associate a action with the button submit.

In the implementation of Submit.

IPrivate<ViewName>.ITableNodeElement elt = wdContext.nodeTableNode().createTableNodeElement();

wdContext.nodeTableNode().bind(elt);

wdContext.currentTableNodeElement().setCol1(wdContext.currentContextElement().getInp1());

wdContext.currentTableNodeElement().setCol2(wdContext.currentContextElement().getInp2());

wdContext.nodeTableNode().moveNext();

Hope that helped you.

regards

ravi