Monday, October 28, 2013

Invoking sequence in OAF Page


Invoking sequence in OAF Page



To invoke the sequence number in the OAF page then write the following code in the setter method of the required column in EOImpl.java file.




//For Copy Paste//

    public void create(AttributeList attributeList) {
        super.create(attributeList);
       
          OADBTransaction transaction = getOADBTransaction();
      // To get the employee id  through sequence
          Number employeeId = transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");
          setEmployeeId(employeeId);

         
// Start date should be set to sysdate
        setStartDate(transaction.getCurrentDBDate());
        // end create()
 }



OR
If you want to write in controller write the below code in processRequest of controller class.

          OADBTransaction transaction = (OADBTransaction)am.getOADBTransaction();
          Number seqvalue= transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");  
          System.out.println("seqvalue-->"+seqvalue);       
          OAMessageStyledTextBean mcb = (OAMessageStyledTextBean)webBean.findChildRecursive("EmpId");
          mcb.setValue(pageContext,seqvalue);

The Desired output shulde like.


6 comments:

  1. Hi,

    I tried the code in EOImpl.java
    But it is showing compilation error for “super.create(attributeList);”

    Error(315,13): method create(com.sun.org.apache.xalan.internal.xsltc.runtime.AttributeList) not found in class oracle.apps.fnd.framework.server.OAEntityImpl

    I have already imported
    import oracle.apps.fnd.framework.server.OADBTransaction;
    import oracle.jbo.AttributeList;

    Can you please help me in this?

    Thanks & Regards
    Ganesh

    ReplyDelete
  2. Hi Ganesh,

    While creating entity Object have you checked the create method.

    or
    use the below code in controller ProcessRequest.

    OADBTransaction transaction = (OADBTransaction)am.getOADBTransaction();
    Number seqvalue= transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");

    OAMessageStyledTextBean mcb = (OAMessageStyledTextBean)webBean.findChildRecursive("EmpId");
    mcb.setValue(pageContext,seqvalue);

    Regards,
    Sangu

    ReplyDelete
  3. I tried to write it is PFR. it says.key Attribute need values

    ReplyDelete
  4. Hi Mohanraj,

    You have to write in ProcessRequest not in ProcessFormRequest.

    Regards,
    Sangu

    ReplyDelete
  5. Hi,

    How can I avoid the missing sequences in the database, e.g if end user opens the forms and close, we need to miss one sequence. How to avoid that. Which is the best way to not to loose the missing sequence.Kindly advice.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete