Aug 28, 2019

Microsoft Visual Basic Run-time error '1004': Method 'VBProject' of object '_Workbook' failed

To fix this issue, pls perform the below setups in MICROSOFT EXCEL to accept the WEBADI transaction in VBProject Workbook.


In Excel, use the following navigation:

Step 1: Open the Microsoft Excel and go to FILE à OPTIONS



Step 2: On the left, click on the Trust Center



Step 3: Click on the Trust Center Settings button and go to Macro Settings and Click on “Trust access to the VBA project object model



Aug 21, 2019

Throw Bundled Exception | OAF Page



  ArrayList bundle=new ArrayList();     //first we have to initialize the Array List

             
  if(empname.contains("@"))
                {
                bundle.add(new OABundleeption("Special character not allowed",OABundleeption.ERROR));
                }
  if("".equalsIgnoreCase(pageContext.getParameter("StartDate").trim()))
                {
                bundle.add(new OABundleeption("Start date shold not be null",OABundleeption.ERROR));
                }
  if(!bundle.isEmpty())
                {
                OABundleeption.raiseBundledOABundleeption(bundle);
                }
                }

List all the Parameter names and values | OAF Page



import java.util.Enumeration; 

Enumeration enums = pageContext.getParameterNames(); 
 while(enums.hasMoreElements())
{ 
   String paramName = enums.nextElement().toString(); 
   System.out.println("Param name:-->" +paramName+ ";Value:-->"+pageContext.getParameter(paramName)); 
 }



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

Aug 19, 2019

Query To Get List of all Responsibility attached for user



 SELECT fuser.user_name,
         frt.responsibility_name,
         furgd.start_date,
         furgd.end_date,
         fresp.responsibility_key,
         fapp.application_short_name,
         furgd.*
    FROM apps.fnd_user_resp_groups_direct furgd,
         apps.fnd_user fuser,
         apps.fnd_responsibility fresp,
         apps.fnd_responsibility_tl frt,
         apps.fnd_application fapp,
         apps.fnd_application_tl fat
   WHERE     1 = 1
         AND furgd.user_id = fuser.user_id
         AND furgd.responsibility_id = frt.responsibility_id
         AND fresp.responsibility_id = frt.responsibility_id
         AND fapp.application_id = fat.application_id
         AND fresp.application_id = fat.application_id
         AND frt.language = USERENV ('LANG')
         AND UPPER (fuser.user_name) = UPPER ('&Enter_User_Name')
--AND (furgd.end_date IS NULL OR furgd.end_date >= TRUNC(SYSDATE))
ORDER BY frt.responsibility_name;

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...