Aug 21, 2019

Create VO Programmatically | Dynamic VO | OAF


ViewObject dynamicViewObject = appModule.findViewObject("XXDynamicVO"); 

 if(dynamicViewObject == null) 
 { 
  String voQuery = " SELECT USER_NAME " + 
                                " FROM fnd_users FU " + 
                                " WHERE FU.user_id = :1 "; 
  customViewObject = appModule.createViewObjectFromQueryStmt("XXDynamicVO",voQuery); 
 } 

 if(customViewObject != null) 
 { 
  customViewObject.setWhereClause(null); 
  customViewObject.setWhereClauseParams(null); 
  customViewObject.setWhereClauseParam(0,userID); 
  customViewObject.executeQuery(); 
  Row customViewObjectRow = customViewObject.first(); 
  if(customViewObjectRow != null) 
  { 
       String userName = (String)customViewObjectRow.getAttribute(0); 
  } 
 }  

Aug 20, 2019

Call PL/SQL Procedure | From OAF Page



 import oracle.jdbc.OracleCallableStatement;  
 import oracle.jdbc.OracleTypes;
 import oracle.jbo.domain.Number;
 import oracle.jbo.domain.Date;
   
 public void callPLSQLProc(Number id,String code,Date currentDate)  
 {  
      OracleCallableStatement callableStatement = null;  
      try  
      {  
           String callProc = " BEGIN xxx_pkg.xxx_proc "+  
                                         "(p_id             => :1," +  
                                         " p_code           => :2," +
                                         " p_date           => :3," +
                                         " p_commit         => :4," +                                                  
                                         " x_return_status  => :5," +  
                                         " x_msg_data       => :6," +  
                                         " x_msg_count      => :7);"+  
                                    " END; ";  
           callableStatement = (OracleCallableStatement)getOADBTransaction().createCallableStatement(callProc,1);  
           callableStatement.setNUMBER(1, id);  
           callableStatement.setString(2, code);          
           callableStatement.setDATE(3, currentDate);    
           callableStatement.setString(4, "Y");     
           callableStatement.registerOutParameter(5,OracleTypes.VARCHAR,255);  
           callableStatement.registerOutParameter(6,OracleTypes.VARCHAR,255);  
           callableStatement.registerOutParameter(7,OracleTypes.NUMBER,255);    
           callableStatement.execute();  
           String resultMessage = (String)callableStatement.getString(5);  
           String msgData  = (String)callableStatement.getString(6);  
      }  
      catch(Exception e)  
      {  
           e.printStackTrace();  
           throw new OAException(e.toString(),OAException.ERROR);  
      }  
      finally  
      {  
           try  
           {  
                callableStatement.close();  
           }  
           catch(Exception exception2)  
           {  
                throw OAException.wrapperException(exception2);  
           }  
      }  
 }        

:1,:2,:3 & :4 è IN Parameter   
:5,:6,:7 è Out Parameter

Call PL/SQL Function | From OAF Page



 import oracle.apps.fnd.framework.server.OADBTransaction; 
 import oracle.jdbc.driver.OracleTypes; 
 import oracle.jdbc.OracleCallableStatement;
 
 public String callFunction( String id) 
 { 
      String status = null;
      OADBTransaction oadbtransaction = getOADBTransaction(); 
      OracleCallableStatement oraclecallablestatement = null; 
      Object obj = null; 
     
      String sqlString = "BEGIN :1:=xx_pkg.xx_func( p_id => :2 ); END;"; 
      
      try 
      { 
           oraclecallablestatement =             (oracleCallableStatement)oadbtransaction.createCallableStatement(sqlString , 1); 
           oraclecallablestatement.registerOutParameter(1, OracleTypes.VARCHAR, 0, 10); 
           oraclecallablestatement.setString(2, id); 
           oraclecallablestatement.executeQuery(); 
           status = String.valueOf(oraclecallablestatement.getString(1)); 
      } 
      catch(Exception exception1) 
      { 
           throw OAException.wrapperException(exception1); 
      } 
      finally 
      { 
           try 
           { 
                oraclecallablestatement.close(); 
           } 
           catch(Exception exception2) 
           { 
                throw OAException.wrapperException(exception2); 
           } 
      } 
      return status ; 
 }  

:1 è Out Parameter to hold results from function.

:2 è IN Parameter   
 




Transient Attributes not getting populated | VO Extension




Scenario:

Standard VO has some transient attributes which gets populated by overriding the getter methods in the VORowmpl. When we extend this VO for adding some additional attributes, everything works except the original transient attributes. Those attributes are coming as null.

The reason is, when the extended VORowImpl is getting generated by the Jdeveloper, it will not call the super method (which is already overridden). So you need to modify the getter method of the Transient attribute in the extended VO to call the getter method in the Standard VO using super.


Standard VORowImpl getter method will be something as shown below.

                                public String getAttribute1() { 
                                                                return "Calculated Value"; 
 }  


Generated getter method in the extended VORowImpl  as shown below.

                                public String getAttribute1() { 
  return (String) getAttributeInternal("Attribute1"); 
 }  
Solution:

To fix this, modify the getter method of the extended VORowImpl as shown below.

                                public String getAttribute1() {  
  //return (String) getAttributeInternal("Attribute1"); 
  return super.getAttribute1();
 }

Populate LOV | Tab Out in OAF




Expectation :

Type search words in LOV Field & TAB out, it should populate the values as per search.

Issue : 

In LOV field, No response occurs when we type something & then click on TAB key.

Solution :

                Set disable validation Property to False for LOV.

Display Current Date | OAF Page

        To Create an Date Bean programmatically

        OAMessageDateFieldBean currentdate =  (OAMessageDateFieldBean)createWebBean(pageContext,
                                                                                      OAWebBeanConstants.MESSAGE_DATE_FIELD_BEAN,
                                                                                       null,
                                                                                           "datefield");
                                                                                           currentdate.setReadOnly(true);

        pageLayoutBean.addIndexedChild(currentdate);


               
         To Initialize Date
               
   OAApplicationModule am = pageContext.getApplicationModule(webBean);--Initialize/Invoke AM
   SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");   -- Formatting
   String dateString = am.getOADBTransaction().getCurrentDBDate().toString();--Get DB Date from AM


   java.sql.Date sqlDate = null;

        Parsing Date Format 

        try {
            sqlDate = new Date(f.parse(dateString).getTime());
            System.out.println("What is sqlDate value ********** " + sqlDate);
         }
        catch (ParseException e) {
            e.getMessage();
        }

        OAMessageDateFieldBean dateField =
            (OAMessageDateFieldBean)webBean.findIndexedChildRecursive("datefield");
       
        To set current Date in Bean

        if (dateField != null) {
            dateField.setValue(pageContext, sqlDate);
            System.out.println("I am checking dateField  not null ********* " + dateField );
        }


Oracle Applications Concurrent Request phase codes and status codes


Table Name: FND_CONCURRENT_REQUESTS
Column Name: PHASE_CODE
 
Value Meaning
 C Completed
 I Inactive
 P Pending
 R Running
 
Table Name: FND_CONCURRENT_REQUESTS
Column Name: STATUS_CODE
 
Value Meaning
 D Cancelled
 U Disabled
 E Error
 M No Manager
 R Normal
 I Normal
 C Normal
 H On Hold
 W Paused
 B Resuming
 P Scheduled
 Q Standby
 S Suspended
 X Terminated
 T Terminating
 A Waiting
 Z Waiting
 G Warning

Useful Workflow Commands

  WFLOAD apps/columbus789 0 Y DOWNLOAD APEXP_FINDEV.wft APEXP Locations: $PO_TOP/patch/115/import/US/porpocha.wft $PO_TOP/patch/115/import/U...