Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

dynamically adding rows to a statically created table

Hi

I have a scenario in which i need to add rows dynamically to a statically created table that is

i have a table employee wid columns name and location

ill have two input fields along wid the table wen i press on save the information i have entered inthe input field should be added in the table

is this scenario possible

Regards

Nikhil Tapkir

Edited by: Nikhil Tapkir on Sep 10, 2008 6:43 PM

replied

Nikhil,

If the table is bound to a Node and Table columns represent Node Attributes, you can use this example to add another row to table. Create another context structure similer to that in table to hold the values to be added, create a Form based on this new structure, add a button and onActionEvent of this button write something like this.

public void onActionAddProduct(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionAddProduct(ServerEvent)
	  IProductsElement product = wdContext.createProductsElement();

      product.setARTICLE(wdContext.currentContextElement().getARTICLE());
      product.setCOLOR(wdContext.currentContextElement().getCOLOR());
      product.setCURRENCY("EUR");
      product.setSIZE(wdContext.currentContextElement().getSIZE());
      product.setORDER_NUMBER(wdContext.currentContextElement().getORDER_NUMBER());
      product.setPRICE(wdContext.currentContextElement().getPRICE());
      product.setSPECIAL_FEATURES(wdContext.currentContextElement().getSPECIAL_FEATURES());
      product.setTEXTILE_CATEGORY(wdContext.currentContextElement().getTEXTILE_CATEGORY());

      wdContext.nodeProducts().addElement(product);
    //@@end
  }

New line will be added to the table and will be visible as last line because a server round trip is involved due to action event. This code sample extends [sample Table project|https://www.sdn.sap.com/irj/sdn/nw-ui?rid=/webcontent/uuid/503f22f6-b978-2a10-bf97-ddc21267e752#46].

Hope this helps.

Vishwas.

PS: I liked your article about Fetching User Details.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question