Thursday 11 December 2014

CALLING  XML REPOERTS    FROM  OAF PAGE THROUGH CONCURRENT PROGRAM



if("generatereport".equals(pageContext.getParameter("event"))){
    OADBTransactionImpl txn=(OADBTransactionImpl)am.getOADBTransaction();
             OAViewObject   vo = (OAViewObject)pageContext.getApplicationModule(webBean).findViewObject("AuctionHeadersAllVO"); //getting view object for AuctionHeadersAllVO
             String  DocumentNumber=(String)vo.getCurrentRow().getAttribute("DocumentNumber"); //getting document number from current row
             int DocumentNumber1=Integer.parseInt(DocumentNumber);
             pageContext.writeDiagnostics(this,"DocumentNumber in co:"+DocumentNumber,1); //display document number
             /* call the method which runs the concurrent program and returns request id*/
                 int req_id= submitCPRequest(DocumentNumber,txn);
                 if(pageContext.isLoggingEnabled(1))
                 {
                         pageContext.writeDiagnostics(this,"req_id in CO:"+req_id,1); //display request id
                 }

                  //Make application sleep for 15 seconds to finish the concurrent program
                 try
                             {
                              CallableStatement cal=txn.createCallableStatement("begin dbms_lock.sleep(20); end;",1);
                            
                               cal.execute();
                              cal.close();
                                   
                             }
                             catch(Exception e)
                             {
                               throw OAException.wrapperException(e);
                             }
             //Get the output file name from the backend table
                 String file_name=null;
                             try
                             {
                              CallableStatement cal=txn.createCallableStatement("begin select file_name into :1 from FND_CONC_REQ_OUTPUTS where concurrent_request_id=:2; end;",1);
                             cal.setInt(2,req_id);
                                
                               cal.registerOutParameter(1,Types.VARCHAR);
                               cal.execute();
                              file_name= cal.getString(1);
                              cal.close();
                               if(pageContext.isLoggingEnabled(1))
                               {
                              pageContext.writeDiagnostics(this,"file_name:"+file_name,1);
                               }
                             
                                    
                             }
                             catch(Exception e)
                             {
                               //throw OAException.wrapperException(e);
                               System.out.println("no data found");
                             }

             //Read data from output file and display

                 DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
                                 HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse");
                 String contentDisposition = "attachment;filename="+DocumentNumber+".xls";
                             response.setHeader("Content-Disposition",contentDisposition);
                             response.setContentType("application/vnd.ms-excel");
                 
                 File f=new File(file_name);
                
                // File f=new File("/u02/PROD/inst/apps/MPPMCL_bb02/logs/appl/conc/out/XXMPP_SCM_NIT_PUB_TEMP_878237_1.PDF");
                 if(pageContext.isLoggingEnabled(1))
                 {
                 pageContext.writeDiagnostics(this,"output file:"+f,1);
                }
               try {
                     if(pageContext.isLoggingEnabled(1))
                     {
                     pageContext.writeDiagnostics(this,"in try block:",1);
                     }
                       OutputStream os = response.getOutputStream();
                       byte[] buf = new byte[8192];
                       InputStream is = new FileInputStream(f);
                       int c = 0;
                       while ((c = is.read(buf, 0, buf.length)) > 0) {
                           os.write(buf, 0, c);
                           os.flush();
                       }
                       os.close();
                       is.close();
                   } catch (IOException e) {
                       e.printStackTrace();
             }



}
    }
    public int submitCPRequest(String Rfq_num,OADBTransaction tx) {
    try {

    java.sql.Connection pConncection = tx.getJdbcConnection(); //get JDBC connection object

    ConcurrentRequest cr = new ConcurrentRequest(pConncection); // get the concurrentrequest object
    String applnName = "XXMPP"; //Application that contains the concurrent program

    String cpName = "XXMPPTEQTRPT"; //Concurrent program name

    String cpDesc = null; // concurrent Program description
    Vector cpArgs = new Vector(); //create an object for vector

    cpArgs.addElement(Rfq_num); //pass parameters by using vector
    try
    {
    cr.addLayout("XXMPP","XXMPPTEQTRPT","EN","US","EXCEL",null); //addlayout to the concurrent program
    }
    catch(Exception e)
    {
      throw OAException.wrapperException(e);
    }
   
    int requestId = cr.submitRequest(applnName, cpName, cpDesc, null, false, cpArgs); //call submitRequest method in ConcurrentRequest class
    tx.commit(); //commit
    return requestId; //return request id

    } catch (RequestSubmissionException e) {
    OAException oe = new OAException(e.getMessage());
    throw oe;
    }
    }

Tuesday 2 December 2014

 HIDING DFF ATTRIBUTES  DYNAMICALLY






Processrequest
        OADescriptiveFlexBean dff=(OADescriptiveFlexBean)webBean.findChildRecursive("ActFlexField");
        dff.processFlex(pageContext);
        dff.mergeSegmentsWithParent(pageContext);


ppr

        OADescriptiveFlexBean dff=(OADescriptiveFlexBean)webBean.findChildRecursive("ActFlexField");

        dff.processFlex(pageContext);
        //OAMessageLovInputBean dff1=(OAMessageLovInputBean)dff.findChildRecursive("ActFlexField0");
       
        String strdff1=pageContext.getParameter("ActFlexField0");
        OAMessageLovInputBean dff2=(OAMessageLovInputBean)dff.findChildRecursive("ActFlexField1");
       
        if(pageContext.isLovEvent()){
        if("ActFlexField0".equals(pageContext.getParameter(SOURCE_PARAM))){
        if("No".equals(strdff1))
            dff2.setAttributeValue(RENDERED_ATTR,Boolean.TRUE);
           
            else
            dff2.setAttributeValue(RENDERED_ATTR,Boolean.FALSE);
        }
       
        }
    
HOW TO CRATE    VO   WITH   BOOLEAN TRANSIENT ATTRIBUTE



   OAViewDef viewdef=(OAViewDef)am.getOADBTransaction().createViewDef();
             
                viewdef.addTransientAttrDef(
        "TextDisable",               //Attr name
        "java.lang.Boolean",         //Java type
        null,                       //Default value
        false,                      //Not null
        AttributeDef.UPDATEABLE);   //Updateable
         OAViewObject vo=null;
             ViewObject  v=null;
             if(am!=null){
            v=am.findViewObject("xxBidFeeAmountVO1");
           
  
             }
            try{
              if(v==null){
                   vo=(OAViewObject)amImpl.createViewObject("xxBidFeeAmountVO1",viewdef);
                vo.setMaxFetchSize(0);
                        Row row = vo.createRow(); 
                        vo.insertRow(row);
                        Row row1=vo.first();
                        row1.setAttribute("TextDisable",Boolean.TRUE);
                    vo.executeQuery(); 
              }
           
            else
            {
            v.reset();
                v.setMaxFetchSize(0);
                        Row row = v.createRow(); 
                        v.insertRow(row);
                        Row row1=v.first();
                        row1.setAttribute("TextDisable",Boolean.TRUE);
                    v.executeQuery();
            }
            }
            catch(Exception e){
                throw new OAException("firse",OAException.ERROR);       
            }
            

Friday 7 November 2014

Attaching Custom Vo To Standard Page Existing AM





OAApplicationModule am = pageContext.getApplicationModule(webBean);  

OAViewObject oaviewobject = (OAViewObject)am.findViewObject("xxScoResourceVO1");  

if(oaviewobject == null)  
{  
oaviewobject = (OAViewObject)am.createViewObject("xxScoResourceVO1","xx.oracle.apps.pa.poplist.server.xxScoResourceVO");  

}  

Thursday 26 June 2014

How to know user password from Back End in Oracle apps R12

1.

CREATE OR REPLACE PACKAGE get_pwd
AS
   FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
      RETURN VARCHAR2;
END get_pwd;
2.

CREATE OR REPLACE PACKAGE BODY get_pwd
AS
   FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
      RETURN VARCHAR2
   AS
      LANGUAGE JAVA
      NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt(java.lang.String,java.lang.String) return java.lang.String';
END get_pwd;
/
3. run below select query you will get user_name and password.

select usr.user_name,
       get_pwd.decrypt
          ((select (select get_pwd.decrypt
                              (fnd_web_sec.get_guest_username_pwd,
                               usertable.encrypted_foundation_password
                              )
                      from dual) as apps_password
              from fnd_user usertable
             where usertable.user_name =
                      (select substr
                                  (fnd_web_sec.get_guest_username_pwd,
                                   1,
                                     instr
                                          (fnd_web_sec.get_guest_username_pwd,
                                           '/'
                                          )
                                   - 1
                                  )
                         from dual)),
           usr.encrypted_user_password
          ) password
  from fnd_user usr
 where upper(usr.user_name) = upper('&user_name');

Saturday 29 March 2014

How to move Personlization From One instance to another Instance Throug Functional Administrator


HOW TO MOVE PERSONLIZATIONS FROM ONE INSTANCE TO ANOTHER THROUGH FUNCTIONAL ADMINISTRATOR
Hi Previously I told how to import personalization from back end , now we see how to move personalization through functional administrator
 
Go to System Administrator ResponisbilityàSystemàProfile




In profile Set the Fnd Documentary Root Path Profile Option
 
 
   Next Go to Function Administrator Responisibilty 
 
Click on Personalixation àimport/Export
 
Enter the Page path on which you want to Export  the personalization  at Document Path Field.
 
Click on go Button it shows personalization what ever  You have done on the page.
Select   personalization on which you want  to export and click on the Export File system Button .
 
 
 
Click on ok button .It is exported those personalization inti  tem folder which was already set into the path.
Move the  personalization from first system temp folder to second one manually
Which was generated in the temp folder.
 
 
 
Go to another instance on which you want to export.go to system administrator and repeat the first
Step.
Go to functional administrator In the second system. And click on import and export.
Similar to  first system.
Click on Export to file system button
 


 

Select the path which you want to import àclick on Import from file system.the personalizations were successfully imported.
IF u have any Doubts please give the Comments than  i will help you.
 

Tuesday 25 March 2014

                                                   Dyanmical Partial Fire Action TO The DFF




          OADescriptiveFlexBean dff=(OADescriptiveFlexBean)webBean.findChildRecursive("HrQuaFlex");
          dff.processFlex(pageContext);
          RenderingContext con = (RenderingContext) pageContext.getRenderingContext();
          if(dff!=null)
          {
               pageContext.writeDiagnostics(this,"SS Inside the DFF--->",OAFwkConstants.STATEMENT); 
              OAMessageTextInputBean mti1=(OAMessageTextInputBean)dff.findChildRecursive("HrQuaFlex1");
              if(mti1!=null)
              {
                   pageContext.writeDiagnostics(this,"In side the MTI--->",OAFwkConstants.STATEMENT); 
                   FireAction firePartialAction = new FirePartialAction(); 
                   pageContext.writeDiagnostics(this,mti1.getPrompt(),1);
                   firePartialAction.setEvent("Address");
                   firePartialAction.setUnvalidated(true);
                   mti1.setPrimaryClientAction(firePartialAction);
                   mti1.setFireActionForSubmit("Address",null,null,true);
             
               }else
                {
                   pageContext.writeDiagnostics(this,"bean is Null",1);
               }
        
          }
      }
        public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    {
        super.processFormRequest(pageContext,webBean);
        QualificationAMImpl am = (QualificationAMImpl)pageContext.getApplicationModule(webBean);
      // OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
          OAViewObject vo =(OAViewObject)am.findViewObject("QualificationDetailsVO");
        
            
        if (pageContext.isLovEvent())
            {  
                 pageContext.writeDiagnostics(this,"SS Enters inside lov",OAFwkConstants.STATEMENT); 
                       String lovInputSourceId = pageContext.getLovInputSourceId();
                       if ("HrQuaQualificationTypeId".equals(lovInputSourceId))
                       { 
        
                    OAMessageLovInputBean lovInputBean6=(OAMessageLovInputBean)webBean.findIndexedChildRecursive("HrQuaQualificationTypeId");
                        String Type =(String)lovInputBean6.getValue(pageContext);
                         pageContext.writeDiagnostics(this,"SS Type"+Type,OAFwkConstants.STATEMENT); 
                        pageContext.putSessionValue("OtherQual",Type);
                       
                 OADescriptiveFlexBean dff=(OADescriptiveFlexBean)webBean.findChildRecursive("HrQuaFlex");
                 dff.processFlex(pageContext);
                 //OAMessageChoiceBean FirstDff = (OAMessageChoiceBean)oaDFF.findIndexedChild("FlexField0");
                      
                Row row = vo.first(); 
               
                  if ("Others".equals(Type))                         
                  {
                       pageContext.writeDiagnostics(this,"SS Inside ",OAFwkConstants.STATEMENT);
                      
                         row.setAttribute("IsQualDetRenTr",Boolean.TRUE);
                       String SSqual=(String)pageContext.getSessionValueDirect("Qualification");
                       if(SSqual==null)
                       {
                           throw new OAException("Please Enter Other Qualification",OAException.ERROR);
                       }
                        
                 }
                 else  {
              pageContext.writeDiagnostics(this,"SS else paart ",OAFwkConstants.STATEMENT);
                 row.setAttribute("IsQualDetRenTr",Boolean.FALSE);
               
                
                      
                       }
             }
            }
          
                         String qualif = (String)pageContext.getSessionValue("OtherQual");
                         if ("Others".equals(qualif))
                        {
                            pageContext.writeDiagnostics(this,"Enter Inside Event others--->",1);
                            if("Address".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
                            {
                              pageContext.writeDiagnostics(this,"Enter Inside the Event--->",1);
                              OADescriptiveFlexBean dff=(OADescriptiveFlexBean)webBean.findChildRecursive("HrQuaFlex");
                              dff.processFlex(pageContext);
                              OAMessageTextInputBean mti1=(OAMessageTextInputBean)dff.findChildRecursive("HrQuaFlex1");
                              mti1.getValue(pageContext);
                              pageContext.writeDiagnostics(this,"PFR Value-->"+mti1.getValue(pageContext),1);
                              pageContext.putSessionValueDirect("Qualification",mti1.getValue(pageContext));
                           
                            }
 
                        }

Wednesday 1 January 2014

XML/BI PUBLISHER INTERVIEW QUESTIONS


BI Publisher:
1)What is BI Publisher?
It is a reporting tool for generating the reports.

2)What is the difference between xml publisher and BI Publisher?
Name is the difference, initially it was released on the name of xml publisher( the initial patchset),
later on they have added more features and called it Business Intelligence Publisher.
In BI by default we have integration with Datadefinitions in R12 instance(XDODTEXE).
Both these names can be used interchangeably.

3)What are the various components required for developing a BI publisher report?
Data Template, Layout template and the integration with Concurrent Manager.

4)What is a datatemplate?
Datatemplate is an xml structure which contains the queries to be run against the database so that
desired output in xml format is generated,this generated xml output is then applied on to the layout template for the final output.

5)What is a layout template?
Layout template defines how the user views the output, basically it can be developed using Microsoft
word document in rft (rich text format)or Adobe pdf format. The data output in xml format (from Data template) will be loaded in layouttemplate at run time and therequired final output file is generated.

6)What are the output formats supported by layout template?
xls, html, pdf, eText etc are supported based on the business need.
7)BI Publisher syntax
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dataTemplate name="XXFIN_GBL_COMEXP" Description="UNITY FAR0003 Bucket Aging and Insurance
Detail Report" version="1.0" defaultPackage="XXFIN_GBL_AGING_INSURNC_PKG">
<parameters>
</parameters>
<dataQuery>
<sqlStatement name="Q_TRX_DETAILS">
</sqlStatement>
</dataQuery>
<dataTrigger name="beforeReport" source="XXFIN_GBL_AGING_INSURNC_PKG.BEFOREREPORT" />
<dataStructure>
<group name="G_LEDGER_NAME" source="Q_LEDGER_NAME">
<element name="C_BALANCE_B1" value="B1_INV" />
</group>
</dataStructure>
</dataTemplate>

8)How to debug the BI Publisher?
<properties>
<element name="debug_mode" value="on"/>
<element name="scalable_mode" value="on"/>
<element name="data_fetch_size" value="20"/>
</properties>

9)what is debug_mode and its use?
debug_mode is optional, To run the utility in debug mode and write debug statements to the log file.

10) what is scalable_mode and use?
Sets the data engine to execute in scalable mode. This is required when processing a large volume of
data.
Valid values:
*on
*off (default)

11)what is data_fetch_size and use?
Sets the number of rows fetched at a time through the jdbc connection. The default value is 500.