Thursday, August 29, 2019

OADBTransaction in OAF

OADBTransaction in oaf is used to perform data base operations in the OAF page. 

If we want to execute SQL statements in the OAF page controller then we should create the handle of OADBTransaction and with this handle we can able to execute the sql statement in the OAF page. 

In the similar way , if we want to execute the PLSQL block or database procedures or function in the OAF page then we still need to use this OADBTransaction object of OA framework. 

Here below we will explain full What is OADBTransaction in oaf and we uses in OAF Controllers.


TO used OADBTransaction we first need to import its class in the oaf page controller to used in the   controller class file.
here below is the import class of OADBTransaction.        
import oracle.apps.fnd.framework.server.OADBTransaction;


Example : To set Paygelayout region window title and title dynamically based on Lookup

Write below code in AM.

    public String getWindowTitle(String pFunctionId) 
    {
        String fname=null;
        OADBTransaction dbtxn=getOADBTransaction();
        dbtxn.writeDiagnostics(this,"We are in getWindowTitle Class",6);
        try
        {
        DBTransaction dbtransaction=getDBTransaction();
        String sql="select description FunctionName from fnd_lookup_values_vl fl where lookup_type ='XX_CMN_FILE_UPLOAD' AND fl.enabled_flag = 'Y' AND TRUNC(SYSDATE) BETWEEN NVL (fl.start_date_active,SYSDATE - 1) AND NVL (fl.end_date_active,SYSDATE + 1) and Attribute_category = 'XX_CMN_FILE_UPLOAD' and lookup_code ='" + 
                pFunctionId + "'";
            java.sql.PreparedStatement sqlpStmt = 
                          dbtransaction.createPreparedStatement(sql, 1);
            ResultSet rs = sqlpStmt.executeQuery();
            if (rs != null) 
            {
                 while (rs.next()) 
                 {
                 fname = new String(rs.getString("FunctionName"));
                 }
            }
        }
        catch (Exception ex) 
        {
            ex.printStackTrace();
        }
        return fname;
    }


Write Below code in CO

  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
    RCommonUploadAMImpl am=(RCommonUploadAMImpl)pageContext.getApplicationModule(webBean);
    OAPageLayoutBean mainrn=pageContext.getPageLayoutBean();
    String windTitle=am.getWindowTitle("D2D_CNV_011_GBL");
    mainrn.setWindowTitle(windTitle);
    mainrn.setTitle(windTitle);
    

  }

No comments:

Post a Comment

AME (Approval Management Engine)

AME (Approval Management Engine) : AME Stands for Oracle Approval Management Engine. AME is a self service web application that enables...