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 ="";       


             String lovInputSourceId = pageContext.getLovInputSourceId(); 

//SupplierNo is the LOV Input item

                 // System.out.println("Inside isLovEvent of SupplierNo"); 

                  Hashtable lovResults = pageContext.getLovResultsFromSession(lovInputSourceId); 

                       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(" ") ;
                             Attr10 = rs.getString(1).trim();
                             Attr11= rs.getString(1).trim();                                  

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

                                            OAMessageTextInputBean viotype = (OAMessageTextInputBean)webBean.findChildRecursive("Attribute10");
                           viotype.setValue(pageContext, Attr10);               
                          OAMessageTextInputBean Tktno = (OAMessageTextInputBean)webBean.findChildRecursive("Attribute11");
                           Tktno.setValue(pageContext, Attr11);     


Post a Comment