Need to add new row in my table

Hi all,
1. i am developing new OAF page in which i have call stored procedure in my AM but when add code for create additional row only single row is creating.when i click for another row nonew is created.
please help..
this is the code i have used in AM
package EmployeeDetail.oracle.apps.fnd.EmployeeDetail.server;
import java.sql.CallableStatement;
import java.sql.SQLException;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.apps.jtf.gantt.javaui.events.TaskIdEvent;
import oracle.jbo.Row;
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
public class EmployeeDetailAMImpl extends OAApplicationModuleImpl {
/**This is the default constructor (do not remove)
public EmployeeDetailAMImpl() {
/**Sample main for debugging Business Components code using the tester.
public static void main(String[] args) {
launchTester("EmployeeDetail.oracle.apps.fnd.EmployeeDetail.server", /* package name */
"EmployeeDetailAMLocal" /* Configuration Name */);
/**Container's getter for EmployeeDetailWIPVO1
public EmployeeDetailWIPVOImpl getEmployeeDetailWIPVO1() {
return (EmployeeDetailWIPVOImpl)findViewObject("EmployeeDetailWIPVO1");
public void task(String Name)
OADBTransaction txn=getOADBTransaction();
CallableStatement cst=null;
OAViewObject vo=(OAViewObject)getEmployeeDetailWIPVO1();
try{
String CallProc="begin emp_task(:1);commit; end;";
cst=txn.createCallableStatement(CallProc,0);
cst.setString(1,Name);
cst.execute();
cst.close();
catch (SQLException sqle) {
throw OAException.wrapperException(sqle);
public void initDetail(String Name)
OAViewObject vo=(OAViewObject)getEmployeeDetailWIPVO1();
vo.setWhereClause(null);
vo.setWhereClauseParams(null);
vo.setWhereClause("TASK_ID=:1");
vo.setWhereClauseParam(0,Name);
vo.executeQuery();
public void createtask()
OAViewObject vo=(OAViewObject)getEmployeeDetailWIPVO1();
if(!vo.isPreparedForExecution())
vo.executeQuery();
Row row=vo.createRow();
vo.insertRow(row);
row.setNewRowState(Row.STATUS_INITIALIZED);
public void rowadd() {
OAViewObject vo = (OAViewObject)getEmployeeDetailWIPVO1();
OADBTransaction txn = getOADBTransaction();
if (!vo.isPreparedForExecution()) {
vo.setWhereClause("1=0");
vo.executeQuery();
Row row = vo.last();
row = vo.createRow();
vo.setCurrentRow(row);
vo.insertRow(row);
row.setNewRowState(Row.STATUS_INITIALIZED);
public void commit()
OADBTransaction txn=(OADBTransaction)getTransaction();
txn.commit();
public void rollback()
OADBTransaction txn=(OADBTransaction)getTransaction();
txn.rollback();
this on COntroller
package EmployeeDetail.oracle.apps.fnd.EmployeeDetail.webui;
import java.io.Serializable;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.table.OATableBean;
* Controller for ...
public class EmpTaskDetailCO extends OAControllerImpl
public static final String RCS_ID="$Header$";
public static final boolean RCS_ID_RECORDED =
VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
* Layout and page setup logic for a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
OATableBean tableBean =
(OATableBean)webBean.findChildRecursive("EmployeeDetailWIPVO11");
if (tableBean != null)
tableBean.setInsertable(true);
tableBean.setAutoInsertion(false);
* Procedure to handle form submissions for form elements in
* a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModule am=pageContext.getApplicationModule(webBean);
String Name=pageContext.getParameter("SRNO");
Serializable[] Nam={Name};
am.invokeMethod("createtask");
am.invokeMethod("task",Nam);
am.invokeMethod("initDetail",Nam);
/**if(pageContext.getParameter("CreateRow")!=null)
am.invokeMethod("rowadd");
OATableBean tableBean = (OATableBean)webBean.findChildRecursive("EmployeeDetailWIPVO11");
if (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM)) &&
ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM))) {
am.invokeMethod("rowadd");
else if (pageContext.getParameter("Apply")!=null)
am.invokeMethod("commit");
else if (pageContext.getParameter("Cancel")!=null)
am.invokeMethod("rollback");
}

Hi ,
Modify the the methods as given below
public void rowadd() {
OAViewObject vo = (OAViewObject)getEmployeeDetailWIPVO1();
OADBTransaction txn = getOADBTransaction();
if (!vo.isPreparedForExecution()) {
vo.setWhereClause("1=0");
vo.executeQuery();
vo.next();
vo.last();row = vo.createRow();
vo.setCurrentRow(row);
vo.insertRow(row);
row.setNewRowState(Row.STATUS_INITIALIZED);
Thanks
Pratap

Similar Messages

  • How to add new rows in Advanced Table along with attribute value?

    Hi,
    I have one advanced table that contain one messageChoice and messageTextInput field.
    I want to add new rows in advanced table. I can able to add rows using the AddMoreRows button in the footer of the advanced table,
    but I want to add attribute value(contactId) each time when new row created.
    contactId I am getting from pageContext.getParameter("contactId")
    How to achive this? Please suggest.
    Thanks & Regards,
    Sunita

    Hi,
    There are two ways to do it.
    1. Use create method of entity object, create method fires whenever you creates new row.
    2. Handle the event raised by addanotherrow button and write logic there to initialize contactid as you are getting contactid from pageContext so I will suggest you to use this method.
    if (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM)))
    && ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
    //write your logic here to default the contact id
    Hope this will help.
    Regards,
    Reetesh Sharma

  • Add new row to a table

    Hello!
    I'm using JDev 11.2 and I'm trying to add a new row to a table object (using create insert)
    the catch is this-
    and the new empty row that will appear- I want a value set instead of one of the values- so the user can choose which value to insert
    do you know how can this be done?
    (just to be clear- i know how to add a value set, I know how to add new row- dont know how to make the new row contain value set field)
    tnx for your time
    Talya

    If you use a model driven list of value on the attribute in question this should work automatically.
    Have you setup a LOV on the attribute? Have you (on the attribute) checked that the ui-hint is set to selectOneChoice?
    Timo

  • How to add new row to adf table progrmatically

    Hi,
    I have a bean with a list and correspoding getter & setter methods inside it.
    I created a datacontrol out of the bean and I am displaying af:table in the ui
    binded to this list.
    Ex:
    public class StudentBean {
    private List<Student> students;
    // getter & setter methods.
    jsp
    <af:table value="#{bindings.students.collectionModel}" var="row"
    rows="#{bindings.students.rangeSize}"
    emptyText="#{bindings.students.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.students.rangeSize}"
    rowBandingInterval="0"/>
    How to add a new row programitically to this adf table.
    I dragged and dropped 'Create' from operations menu on to jsp.
    But on click of that.no new row is being added to the current table.
    On click of a button in u.i I want to add a new row to the table.
    Thanks,
    Praveen

    Hi,
    The source code is as below.
    <af:table value="#{bindings.students.collectionModel}" var="row"
    rows="#{bindings.students.rangeSize}"
    emptyText="#{bindings.students.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.students.rangeSize}"
    rowBandingInterval="0"
    filterModel="#{bindings.rscGroupsQuery.queryDescriptor}"
    queryListener="#{bindings.rscGroupsQuery.processQuery}"
    filterVisible="true" varStatus="vs"
    selectedRowKeys="#{bindings.rscGroups.collectionModel.selectedRow}"
    selectionListener="#{bindings.rscGroups.collectionModel.makeCurrent}"
    rowSelection="single" id="t1"/>
    <af:commandButton actionListener="#{bindings.Create.execute}"
    text="Create" disabled="#{!bindings.Create.enabled}"
    id="cb1" partialTriggers="t1"/>
    Please let me know where am I doing wrong?
    On click of this button,it is not adding a row dynamically.
    Thanks,
    Praveen

  • How to ADD new Row In ADF Table?

    Hello!
    I need to insert a row in table when clicking on the "New", can someone help me? Citing some examples? I'm lost.
    My table is called tableArchive, and I need to add a line on it.
    This table is a list called listArchive, which is associated to this table.

    On the button drag drop createInsert operation from DataContol .
    go to data control->open your table VO-> open operatin inside that.-> drag drop the createInsert.Put id of button into partial trigger of table.make button autosubmit to true.
    see this
    Creating a New Row Using an ADF Iterator Binding
    Unwinding ADF: How to add a new row at the end of the ADF Table

  • Add new row to a table bound to ArrayList in backing bean

    Hi,
    I have a Arralist<CustomObject> in the backing bean.
    I want to create a table with Add/Delete new row buttons which will add/delete objects from the ArrayList.
    I am using Jdev 11g and I am not using ADF BC.
    Please give me some heads up or links.
    Thanks

    Then that's your problem, change the class to something like:
    public class TableHandlerConsumer
        private static final String LIST_PAGE_FLOW_ATTR = "consumers:" + TableHandlerConsumer.class.getName();
        public TableHandlerConsumer()
            Collection data = new ArrayList<Consumer>();
            buildModel(data);
            tableModel = new SortableModel(data);
            Map<String, Object> pageFlowScope = RequestContext.getCurrentInstance().getPageFlowScope();
            pageFlowScope.put(LIST_PAGE_FLOW_ATTR, tableModel);
        private void buildModel(Collection data)
            baris.add(new Consumer("", "", "", "", ""));
            baris.add(new Consumer("", "", "", "", ""));
            baris.add(new Consumer("", "", "", "", ""));
        public void addRow()
            Consumer consumer = new Consumer();
            ((Collection)tableModel.getWrappedData()).add(Consumer);
        public SortableModel getTableModel()
            Map<String, Object> pageFlowScope = RequestContext.getCurrentInstance().getPageFlowScope();
            return (SortableModel)pageFlowScope.get(LIST_PAGE_FLOW_ATTR);
    }Note that if you're using 10g then change Requestcontext to AdfFacesContext and getPageFlowScope to getProcessScope
    Regards,
    ~ Simon

  • Add New Row to bc4j:table

    Hi,
    I use BC4J with UIX to render database table into <bc4j:table> , and i prefer to edit and add record from UIX table without going to any other page.
    So please can any budy help me.
    Thanks.

    Sorry for the delay, I had to read up on this a little bit, as making an editable table using the BC4J/UIX extension is not supported using declarative event handlers but can be done with some good old fashioned Java code. Here is the scoop:
    You use a messageInput (messageTextInput, messageChoice, etc) as the UINode for the column/columns that you want to make editable.
    On the event handling side, you will need to write Java code which iterates over the submitted data and applies the updates to the database.
    You can use the following structure:
    <event name="saveTable" >
    <bc4j:findRootAppModule ... >
    <bc4j:findViewObject ... >
    <method class="..." method="..." />
    <bc4j:commit/>
    </bc4j:findViewObject>
    </bc4j:findRootAppModule>
    </event>
    Then in your custom method event handler, you can
    get a handle to the currently scoped ViewObject
    with ServletBindingUtils.getViewObject(...).
    Once you have the ViewObject, you can iterate over
    the submitted parameters from the table using the
    PageEventFlattenedDataSet class.

  • How to add new row at the top of the advance table.

    Hi,
    I have one advanced table.
    I want to add new rows in advanced table. I can able to add rows using the AddMoreRows button in the footer of the advanced table.
    This adds the row at the end. But I want to add the row at the top.
    How to achive this? Please suggest.
    Thanks & Regards,
    Raja

    Hi,
    Yes you can do it...
    Just set the add Rows automatically property to False of Add Row Button
    and then in processForm Request capture the addRows event
    and invoke a method in AM and then create a new Row in VO.
    Use this code...it will insert row at the top...
    if("addRows".equals(event))
    am.invokeMethod("addrows");
    public void addrows()
    AddressesVOImpl vo1 = getAddressesVO1();
    AddressesVORowImpl row1 = (AddressesVORowImpl)vo1.createRow();
    vo1.insertRowAtRangeIndex(0,row1);
    vo1.setCurrentRow(row1);
    Thanks,
    Gaurav

  • Adding new row in a table

    hi experts ,
    i am working on a table and on an action of button i need to add a row. The table has a lots of elements like input fields, dropdown by key, textviews etc. i have created a new row by incresing visible row count on action but the above mentioned elements are not editable . The cardinality of the node bound to table is 1..n and selection is 1....n.
    Please suggest me a proper solution.
    Thank you.

    Hi,
    Try this code,
    IPrivatePopUpMenuView.IProductsElement ele=wdContext.createProductsElement();
                   ele.setProductId(str1);
              ele.setQuantity(str2);
              ele.setPrice(str3);
              ele.setName(str4);     
              ele.setDetails("Detailed discription for  "+str4);
              wdContext.nodeProducts().addElement(ele);
    Here str1 str2 are all the value which unwant to add to table.
    Regards,
    H.V.Swathi

  • Best method to add new rows

    Hi,
    I am new to apex and would like your suggestions as to the best method to add new row to a table. I do not want to use the wizard because there are many tables in the db. From reviewing this forum, the suggested method is to create the report with a form, the user clicks the 'create' button and it opens up to a new form for data entry. There is a 'submit' button to commit the changes to the table. When/How do I create the PK? Is it at the page render when the new form is opened or in page process when all the fields are committed? I tried to add the 'insert into table..' in the page render to create the new PK but I received oracle error. Am I missing a step? Thanks very much.
    Judy

    Good Morning,
    I have a second question to ask about Inserting rows..I was successful with the sql statement in adding a row to the parent table. Now I need to insert a row in the related child table. There are approx 5 child tables where I need to be able to add rows.
    My questions as to the proper sequence to do this:
    1. do I execute the Insert for the parent table first?
    2. then have the user click the button to add info for the child table and then click another button that does the insert into the child table? At this point, is this where I reference the parent table(fac_seq.currval)?
    INSERT INTO CONTACT(cnt_pk, fullname, street1, city, state, zip, phone, title)
    VALUES (CNT_SEQ.nextval,FAC_SEQ.currval,
    NVL(:P36_FULLNAME, 'No Data'),
    NVL(:P36_STREET1,'No Data'),
    NVL(:P36_CITY, 'No Data'),
    NVL(:P36_STATE,'CA'),
    NVL(:P36_ZIP,'00000'),
    NVL(:P36_PHONE,'555-1212'),
    NVL(:P36_TITLE,'No Data'));
    3. is it proper procedure to have separate insert statements or is it better to have 2 insert statements?
    INSERT INTO FACILITY(fac_pk, fac_type, fac_name, street1, city, state, zip, state_or_tribe, tribe_yn)
    VALUES (FAC_SEQ.nextval,
    NVL(:P211_FAC_TYPE, 'N'),
    NVL(:P211_FAC_NAME,'No Data'),
    NVL(:P211_STREET1,'No Data'),
    NVL(:P211_CITY, 'No Data'),
    NVL(:P211_STATE,'CA'),
    NVL(:P211_ZIP,'00000'),
    NVL(:P211_STATE_OR_TRIBE,'CA'),
    NVL(:P211_TRIBE_YN,'N'));
    INSERT INTO WELL(wel_pk, fac_fk, cnt_fk, geo_fk, well_state_uk, name,site, high_priority_yn,aqui_exempt_yn, well_in_swa)
    VALUES (WEL_SEQ.nextval, FAC_SEQ.currval, CNT_SEQ.currval, GEO_SEQ.currval,
    NVL(:P47_WELL_STATE_UK, '09DI'),
    NVL(:P47_NAME, 'No Data'),
    NVL(:P47_SITE,'No Data'),
    NVL(:P47_HIGH_PRIORITY_YN, 'N'),
    NVL(:P47_AQUI_EXEMPT_YN, 'N'),
    NVL(:P47_WELL_IN_SWA,'U'));
    **I am confused as to how to approach the process of adding rows to a child table. Please clarify for me or direct me to a link that has detailed documentation.
    Many thanks,
    Judy

  • Create a new row in a table without using add new row button

    I want to add a new row to the table without using the add new row button of the table. I'm not able to display default row in the table. Though if click on apply the record appears after saving in the database. Any thoughts how to implement this functionality.

    Here is what you have to do.
    1) You have to handle this in processRequest()
    2) In the AM code , u need to check if there is already a row exisit or vo is blank
    if (vo.getFetchedRowCount() == 0)
    // first time
    vo.setMaxFetchSize(0); // THIS IS REQUIRED.
    Row row = vo.createRow();
    vo.insertRow(row);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    else
    //If already rows are there then you suppose to insert in the end
    // i assume you would have execute your vo
    YourVORowImpl row= (YourVORowImpl)vo.getRowAtRangeIndex(0);
    vo2.insertRowAtRangeIndex();
    It should work.

  • How can I Add and save new row in data table?

    Hello All,
    I want to add new row in the jsf page with data and save it.
    I have data table with rows from database..
      <h:form id="test">
            <h:dataTable id="hh" value="#{MyBean.dataList}" var="list">
              <h:column>
              <h:outputText value="#{list.name}"/>          
              </h:column>         
              <h:column>
              <h:outputText value="#{list.lastName}"/>          
              </h:column>         
              <h:column>
              <h:outputText value="#{list.phone}"/>          
              </h:column>         
            </h:dataTable>
            <h:commandButton id="sd" action="#{MyBean.addNewRow" value="Add Row" />
            <h:commandButton id="save" action="#{MyBean.updateList" value="Save Data />
          </h:form>
    {code}
    i understand action with save to database, but still I could not find right way to add new row from jsf page.....
    I want add new row, add new name, lastname, and save it....
    Edited by: armen on Feb 20, 2009 12:39 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Thanks, but your example consist from too many parts and I could not join all components for understatnding all proccess.

  • Add new Row at the bottom of the advance table

    Hi,
    I have an advance table which is displaying 50 rows per page. I have a button at the bottom of the table to add a new row in the table.
    Requirement is whenever user clicks on the button to add a new row and if he is viewing the 50-100 rows, new row should be added at the bottom of the same page giving 101st row as new row.
    Is this functionality possible. Please let me know the code for the same.
    Thanks in advance,
    Kaushik

    Hi,
    If the records displayed is set to 50 then at one time only 50 records will be visible.
    101st row will be inserted at seperate navigation 100-150.
    Instead you can insert the row at the top so that 100th row gets shifted to 101 and new row becomes on the same page
    for this use
    vo.insertRowatRangeIndex(row,0);
    Thanks,
    Gaurav

  • Task to add new row and values to Table?

    Hi, I am new to SSIS, I have a table that I would like to capture daily currency conversion rates. In my Control Flow
    pane, I've been able to use a web service task to get a string value of the conversion rate pass it to an XML task, and connect it to at Data Flow Task. So now I'm not sure what to do from here. I would like to input the daily values into my table:
    [CurrencyID] [int] IDENTITY(1,1) NOT NULL,
    [CurrXDate] [datetime] NOT NULL,
    [Country] [nvarchar](50) NOT NULL,
    [CurrXRate] [float] NOT NULL,
    insert into tbl_CurrXrates
    (CurrXDate, Country, CurrXRate)
    values
    (getdate(), 'USD', @[User::ConversionRate])
    What data tasks and order would I use to add a new row to my table which I think would be a simple insert statement. Hope my
    question makes sense.

    You can put into a package variable and use as part of the insert statement via a SSIS expression to drive a Execute SQL Command to insert it or
    Have the value off the webservice dumped to a XML file and then consume it with XML Source which will allow the values to be inserted into the table (e.g. OLEDB Destination)
    Arthur
    MyBlog
    Twitter

  • New Row in a Table View

    Hi,
    I need to add a new row to a table without using any NEW button. The first column in my table is a drop down . Whenever user selects a value in drop down a new row should be created .
    Also am not able to see drop down options throughout my tableview , Only for created rows am able to see drop downs. How do i activate that ?
    Plz help me....
    Regards,
    Divya

    HI
    GOOD
    go through this link,hope this ll help you to solve your problem
    http://help.sap.com/saphelp_nw2004s/helpdata/en/28/4bae407e69bc4ee10000000a1550b0/content.htm
    thanks
    mrutyun^

Maybe you are looking for