Thursday, November 12, 2015

Optimisation

When we go for optimisation, we need to think about

1. Index
2. Explain Plan
3. Analyse table
4. Response time etc

Tuesday, November 10, 2015

DBMS_METADATA.GET_DDL

Select DBMS_METADATA.GET_DDL('object type', 'object name', ' owner')
From dual;

Try this

Thursday, September 4, 2014

How to Use Flexfields in Custom forms

There are several complicated things you may need to do with flexfields in your forms but one of them is simple and very common: create a foreign key on the accounting flexfield. It is easy to get lost in the Oracle Application Developer's Guide because it tries to cover comprehensively what can be done with flexfields. But there is nothing to show you the basics step-by-step, which is what we will attempt in this article.

The  end result of what we show is illustrated in Figure 1: one field that brings up the standard flexfield popup when the user asks for a list of values.
Figure 1: The end result of this step-by-step article.
A basic conceptual understanding of what flexfields are is necessary in order to understand what follows. There is a very good 2-3 page explanation in the chapter "Flexfields" of the oracle application Developer's Guide.

Step 1: Create a FK Column

First you need to define a column in the base table maintained by your form. This column will be the foreign key on the unique ID of the combination table, in our case: GL_CODE_COMBINATIONS. So you need a number(38) mandatory column in your table.

Step 2: Create a Flexfield hidden item

In your form you need to create a hidden item for the FK column. This field needs to be hidden, that is set to canvas null. It should use the TEXT_ITEM property class which comes from the Oracle Application template. Set the query length to 2000 just to be on the safe side. Figure 2 shows an example of such hidden ID.
Figure 2: Hidden field to hold the Flexfield reference. 
Figure 2: Hidden field to hold the Flexfield reference.

Step 3: Create a Flexfield display item

Now we want to create a non-database text_item that will display the concatenated values of the segments of the accounting field. This item should use the TEXT_ITEM property class and be assigned to the appropriate canvas where you want users to see it. You then need to assign to it the dummy LOV 'ENABLE_LIST_LAMP' which comes from the Oracle Application template. Make sure that property 'Validate from list' is set to No. This ensures that the List lamp works properly for your flexfield. Figure 3 shows an example of such displayed field. We only show the most relevant item properties.
Figure 3: Displayed field to show the concatenated values of the Flexfield. 
Figure 3: Displayed field to show the concatenated values of the Flexfield.

Step 4: Create the Flexfield definition

Then there is a little bit of PL/SQL to do in order to define your flexfield. This is done with the WHEN-NEW-FORM-INSTANCE trigger. It is always a good practice to do the actual work in a procedure or package as is illustrated in listing A. There are several reasons for this but this is out of the scope of this article. Note: the code in listing A is an abbreviated version of the real code: we have left out the comments and the error handling in order to keep this article as short as possible.

Listing A: Dynamic Flexfield definition
procedure initialize is     cursor get_cao is        select  to_char(id_flex_num)        from    fnd_id_flex_structures        where   id_flex_structure_code = 'ACCOUNTING_FLEXFIELD'                and id_flex_code = 'GL#';     v_cao    varchar2(1000);            begin    open get_cao;    fetch get_cao into v_cao;    if get_cao%notfound then        v_cao := '101';    end if;    close get_cao;       app_standard.event('WHEN-NEW-FORM-INSTANCE');    fnd_key_flex.define(      BLOCK=>'COMBO',      FIELD=>'ACCOUNT_FLEXFIELD',      APPL_SHORT_NAME=>'SQLGL',      CODE=>'GL#',      NUM=>v_cao,      ID=>'CODE_COMBINATION_ID',      DESCRIPTION=>'',      TITLE=>'____ Your nice user friendly title here _____',      VALIDATE=>'FULL',      QBE_IN=>'Y',      DERIVE_ALWAYS=>'Y',      updateable => '',      VRULE=>'\\nSUMMARY_FLAG\\nI\\nAPPL=SQLGL;NAME=GL_NO_PARENT_SEGMENT_ALLOWED\\nN',      where_clause => 'summary_flag != ''Y''',      QUERY_SECURITY =>'Y');  end initialize;

Step 5: Code several event triggers


Then, all that is left to do is to program a few events:
  • WHEN-VALIDATE-ITEM
  • WHEN-NEW-ITEM-INSTANCE
  • POST-QUERY
  • PRE-QUERY
  • KEY-LISTVAL
The code is shown in Listing B.
We always try to put this code in the form level triggers as it is more convenient and consistent than doing it at block or item level, especially when you have more than one foreign key flexfield in the form. Only in the case of very large and complicated forms would we do otherwise.
If you are updating someone else's form, you may need to check that no block or item triggers are overriding your form level triggers. Check also the execution style of your form level triggers. Whether your trigger should fire in mode Before, After or Override will depend on your context.
Listing B: Event programming for the Flexfields.
WHEN-VALIDATE-ITEM    if ( :system.mode = 'NORMAL' ) then       fnd_flex.event( 'WHEN-VALIDATE-ITEM' );    end if;WHEN-NEW-ITEM-INSTANCE    app_standard.event('WHEN-NEW-ITEM-INSTANCE');    fnd_flex.event('WHEN-NEW-ITEM-INSTANCE' );POST-QUERY--Loads the flexfields (in our case, it populates--the concatenated field on execute query).    FND_FLEX.EVENT('POST-QUERY');PRE-QUERY--If you don't do this, whatever query criteria you may enter in-- the concatenated flex field, it is not taken into account.    FND_FLEX.EVENT('PRE-QUERY' );KEY-LISTVAL    APP_STANDARD.EVENT('KEY-LISTVAL');    FND_FLEX.EVENT('KEY-LISTVAL' );

Monday, September 1, 2014

AP invoice interface

http://oracleoverview.com/ap-invoice-interface-ap_invoices_interface-tables-38


AP invoice interface is used  to import vendor invoices into Oracle applications from legacy systems.

AP invoice interface tables:

This is the open interface table for importing AP Invoices from external sources (Flat Files ) and stores invoices header information .  There is one row for each invoice you import. Oracle Payables application uses this information to create invoice header information when Payables Open Interface program is submitted. Data in the AP_INVOICES_INTERFACE table used in conjunction with AP_INVOICE_LINES_INTERFACE table to create Payables Invoice, Invoice lines, Distributions and Schedule payments. Data in this table can be viewed and edited using ‘Open Interface Invoices’ window. The Payables Open Interface program validates each record in this interface table selected for import, and if the record contains valid data then the program creates a Payables Invoice.
AP_INVOICES_INTERFACE Important columns : 
INVOICE_ID (Required) : Unique identifier for this invoice within this batch. Same value should be populated in invoice’s lines in the AP_INVOICE_LINES_INTERFACE table to identify the data as belonging to the same invoice.
INVOICE_NUM (Required) :  Enter the invoice number that needs to be assigned to the invoice created in Payables from this record.
INVOICE_TYPE_LOOKUP_CODE (Optional) : Type of invoice: Credit or Standard.
INVOICE DATE (Optional) : Date of the invoice. If you do not enter a value, the system uses the date you submit Payables Open Interface Import as the invoice date.
PO_NUMBER (Optional)  : Purchase order number from PO_HEADERS.SEGMENT1. This column needs to be populated if invoice to be matched with an purchase order.
VENDOR_ID & VENDOR_SITE_ID (Required) : VENDOR_ID is unique identifier for a supplier and VENDOR_SITE_ID is Internal supplier site identifier. Supplier of the invoice to be derived by value in one of the following columns in this table: VENDOR_ID, VENDOR_NUM, VENDOR_NAME, VENDOR_SITE_ID or PO_NUMBER.
VENDOR_NUM & VENDOR_NAME (Optional) : Supplier number and name. You must identify the supplier by entering a value for one of the following columns in this table: VENDOR_ID, VENDOR_NUM, VENDOR_SITE_ID, VENDOR_SITE CODE, or PO_NUMBER.
INVOICE_AMOUNT (Required) : Amount of the invoice.
INVOICE_CURRENCY_CODE (Optional)  : Currency code for the invoice. If you want to create foreign currency invoices, enter a currency code that is different from your functional currency.
EXCHANGE_RATE (Optional) :  This column is required if you enter a foreign currency code in the INVOICE_CURRENCY_CODE column and you enter User as the EXCHANGE_RATE_TYPE.
TERMS_ID (Optional) : Internal identifier for the payment terms.
DESCRIPTION (Optional) : Enter the description that you want to assign to the invoice created from this record.
SOURCE (Required) : Source of the invoice data. If you import EDI invoices from the Oracle EDI Gateway, the source is EDI Gateway. For invoices you import using SQL*Loader, use a QuickCode with the type Source that you have defined in the QuickCodes window in Payables.
2] AP_INVOICE_LINES_INTERFACE
This is the lines interface table for the AP Invoice Open Interface and it is used in conjunction with AP_INVOICE_INTERFACE table. AP_INVOICE_LINES_INTERFACE stores information used to create one or more invoice distributions. Note that one row in this table may create, during the import process, more than one invoice distribution.
Important columns: 
INVOICE_ID (Required) :Enter the INVOICE_ID of the corresponding invoice in the AP_INVOICES_INTERFACE table. 
INVOICE_LINE_ID : This value is not required. You can enter a unique number for each invoice line of an invoice.
LINE_NUMBER (Optional) : You can enter a unique number to identify the line.
LINE_TYPE_LOOKUP_CODE (Required) : Enter the lookup code for the type of invoice distribution that you want Payables Open Interface Import to create from this record. The code you enter must be ITEM, TAX, MISCELLANEOUS, or FREIGHT. These lookup codes are stored in the AP_LOOKUP_CODES table.
AMOUNT (Required) : The invoice distribution amount. If you are matching to a purchase order, the AMOUNT = QUANTITY_INVOICED x UNIT PRICE. If the total amount of all the invoice distributions does not equal the amount of the invoice that has the same INVOICE_ID, then Payables Open Interface Import will reject the invoice.

Concurrent program:   Payables Open Interface Import

Parameters:
Source: Choose the source of the invoices from the list of values. Use EDI Gateway, Credit Card, or a Source type QuickCode you defined in the Payables QuickCodes window.
Group: To limit the import to invoices with a particular Group ID, enter the Group ID. The Group must exactly match the GROUP_ID in the Payables Open Interface tables.
Batch Name: Payables groups the invoices created from the invoices you import and creates an invoice batch with the batch name you enter. You can enter a batch name only if you have enabled the Use Batch Control Payables option, and if you have enabled the Use Batch Control Payables option, you must enter a batch name. If you use a batch name and some invoices are rejected during the import process, you can import the corrected invoices into the same batch if you enter the exact batch name during the subsequent import.
Hold Name: If you want to place all invoices on hold at the time of import, enter an Invoice Hold Reason. You can define your own hold reasons in the Invoice Approvals window.
Hold Reason: Payables displays the Invoice Hold Reason Description.
GL Date: If you want to assign a specific GL Date to all invoices, enter a GL Date. If you do not enter a value here, the system will assign a GL Date based on the GL Date Payables option.
Purge: Enter Yes if you want Payables to delete all successfully imported invoice records that match the Source and Group ID of this import. Payables does not delete any invoice data for which it has not yet created invoices. If you want to purge later, you can use the Payables Open Interface Purge Program.
You can go to Payables > Invoices > Entry > Open Interface Invoices to check the details of Invoice and Invoice Lines from the front end.

Monday, August 18, 2014

OBIEE 11.1.1.6.0 RCU Installation

Database Installation and Configuration:

If you installed database already on your machine, you can skip to section.

Before we starting the installation of RCU, we need to choose that which database we are going to use in our application. Here I am giving how to run RCU in Oracle database on our local machine. It is good to install Oracle Database enterprise or standard edition to take full advantage of database for datatypes like spatial data or features like OLAP.

Prerequisites:
Here I am giving the installation steps that how I have installed RCU in my windows 32bit Operating system. If you have 64 bit OS, no worry the steps are same.
• Minimum of 4GB RAM required, 3 GB RAM would work but, system would be
slow.
• Minimum of 10GB hard disk memory required.
• not use any directory name with space while installing/working with Oracle
DB and BI11g.


Installing RCU:
BI 11g is now standardized with Oracle fusion middleware and hence leverage database for metadata storage just like any other middleware product. So here we are going to install BI11g metadata schema on oracle database you just installed and configured. Same process can be leveraged to install metadata schema on other supported databases as well.
If you have not done already, please download BI11g installation files and RCU installation files. Please make sure all the zipped files have downloaded correctly and unzipped into a single folder.
We can download the software from below Download page:
http://www.oracle.com/technetwork/middleware/bi-enterprise-edition/downloads/bus-intelligence-11g-165436.html


Now we will start the installation of metadata schema using RCU.

From unzipped folder for RCU, run rcu.bat file to start the utility: rcu.bat file is located under rcuHome\BIN directory.

RCU utility will launch the GUI based wizard to guide you through the steps. Click Next to continue.
Select create from the below screen and click Next

In the below step Make sure database type is Oracle Database and enter following information to continue.
For e.g:
Host Name: localhost
Port: 1521
Service Name: ORCL
Username: sys
Role: sysdba
Password:  MyPassword123
since we are using oracle database, RCU will show a warning message that we can just ignore and can continue the installation.
Click OK to continue once RCU validates and initializes database configuration.
In the next step it will ask for the prefix to create the metadata schemas. By default it is showing 'DEV'. If we want to change the prefix we can  change it.
From the below window select appropriate schemas which we need to install.
I have selected only two which is showing in the screenshot

Click 'Next' from the above screen to create schema and the click 'OK' once RCU shows schema creation prerequisites check completed.
In the next step Enter password for both the schema as you like with the password conditions (such as alphabet, numeric and with special character) and click 'Next' to continue.
Click 'Next' with the above step to have RCU create the selected schemas
Click 'OK' to continue creation of tablespace.
Once tablespace created, click 'OK' to continue.

Now RCU will create required schema objects within the tablespace just created. So Click 'Create' with next step and continue
Click 'close' to finish RCU wizard once schemas are created successfully.
with the above step the installation of RCU is completed
Note:

Remember the password which we have given for all the  users/schemas so far and we will continue to use the same password. We will need this password for BI installation as well to let BI installer knows where the metadata schemas located and what is the password to connect to the schema. Now we can login to the oracle database and can whether that two schems (DEV_BIPLATFORM, DEV_MDS) is available.

OBIEE 11.1.1.7.0 Installation Steps

This post will guide us through the  step by step installation of OBIEE 11.1.1.7.0. Here I don't find any difference in RCU installation between in previous version with this version. Still if you want to know the RCU installation steps click here
Download the OBIEE 11g version from here or from oracle e-delivery site and extract all the four disk into a single folder and click setup.exe from the Disk1

Universal Installer window will start and will check for the initial set up and system requirement.
After the successful precheck the first step of our OBIEE 11.1.1.7.0 starts with the below window. Just Click 'Next'


Step2: 
If you have oracle Support username and password then update then use that in this step or just select first option 'Skip Software updates' and click 'Next'

Step3:
Select the appropriate installation step here. I am going to install all the component of BI so selected here 'Enterprise Install' and then click 'Next'

Step4:
This step will just check operating system certification and physical memory. Just click 'Next' after the check passed through

Step5:
As It is a new installation, select the option 'Create New BI System' and type password for weblogic User.
Note: Save or remember the password because this is the password going to be used to access BI system, EM, Console and answers later on..
and then click 'Next'

Step6:
In this step we have to select the actual folder where we want to install BI 11g. So here I have created an folder in C:\ driver and selected here by browsing the home location in this window. Remaining boxes will be automatically filled once we selected the home location then click 'Next'

With the above window we will get warning like below screen. Just Click 'Yes and click 'Next' with the above screen
Step7:
In this step we would know what are the components going to be installed. If you are really going to user 'RTD' and Essbase Suite the leave it selected or Just uncheck with the below screen and click 'Next'

Step8:
In this step we have to select the database where we have installed our RCU. I have done in oracle database so selected the oracle database in database type

Connection String: dbservername:portnumber:servicename
BIPLATFORM Name: DEV_BIPLATFORM
BIPLATFORM Pwd: Admin123

Note: This username and password would be same which we have given when we installed RCU

Step9:
Same steps like the previous step but here with DEV_MDS username and password. After entering all the details just click 'Next'

Step10:
Just Select 'Auto Port Configuration' if you want to install with the default port numbers that oracle do the installation and then click 'Next'

Step11:
If we have oracle support email id we could mention with this step or just deselect the option click 'Yes' with the warning screen and click 'Next' with the below step



Step12:
With this step just click 'Install' so that the actual installation will be started with the below screen:

Step13:
Just watch the installation progress with this step

It take a while even the progress bar shows 100%. Post installation script might be take some time so be patient the steps will pass through.
Step14:
After successful installation the configuration steps will start. It takes a while to finish all the configuration so wait to finish and then just click 'Next' when the configuration shows 100%

Step15:
So actual installation and configuration are over with the above step. If you want to save the path details for middleware home, domain home and others click 'Save' with the below screen and save it in a file for reference. and the just click 'Finish' to complete the installation.

Now browse through the answers, EM and console and Play with BI.

Friday, August 8, 2014

Oracle Form Compilation in R12

Form Compilation
Corresponding value in the array. The key can be integer or a string.
Follow the instructions below to compile your forms in Release 12
1:- Log into the forms tier.
2:- Set the applications environment
3:- Ensure that the $FORMS_PATH includes $AU_TOP/resource and $AU_TOP/resource/stub, for example

echo $FORMS_PATH
/u01/oracle/TEST/apps/apps_st/appl/au/12.0.0/resource:
/u01/oracle/TEST/apps/apps_st/appl/au/12.0.0/resource/stub

 Compile the form
 If you are using forms customization (CUSTOM.pll) then run the command below to compile the form.

frmcmp_batch.sh module=<path to fmb file> userid=APPS/APPS output_file=<full path to fmx output file> module_type=form compile_all=special

For eg:-
frmcmp_batch.sh module=/u01/oracle/TEST/apps/apps_st/appl/au/12.0.0/forms/US/XXX.fmb userid=APPS/APPS output_file=/u01/oracle/TEST/apps/apps_st/appl/inv/12.0.0/forms/US/XXX.fmx module_type=form compile_all=special


If you are NOT using forms customizations, then run the command below to compile the form.
frmcmp_batch.sh module=<path to fmb file> userid=APPS/APPS output_file=<full path to fmx output file> module_type=form


For example.
frmcmp_batch.sh module=/u01/oracle/TEST/apps/apps_st/appl/au/12.0.0/forms/US/XXX.fmb userid=APPS/APPS output_file=/u01/oracle/TEST/apps/apps_st/appl/inv/12.0.0/forms/US/XXX.fmx module_type=form