Programmatically inserting row in ViewObject

I have created Entity Object based on table and updatable VO based on the Entity.
Now i need to add a new row in the table. I have a button Add new row , on button click a popup will open with the fields in the row.
Entering the field ,clicking on OK button on Popup should insert the value in the table.
How can i achieve this in Jdev11g?
Thanks in advance.

Drag the Create operation for your VO to the page as the first button.
Then use the same VO in the pop-up as a form where people insert the data.
http://andrejusb.blogspot.com/2010/05/crud-operations-in-oracle-adf-11g-table.html

Similar Messages

  • Programmatically Inserting Row in a 1-1 Master Detail

    JDeveloper 11.1.1.2.0
    In a 1-1 relationship, your accessor will be returning a ROW instead of a ROWITERATOR/ROWSET.
    This means that you first need to create a row to even set the row rather than getting the rowset and inserting directly. I'm looking for the best way to insert a row in both the master and detail programmatically.
    So far what i've done so far are:
    1. Inside VO i have a method that i expose that creates master row then creates detail row using their entity definition:
    <masterName>EntityImpl masterRow = <masterName>EntityImpl.getDefinitionObject().createInstance2(this.getDBTransaction(), null);
    <detailName>EntityImpl detailRow = <detailName>EntityImpl.getDefinitionObject().createInstance2(this.getDBTransaction(), null);
    detailRow.setAttribute("masterId",masterRow.getAttribute("masterId));
    2. Create in ApplicationModule by getting VO's and utilizing create and insert VO methods.
    I'm wondering if there is a different approach in doing this. Take note that this is a 1-1 relationship.

    Drag the Create operation for your VO to the page as the first button.
    Then use the same VO in the pop-up as a form where people insert the data.
    http://andrejusb.blogspot.com/2010/05/crud-operations-in-oracle-adf-11g-table.html

  • Programming insert row VO,but inner-table no data show?

    We have Master-Detail-Detail ViewObject,when programming insert row three ViewObject,why inner-table UI no data show?
    [Source Code ZIP files|http://docs.google.com/leaf?id=0B1l5uiKPTIr_ZTQwYTQ1MTMtZWFlMS00YWQ1LWFiZWQtYzNmODIwNDRlZWJk&hl=zh_TW]
    1.SmpTest0PG.xml click button.
    2.SmpTest0CO.java call MyTestAMImpl.java create Method insert row three ViewObject.
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("Test") != null)
    String key = "1";
    Serializable aserializable1[] = { key };
    String quote_id = (String)am.invokeMethod("create", aserializable1);
    if (!quote_id.equals(null))
    pageContext.setForwardURL("OA.jsp?page=/smp/oracle/apps/pos/test/webui/SmpTestPG&Key="+key,
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    null,
    true, // Retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
    OAWebBeanConstants.IGNORE_MESSAGES);
    3.SmpTest0CO.java Forward SmpTestPG.xml.
    4.SmpTestPG.xml Show Data.
    MyTestAMImpl.java
    public String create(String key)
    int vendor_id = 0;
    String vendor_name = null;
    int contact_id = 0;
    int site_id = 0;
    String quote_id = null;
    OADBTransaction trx = (OADBTransaction)((OAApplicationModuleImpl)this).getDBTransaction();
    SmpPoHdVOImpl hdvo = getSmpPoHdVO();
    SmpPoDlVOImpl dlvo = getSmpPoDlVO();
    SmpPoDkVOImpl shvo = getSmpPoDkVO();
    if (!hdvo.isPreparedForExecution())
    hdvo.setWhereClause("1 = 0");
    hdvo.setMaxFetchSize(0);
    hdvo.executeQuery();
    if (!dlvo.isPreparedForExecution())
    dlvo.setWhereClause("1 = 0");
    dlvo.setMaxFetchSize(0);
    dlvo.executeQuery();
    if (!shvo.isPreparedForExecution())
    shvo.setWhereClause("1 = 0");
    shvo.setMaxFetchSize(0);
    shvo.executeQuery();
    String s = key;
    Serializable aserializable[] = { s };
    SmpViewPoHdVOImpl quhdvo = getSmpViewPoHdVO();
    if(quhdvo != null)
    quhdvo.invokeMethod("initQuery", aserializable);
    SmpViewPoDlVOImpl qudlvo = getSmpViewPoDlVO();
    // insert hd
    quhdvo.setRangeSize(-1);
    Row quhdrow[] = quhdvo.getAllRowsInRange();
    for(int i = 0; quhdrow != null && i < quhdrow.length; i++)
    Row hdrow = hdvo.createRow();
    hdrow.setAttribute("DocNum","200");
    hdvo.insertRow(hdrow);
    hdrow.setNewRowState(Row.STATUS_NEW);
    quote_id = hdrow.getAttribute("HEADER_ID").toString();
    // insert dl
    RowIterator dlIter = (RowIterator)quhdrow.getAttribute("SmpViewPoDlVO");
    dlIter.setRangeSize(-1);
    Row qudlrow[] = dlIter.getAllRowsInRange();
    int line_seq = 0;
    for(int j = 0; qudlrow != null && j < qudlrow.length; j++)
    Row dlrow = dlvo.createRow();
    line_seq ++;
    dlrow.setAttribute("LineNum",String.valueOf(line_seq));
    dlrow.setAttribute("ItemNo",qudlrow[j].getAttribute("ItemNo"));
    dlrow.setAttribute("Qty",qudlrow[j].getAttribute("Qty"));
    dlvo.insertRow(dlrow);
    dlrow.setNewRowState(Row.STATUS_NEW);
    // insert shipment
    RowIterator shipIter = (RowIterator)qudlrow[j].getAttribute("SmpViewPoDkVO");
    shipIter.setRangeSize(-1);
    Row shipRow[] = shipIter.getAllRowsInRange();
    int ship_seq = 0;
    for(int k = 0; shipRow != null && k < shipRow.length; k++)
    ship_seq ++;
    Row shrow = shvo.createRow();
    shrow.setAttribute("ShipmentNum",String.valueOf(ship_seq));
    shrow.setAttribute("Qty",shipRow[k].getAttribute("Qty"));
    shvo.insertRow(shrow);
    shrow.setNewRowState(Row.STATUS_NEW);
    return quote_id;
    Edited by: Tony_Huang on Apr 10, 2010 3:59 PM

    public class SmpTestCO extends OAControllerImpl
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OATableBean oatablebean = (OATableBean)webBean.findChildRecursive("SmpPoDlVORN");
    OATableBean oatablebean1 = (OATableBean)webBean.findChildRecursive("SmpPoDkVORN");
    if (oatablebean != null)
    oatablebean.setAttributeValue(UIConstants.ALL_DETAILS_ENABLED_ATTR, ((Object) (Boolean.TRUE)));
    oatablebean.setAttributeValue(OAWebBeanConstants.VIEW_LINK_NAME, "SmpPoDlDkVL1");
    if (oatablebean1 != null)
    oatablebean1.setAttributeValue(OAWebBeanConstants.VIEW_LINK_NAME, "SmpPoDlDkVL1");
    oatablebean1.setInsertable(true);
    oatablebean1.setAutoInsertion(true);
    }

  • Transient VO insert error-Attempting to insert row with no matching EO base

    Hi ,
    I have a transient Vo (created using option - rows populated programmatically, not based on Query) and I need to uptade/insert rows in vo on click of a button.
    when i nsert row, i get following error
    oracle.jbo.InvalidOperException: JBO-26020: Attempting to insert row with no matching EO base
    This is what I am doing in my code
    ViewObject vo2 = am.findViewObject("TransientVO1");
    vo2.executeQuery();
    if (vo2 == null) {System.out.println("vo2 is null");}
    if (vo2 != null)
    System.out.println("in vo2 != null");
    Row row2 = vo2.createRow();
    row2.setAttribute("PlatformName", "ss");
    row2.setAttribute("UserName", "ss");
    vo.insertRow(row2);
    System.out.println(" vo2.getRowCount()"+ vo2.getRowCount());
    Why is it saying no EO base... is it mandatory to have EO for transient VO? Please help.
    Thanks

    The EO handles all DML, hence you need it if you have to set attributes in a VO. An EO handles the storage of a the single row (or part if your VO consists of multiple tables).
    You can try and overwrite the setter method of the attributes in ViewRowImpl class and store the changes somewhere else.
    Timo

  • Get JBO-27023 exception when programmatically inserting in view object

    I am using Jdev 11 R2 (11.1.2.3.0) JSF2 & Facelet
    In some use case I require to read information from some external source (a web service in this case)
    and Programmatically insert into Oracle DB
    I use below code to get view object from application module
    //from ADFUtils
         public static ApplicationModule getApplicationModuleForDataControl(String name) {
    return (ApplicationModule)JSFUtils.resolveExpression("#{data." + name + ".dataProvider}");
         public static ViewObject getViewObject(String appModCtrlNam, String viewObjCtrlNam) {
    ApplicationModule am = getApplicationModuleForDataControl(appModCtrlNam);
    return am.findViewObject(viewObjCtrlNam);
         ViewObjectImpl testVW =
    (ViewObjectImpl)ADFUtils.getViewObject("AppModuleDataControl", "View1");
    Row testRow = testVW.createRow();
         testRow.setAttribute("property1",value1);
         testRow.setAttribute("property2",value1);
         testRow.setAttribute("property3",value1);
         testRow.setAttribute("property4",value1);
         testVW.insertRow(testRow);
         and finally commit bounded task flow
         TaskFlowUtils taskFlowUtils = new TaskFlowUtils();
    taskFlowUtils.commitTaskFlow();
         public void commitTaskFlow() {
    getDataControlFrame().commit();
    public DataControlFrame getDataControlFrame() {
    BindingContext bindingContext = oracle.adf.controller.binding.BindingUtils.getBindingContext();
    String dataControlFrameName = bindingContext.getCurrentDataControlFrame();
    DataControlFrame dataControlFrame = bindingContext.findDataControlFrame(dataControlFrameName);
    return dataControlFrame;
         There are some inner objects so I need to repeat this logic for some other view objects (don't put it here to make post shorter)
         Every thing is OK but when number of record I read from that external source increased I will receive
         JBO-27023: Failed to validate all rows in a transaction.
         And system can not commit transaction
         What I mean about the increase in number of records is totaly 50 records not 10000 records
         I mean if I run my method with 3-5 records it is working fine , if I run it with 50 records I will receive JBO-27023
         I am using a method in application module to get sequence from DB and transaction in bounded task flow defined as "Always Begin New Transaction"
         Any idea where is wrong or what is work around?
         Thanks
         Mohsen

    Hi Frank
    I saw that blog from Jobinesh as he mentioned
    public String someAction() {
    BindingContainer bindings = getBindings();
    OperationBinding ob = bindings.getOperationBinding("doSomething");
    Object result = ob.execute();
    if (!ob.getErrors().isEmpty()) {
    return "error";
    return "success";
    But in my use case I need to insert into view objects programmatically not executing a method in app module
    What is they best way of doing this?Should I put this inserts as method in app module?
    and where I can find new version of ADFUtils?
    Appreciate your comments
    Regards
    Mohsen

  • Not able to insert row programticaly

    hi am trying to insert row to another viewObject from another viewobject programaticaly ,can somebody help me,i have recreate the problem i upload it in hostfile,am in jdeveloper 11.1.1.6.0
    am geting this log error
    Caused by: oracle.jbo.InvalidOwnerException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-25030. Error message parameters are {0=UamUserdetails, 1=oracle.jbo.Key[marksn ]}
         at oracle.jbo.server.EntityImpl.internalCreate(EntityImpl.java:1341)
         at oracle.jbo.server.EntityImpl.create(EntityImpl.java:1020)
         at oracle.jbo.server.EntityImpl.callCreate(EntityImpl.java:1197)
         at oracle.jbo.server.ViewRowStorage.create(ViewRowStorage.java:1152)
         at oracle.jbo.server.ViewRowImpl.create(ViewRowImpl.java:498)
         at oracle.jbo.server.ViewRowImpl.callCreate(ViewRowImpl.java:515)
         at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:5714)
         at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1993)
         at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2492)
         at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2533)
         at oracle.jbo.server.ViewRowSetImpl.createAndInitRow(ViewRowSetImpl.java:2498)
         at oracle.jbo.server.ViewObjectImpl.createAndInitRow(ViewObjectImpl.java:11042)
         at worklis.view.beantest.addnew(beantest.java:138)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1256)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
         at org.apache.myfaces.trinidad.component.UIXCollection.broadcast(UIXCollection.java:148)
         at org.apache.myfaces.trinidad.component.UIXTable.broadcast(UIXTable.java:279)
         at oracle.adf.view.rich.component.UIXTable.broadcast(UIXTable.java:145)
         at oracle.adf.view.rich.component.rich.data.RichTable.broadcast(RichTable.java:402)
         at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1018)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:386)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)Edited by: adf009 on 2013/02/15 4:43 PM
    Edited by: adf009 on 2013/02/15 4:57 PM
    Edited by: adf009 on 2013/02/15 7:22 PM

    the code am using is below
        public void addnew(ActionEvent actionEvent) {
            // Add event code here...
            // Add event code here...
            //Code to get the bindings for TargetVO :
            Map<Object,String> mp=new HashMap<Object, String>();
                    DCBindingContainer bindings2 =
                       (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
                   JUCtrlHierBinding obj = (JUCtrlHierBinding)bindings2.findCtrlBinding("UamUserdetailsView2");
                   ViewObject targetVO = obj.getViewObject();
              DCBindingContainer bindings =
                       (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding empIter =
                       bindings.findIteratorBinding("DeltTable1Iterator");
            //SourceVO1Iterator is the iterator under Executables section for the SourceVO1 bindings.
            RowSetIterator roleRSIters = empIter.getRowSetIterator();
            RowSetIterator rs1 = roleRSIters.getRowSet().getViewObject().createRowSetIterator(null);
            rs1.first();
                   NameValuePairs nvp = null;
                   String username = null;
            while (rs1.hasNext()) {
                               Row r = rs1.next();  
                       nvp = new NameValuePairs();
                      // nvp.setAttribute("organisationid", r.getAttribute("organisationid"));
                       nvp.setAttribute("Organisationid", getorgid());
                       System.out.println("printedorgid" +getorgid());
                       nvp.setAttribute("Username",r.getAttribute("Username"));
                       nvp.setAttribute("Username1",r.getAttribute("Username"));
                       nvp.setAttribute("Firstname",r.getAttribute("Firstname"));
                       nvp.setAttribute("Surname",r.getAttribute("Surname"));
                       nvp.setAttribute("Emailaddress",r.getAttribute("Emailaddress")); 
                       // username = (String)r.getAttribute("Username");
                       System.out.println("prininstead " + nvp);
                     //  targetVO.createAndInitRow(nvp);
                        r = targetVO.createAndInitRow(nvp);
                        targetVO.insertRow(r);
                        //createAndInitRow(AttributeList nvp);
            //Row row = targetVO.createAndInitRow(nvp);
              //      targetVO.insertRow(row);
                   rs1.closeRowSetIterator();
                   targetVO.getApplicationModule().getTransaction().commit();
        }i have re-created the problem i upload in this hostfile,you can have the whole picture of what am trying to do
    http://www.4shared.com/zip/RaZ07PWS/createRow.html
    Edited by: adf009 on 2013/02/15 7:36 PM
    Edited by: adf009 on 2013/02/15 7:38 PM
    Edited by: adf009 on 2013/02/15 8:01 PM

  • ADF UIX - programmatically deleting rows

    Hi gang
    I'm attempting to programmatically delete rows from an exposed VO client-method as follows:
    public void deleteRecord(String cesId) {
      ApplicationModule am = this.getApplicationModule();
      ViewObject voCes = am.findViewObject("ClinicalDataElementSetsView1");
      ViewObject voDcv = am.findViewObject("DacCesView1");
      Object [] keyValues = new Object[1];
      keyValues[0] = cesId;
      Row[] rowsCes = voCes.findByKey(new Key(keyValues), 1);
      Row deleteRowCes = rowsCes[0];
      voCes.setCurrentRow(deleteRowCes);
      voCes.removeCurrentRow();
      Row currentRowDcv = voDcv.getCurrentRow();
      voDcv.removeCurrentRow();  
      am.getTransaction().commit();
    }However when requerying the UIX screen that shows the relating data, the records are still there? What am I doing wrong? Should I be calling voCes.removeCurrentRowFromCollection() instead?
    Any help appreciated.
    Cheers,
    CM.
    PS. JDev 10.1.2

    I got around this by retreiving the DBTransaction and executing a SQL Delete statement on the data.

  • Access pre-insert data using ViewObjects

    Hi,
    I’m trying to access pre-insert data (before super.doCommit() execution) using viewobjects, but I only obtain committed data. Is it possible to obtain pre-insert data using viewobjects?
    Here the Java code:
    String amDef = "oracle.srdemo.model.AppModule";
    String config = "AppModuleLocal";
    ApplicationModule am =
    Configuration.createRootApplicationModule(amDef, config);
    ViewObject vo = am.findViewObject("DatetestView1");
    System.out.println("Query will return "+ vo.getEstimatedRowCount()+" rows...");
    vo.executeQuery();
    while (vo.hasNext()) {
    Row curPerson = vo.next();
    System.out.println(vo.getCurrentRowIndex()+". "+
    curPerson.getAttribute("Id")+" "+
    curPerson.getAttribute("Dataini"));
    Configuration.releaseRootApplicationModule(am, true);
    I'm using JDeveloper 11g, a Fusion Web Application and ADF Business Components
    Thanks in advance.

    Hi Timo,
    According to your instructions, I obtained current ApplicationModule and the issue was solved.
    Here the Java Code to get ApplicationModule from Iterator:
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding dciter = (DCIteratorBinding)bindings.get("DatetestView1Iterator");
    DCDataControl dc = dciter.getDataControl();
    ApplicationModule am = (ApplicationModule)dc.getDataProvider();
    AppModuleImpl am2 = (AppModuleImpl)am;
    ViewObject vo = (DatetestViewImpl)am2.findViewObject("DatetestView1");
    Thank you vey much,
    Olga

  • InsertRow does not show the inserted row on the view

    hello:
    The code below works well and shows the row on the view when added. However, when there are several existing rows and I have to scroll to next pages. an insert button on that page does not show the new Row at all. Is there a way for me to see the row even if I scroll over to the last page and try an insert?
    ViewObject myVO = this.getMyView();
    Row newRow = myVO.createRow();
    newRow.setAttribute("Id", myId);
    myO.insertRow(newRow);
    Thanks

    Hi,
    I also have problems with code above for inserting a new row.
    When I insert a new row in a table and click on column header (to change sorting), that row (and any other new row before committing) disappears from table. And if I commit that table (without missing row), the missing row reappears with next refresh.
    Selection in that table (using SelectOne component with Autosubmit=true) also doesn't work with new rows (with existing rows it works fine). Selection allways sticks on first inserted row!
    Something weird is happening here...
    Please help.

  • BC4J - how to remove invalid Row from ViewObject

    See the simplified code below. I want to insert a number of records in a table in one transaction. For every insert any occuring error is handled (stored) and after all inserts the errors are reported.
    private void insert(ViewObject vo, int id, String flag) {
    try {
    Row row = vo.createRow();
    row.setAttribute("Id", new Integer(id));
    row.setAttribute("Flag", flag);
    vo.insertRow(row);
    appMod.getTransaction().postChanges();
    catch (JboException exc) {
    handleError(exc);
    // appMod.getTransaction().rollback();
    So when inserting 3 records as below:
    insert(vo, 1, "A");
    insert(vo, 2 ,"BB");
    insert(vo, 3, "C");
    a "JBO-27010: Attribute set with value BB for Flag in Testtab has invalid precision/scale" exception will occur in the second record on the statement row.setAttribute("Flag", flag); as the Flag attribute is a varchar2(1). When the 3rd record gets inserted still an error occurs. It seems that the 2nd record is still cached somewhere; it's not been inserted into the ViewObject (from using the debugger I get the impression it's in the Entity object cache). BC4J tries to insert the 2nd row, that only has an Id attribute and no Flag attribute which is defined not null. So the 3rd record which is ok doesn't get inserted....
    How can I get rid of the second row ? Doing a rollback when an exception occurs doesn't work because then the first record which is ok is lost.
    Cheers Hans

    It turns out to be pretty simple - row.remove() does the trick.
    If only I'ld look in the right place first time everytime... :P

  • Database got halted while inserting rows

    I have a 9i database running on solaris not restarted for 15 days.It just got halted or hanged while inserting rows in a table.When restarted everything is just fine and those rows have been inserted in no time!!What might be the reason?Dont tell me 'lock' because I have already checked for ora:60 error in alertlog.Would you please give some direction to drill it down .

    Did you met the problem , only when you inserting the rows ? Or is there something else which leads this situation ? most of the occasion when
    you found your database halt is because of your archivelogs . I would
    still like to know if you running your db in archivelog mode ? It also be the
    case that you set archive_log_start = true in the pfile and diden't fire
    alter database archivelog at the sql prompt .
    Hare Krishna
    Alok

  • I am trying to insert rows for alert_id 22 with diff abc_id and xyz_id

    I am trying to insert rows for alert_id 22 with diff abc_id and xyz_id
    these inserts will store in two tables that I have to join in the cursor.
    I have written cursor without passing cursor parameters. but here i need to pass acb_id and xyz_id along with alert_id.
    then if these are saticified with alert_id 22 then I want to stop the loop run, else i need to continue the loop. bcause the abc_id and xyz_id are diff for alert_id 22
    This is the issue I am facing!
    Please let me know if you have any idea. Let me know how to use cursor parameters here and in loop.
    Sample proc like this::
    Declare
    main_cursor
    another_cur
    alert_cur
    begin
    need to check first abc_id,xyz_id is already exist with alert_id 22
    if this set of records already exists then
    exit from the loop
    else
    continue with
    loop
    here coming the insert statements with different condition getting from first two cursors.(this part is ok for me)
    end loop
    end if
    Please write the logic if any idea on this.
    -LRK

    I want to stop if already alert_id is exist!

  • How to Display a message after inserting row in table............

    Hi
    I want to display a message after inserting rows in table like *'you have inserted a new row successfully*'.
    i am using the createinsert ADF Button to insert the rows in table.after that i am comitting it.
    after commiting i want to display message for the user.for this what i need to do.
    Please help me.
    Sailaja.

    user10860137
    Can you please explain me the each line in the code briefly.
    +public String saveButton_action(){+
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("Commit");
    Object result = operationBinding.execute();
    +// note "!" operator has been removed from the default code.+
    +if(operationBinding.getErrors().isEmpty()){+
    FacesContext ctx = FacesContext.getCurrentInstance();
    FacesMessage saveMsg = new FacesMessage("Record Saved Successfully");
    ctx.addMessage(null,saveMsg);
    +}+
    return null;
    +}+
    And i have requirement to show the message on favcet "status bar".not in a popup window.(from the above code the message is showing in popup window. )the Layout i am using is PanelCollection.
    can you tell me what i need to do.
    Thanks
    Sailaja.
    Edited by: sj0609 on Mar 19, 2009 8:03 AM

  • Insert rows from l_qte_rec in to tmp table

    xxx_pre_update_userbook(p_service_request_id number, p_sr_type_id number, p_status_id number,
                             p_resolution_code varchar2, p_bill_to_customer_id number,
                        p_bill_to_cust_account_id number, p_bill_to_customer_site_id number,
                        p_contract_id number, p_contract_line_id number,
                        p_resolution_summary varchar2,
                             x_status out varchar2, x_mesg out varchar2) as
              l_proj_incident_type_id number;
              l_isr_incident_type_id number;
              l_tac_incident_type_id number;
              l_status varchar2(10) := 'S';
              l_sr_closing_flag number;
              l_mesg varchar2(3000) := null;
              err_mesg varchar2(3000) := null;
              L_SO_ID NUMBER;
              L_LINK_REC CS_INCIDENTLINKS_PUB.CS_INCIDENT_LINK_REC_TYPE;
              L_OBJECT_VERSION_NUMBER NUMBER;
              L_RECIPROCAL_LINK_ID NUMBER;
              L_LINK_ID NUMBER;
         l_QTE_REC ASO_QUOTE_PUB.qte_header_rec_type;          
         l_control_REC ASO_ORDER_INT.control_rec_type;          
              l_Order_Header_Rec ASO_ORDER_INT.Order_Header_Rec_Type;
              l_Order_Line_Tbl ASO_ORDER_INT.Order_Line_Tbl_type;
              l_Return_Status VARCHAR2(30);
              l_Msg_Count NUMBER;
              l_Msg_Data VARCHAR2(3000);
              l_Msg_INDEX_OUT NUMBER;
              l_OUT_MESSAGE VARCHAR2(3000);
              l_proj_flag number;
              l_quote_status_id number;
              l_orders_created number;
              l_chargeable_sr_flag number;
              l_sr_close_flag number;
              l_invalid_outage_info number;
         begin
              l_status := 'S';
              l_mesg := null;
              -- MO_GLOBAL.INIT('CS');
              -- Get the Project Service Request Id
              select incident_type_id into l_proj_incident_type_id
              from cs_incident_types_tl
              where name like 'XXX TAC Project'
    --           and language = 'US'
              and rownum < 2;
              -- Get the ISR Service Request Id
              select incident_type_id into l_isr_incident_type_id
              from cs_incident_types_tl
              where name like 'XXX TAC ISR'
    --           and language = 'US'
              and rownum < 2;
              -- Get the TNT TAC Service Request Id
              select incident_type_id into l_tac_incident_type_id
              from cs_incident_types_tl
              where name like 'XXX TAC Service Request'
              and rownum < 2;
    --           and language = 'US';
              select nvl((select 1
              from dual
              where exists( select incident_status_id
                        from cs_incident_statuses_b
                        where incident_status_id = p_status_id
                        and close_flag is not null
                        and close_flag = 'Y')
    and ( p_resolution_code is null
    or (p_resolution_code NOT IN ('CS_SR_CLOSED_AS_DUP', 'XXXXX_SR_CXL', 'XXXXX_SR_INFO', 'XXXXX_SR_MGMT')
         and p_sr_type_id in ( l_isr_incident_type_id )),0) into l_chargeable_sr_flag
         from dual;
              select nvl((select 1
              from dual
              where exists( select incident_status_id
                        from cs_incident_statuses_b
                        where incident_status_id = p_status_id
                        and close_flag is not null
                        and close_flag = 'Y')
    and ( p_resolution_code is null
    or (p_resolution_code NOT IN ('CS_SR_CLOSED_AS_DUP', 'XXXXX_SR_CXL', 'XXXXX_SR_INFO', 'XXXXX_SR_MGMT')
         ),0) into l_sr_closing_flag
         from dual;
         if ( l_sr_closing_flag = 1 and ((p_resolution_summary is null) or (p_resolution_summary = FND_API.G_MISS_CHAR)) ) then
                        x_status := 'F';
                        --x_mesg := 'Resolution Summary can not be empty while closing Service request';
                        fnd_message.set_name ('XXXXX', 'MISSING_RESOLUTION_SUMMARY');     
                        -- fnd_message.set_token ('MESG_PARAM', err_mesg || '::' || l_mesg);
                        fnd_msg_pub.ADD;     
         end if;
              -- Check whether outage information is complete at the time of closure.
         if ( l_sr_closing_flag = 1 ) then
              l_invalid_outage_info := 0;
         select nvl((select 1
    from dual
    where exists ( select 1
                                  from cs_incidents_ext cie, ego_fnd_dsc_flx_ctx_ext grp1
                                  where incident_id = p_service_request_id
                                  and grp1.application_id = 170
                                            and grp1.descriptive_flexfield_name like 'XX_SR_CONTEXT'
                                            and grp1.descriptive_flex_context_code like 'XXXXXOutageTab'
                                            and cie.attr_group_id = grp1.attr_group_id
                                            and ( c_ext_attr1 is null or c_ext_attr2 is null or c_ext_attr3 is null or
                                                 c_ext_attr4 is null or c_ext_attr5 is null or c_ext_attr6 is null or
                                                 c_ext_attr7 is null or n_ext_attr1 is null or n_ext_attr2 is null or
                                                 n_ext_attr3 is null or n_ext_attr4 is null or n_ext_attr5 is null or
                                                 d_ext_attr1 is null or d_ext_attr2 is null or d_ext_attr3 is null)
                             -- if all of them are null then we should ignore
                                            and NOT ( c_ext_attr1 is null and c_ext_attr2 is null and c_ext_attr3 is null and
                                                 c_ext_attr4 is null and c_ext_attr5 is null and c_ext_attr6 is null and
                                                 c_ext_attr7 is null and n_ext_attr1 is null and n_ext_attr2 is null and
                                                 n_ext_attr3 is null and n_ext_attr4 is null and n_ext_attr5 is null and
                                                 d_ext_attr1 is null and d_ext_attr2 is null and d_ext_attr3 is null))), 0) into l_invalid_outage_info
    from dual;
                        if ( l_invalid_outage_info = 1 )     then
                             x_status := 'F';
                             fnd_message.set_name ('XXXXX', 'MISSING_OUTAGE_INFORMATION');     
                             fnd_msg_pub.ADD;     
                        end if;
         end if;
              if ( (p_sr_type_id in ( l_isr_incident_type_id )) and (l_chargeable_sr_flag = 1) ) then
                   if ( ( p_bill_to_customer_id is null or     p_bill_to_cust_account_id is null or
                   p_bill_to_customer_site_id is null )) then
                        x_status := 'F';
                        --x_mesg := 'Bill to customer name/account/site is empty';
                        fnd_message.set_name ('XXXXX', 'ISR_INVALID_BILL_TO');     
                        -- fnd_message.set_token ('MESG_PARAM', err_mesg || '::' || l_mesg);
                        fnd_msg_pub.ADD;
                   else
                        select count(*) into l_orders_created
                        from cs_incident_links
                        where subject_id = p_service_request_id
                        and subject_type = 'SR'
                        and object_type = 'ORDERS';
                        /* If orders are not created for this SR then create the order */
                        if ( l_orders_created = 0 ) then
                        /* Create Order */
                        err_mesg := 'Got the Incident Types and Incidents Status flag';
                        select nvl((select quote_status_id
                        from aso_quote_statuses_tl
                        where language = 'US'
                        and upper(meaning) = 'ENTERED'), 0) into l_quote_Status_id
                        from dual;
                        err_mesg := 'Got the Quote Status Id';
                        l_qte_rec.party_id := p_bill_to_customer_id;
    *                    l_qte_rec.party_id := p_bill_to_customer_id;
    *                    l_qte_rec.cust_party_id := p_bill_to_customer_id;
    *                    l_qte_rec.cust_account_id := p_bill_to_cust_account_id;
    *                    l_qte_rec.INVOICE_TO_CUST_PARTY_ID  := p_bill_to_customer_id;
    *                    l_qte_rec.INVOICE_TO_CUST_ACCOUNT_ID  := p_bill_to_cust_account_id;
    *                    l_qte_rec.INVOICE_TO_PARTY_SITE_ID  := p_bill_to_customer_site_id;
    *                    l_qte_rec.INVOICE_TO_PARTY_ID := p_bill_to_customer_id;
    *                    l_qte_rec.quote_status_id := l_quote_status_id;
    *                    l_qte_rec.quote_status_code := 'ENTERED';
    *                    l_qte_rec.quote_status := 'ENTERED';
    *                    l_control_rec.book_flag := 'N';
    *                    err_mesg := 'set the Quote Header';*
    *                    select nvl((select transaction_type_id*
    *                    from oe_transaction_types_v*
    *                    where name like 'Service Order'), 0 ) into l_qte_rec.order_type_id*
    *                    from dual;*
    *                    err_mesg := 'Got Order Type';*
    *                    l_qte_rec.currency_code := 'USD';
    how to insert rows in tmp table from rec_type which is in bold text .... i want to insert after the last statement .this is for debugging after executing the procedure

    No version number and lots of other missing information.
    That said look at the example here:
    http://www.morganslibrary.org/reference/insert.html
    under "RECORD INSERT."

  • Error while inserting rows in a table

    Hi,
    We have recently migrated from 9i to 10g. We have a scheduled job out our DB which first deletes all the rows from a table and then inserts them back by selecting rows from 5 tables. This table has a composite primary key based on 6 columns in it. In 9i, when i try to insert rows into the table after deleting all the rows from it, I am able to insert the data successfully . However, in 10g, when i try doing the same operation, it fails with the ORA error:
    ORA-00001: unique constraint violated
    The same query which works perfectly in 9i fails in 10g
    If anybody has some ideas on how to resolve the same, kindly let me know.
    Thanks in advance.

    Hi,
    I was finally able to resolve the reason behind that error message and found it even more weird. The error was because I was using the substr function for extracting the characters 1-4 from a column which is 5 characters long. When i specify the query as:
    select substr(column1, 1, 4)) from table1;
    only the characters 1-3 are retrieved. Now if i change the query to select substr(column1, 1, 5)) from table1, in that case also only 3 characters are retrieved although i have specified the substr to start from 1 and read till 5 characters. Also, when i run the query:
    select length(substr(column1, 1, 4)) from table1 or select length(substr(column1, 1, 5)) from table1
    I get the answer as 3.
    However, the most amazing part is that the query is working perfectly in 9i and is retrieving the data correctly i.e. from substr 1-4.
    Can anyone suggest what the problem could be?
    Thanks
    Edited by: CrazyAnie on May 13, 2009 1:34 AM

Maybe you are looking for