cancel
Showing results for 
Search instead for 
Did you mean: 

Model Handling in WebDynpro

Former Member
0 Kudos

Hi,

I have the following scenario : My application has an adaptive RFC model. The model is bound to the component controller context which in turn is bound to the view controller context. The entries in model are being shown in the view as a table. All the nodes in the view context are Model nodes.

The table being shown in the view has to be interactive, in the sense that user can insert new rows in it. The updated table then has to be saved back into SAP using another RFC.

The Problem : How to dynamically insert new rows in the table and save the data? I tried using createElement method but it is not working probably because the node is a Model node and NOT value node.

Any suggestions will be very helpful.Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Kapil,

You can dynamically add the rows as follows

Ex: Let us consider you have customer model.

Create new object of type customer and create an element of the modelnode type and add the element to the modelnode root. This will create a row in the table.

Ex :

Customer cust=new Customer();

wdContext.nodeCustomer().bind(cust);

You can place another button on the table toolbar and call the execute method of the RFCModel to save the rows in the backend system !!

Regards, VIP

Former Member
0 Kudos

Hi Anil,

Many Thanks.

When I follow your suggestion below, the original data stored in the model (lets say Customer model) is getting lost. Did I miss something?

Former Member
0 Kudos

Hey,

The .bind() method replaces previous binding of data to the node so the original data is lost. You should use .addElement() method of the node object to insert another "row" of data. Rest of the example source would remain the same.

--

regards

Marcin Galczynski

Former Member
0 Kudos

Hi Anil,

Sorry, i think I was too quick in replying. Yes, your solution is working and now I am able to insert new rows in the model. Yes, Marcin I just replaced the bind with the add method.

Thank you all.

Message was edited by: kapil sharma