Friday 12 January 2018

Trigger|Execute Custom Code Based on value Selected in LOV in Standard OAF Page.




Hi Friends , In this post i will share the Java code by which you can peorform or execute your custom functions in Standard OAF page based on the value Sected in Standard OAF LOV.


You have to perform Controller Extension in the standard OAF page to execute this code.

In this code i am selcting some value from Custom Table in Oracle apps and then Assiging this value as a Defualt value in the Standard OAF table VO.

You have to perfomr this code under Process Form Request.



    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    {

       super.processFormRequest(pageContext, webBean);


         OAApplicationModule am = pageContext.getApplicationModule(webBean);        

        String xxsno=null;
        String Attr10=null,Attr11=null;

        String outputString ="";       

        if(pageContext.isLovEvent()) 
        { 

             String lovInputSourceId = pageContext.getLovInputSourceId(); 

//SupplierNo is the LOV Input item

             if("SupplierNo".equals(lovInputSourceId))
             { 
                 // System.out.println("Inside isLovEvent of SupplierNo"); 

     
                  Hashtable lovResults = pageContext.getLovResultsFromSession(lovInputSourceId); 

                  if(lovResults!=null) 
                    { 
                       xxsno =(String)lovResults.get("SupplierNo"); // "SupplierNo" is the Return Item specified in the lovMap 
                          
                    }


                  if (xxsno!=null) 
                  {
                      String sql = "select Attribute5,Attribute6 from xx_external_supplier where Supplier_number="+ xxsno;

                      try {

                          Connection conn = (Connection)am.getOADBTransaction().getJdbcConnection();
                          PreparedStatement ps = conn.prepareStatement(sql);
                          ResultSet rs = ps.executeQuery(); // vo.createRowSetIterator(" ") ;
                          while(rs.next())             
                            {
                             Attr10 = rs.getString(1).trim();
                             Attr11= rs.getString(1).trim();                                  
                           
                             }
                            }


                       OAViewObject vo1 = (OAViewObject)am.findViewObject("SupplierHeadersVO");

                          if(vo1!=null)
                          {
                                            OAMessageTextInputBean viotype = (OAMessageTextInputBean)webBean.findChildRecursive("Attribute10");
                           viotype.setValue(pageContext, Attr10);               
                          OAMessageTextInputBean Tktno = (OAMessageTextInputBean)webBean.findChildRecursive("Attribute11");
                           Tktno.setValue(pageContext, Attr11);     
                            }

4 comments:

Anonymous said...

Nice blog, I really like what you write in this blog, I also have some relevant Information about Best HR Training In Hyderabad | Hr training institute in Hyderabad! if you want more information.
Oracle Fusion HCM Online Training

shaik shah said...

Good Blog thanks for sharing this informative article. It would be helpful for improving their knowledge.
Oracle Fusion HCM Online Training

yamuna said...
This comment has been removed by the author.
Rainbow Training Institute said...

Really very helpful article , Thank you for sharing

Big Data and Hadoop Online Training
Big Data Hadoop Training
Hyderabad

Post a Comment

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *