Excelt 2 Table
Excelt 2 Table
File > New > General > Workspace Configured for Oracle Applications
http://www.findjar.com/jar/net.sourceforge.jexcelapi/jars/jxl-2.6.jar.html
Right Click on ImportxlsDemo > Project Properties > Libraries > Add jar/Directory and browse
to directory where jxl-2.6.3.jar has been downloaded and select the JAR file
Steps to add jxl.jar file at EBS middle tier
wrapper.classpath=/U01/oracle/dev/mahiappldev/fnd/11.5.0/java/3rdparty/stdalone/jxl.ja
r
Right Click on ImportxlsDemo > New > ADF Business Components > Application Module
Name -- ImportxlsAM
Package -- Mahi.oracle.apps.fnd.importxlsdemo.server
Right click on ImportxlsDemo > New > ADF Business Components > Entity Object
Name – ImportxlsEO
Package -- Mahi.oracle.apps.fnd.importxlsdemo.schema.server
Check the Accessors, Create Method, Validation Method and Remove Method
Right click on ImportxlsDemo > New > ADF Business Components > View Object
Name -- ImportxlsVO
Package -- Mahi.oracle.apps.fnd.importxlsdemo.server
In Step3 in Attributes Window select all columns and shuttle them to selected list
In Java page Uncheck Generate Java file for View Object Class: ImportxlsVOImpl
Select Generate Java File for View Row Class: ImportxlsVORowImpl -> Generate Java File ->
Accessors
Right click on ImportxlsAM > Edit ImportxlsAM > Data Model >
Right click on ImportxlsDemo > New > Web Tier > OA Components > Page
Name -- ImportxlsPG
Package -- Mahi.oracle.apps.fnd.importxlsdemo.webui
9. Select the ImportxlsPG and go to the strcuture pane where a default region has been
created
Attribute Property
ID PageLayoutRN
AM Definition Mahi.oracle.apps.fnd.importxlsdemo.server.ImportxlsAM
Window Title Import Data From Excel through OAF Page Demo Window
Attribute Property
ID MainRN
ID MessageFileUpload
Attribute Property
ID ButtonLayout
Attribute Property
ID Go
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import java.io.Serializable;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.cabo.ui.data.DataObject;
import oracle.jbo.domain.BlobDomain;
if (pageContext.getParameter("Go") != null)
{
DataObject fileUploadData =
(DataObject)pageContext.getNamedDataObject("MessageFileUpload");
String fileName = null;
try
{
fileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
}
catch(NullPointerException ex)
{
throw new OAException("Please Select a File to Upload", OAException.ERROR);
}
import java.io.IOException;
import java.io.InputStream;
import jxl.Cell;
import jxl.CellType;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.jbo.Row;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;
import oracle.jbo.domain.BlobDomain;
if (!vo.isPreparedForExecution())
{
vo.executeQuery();
}
vo.insertRow(row);
getTransaction().commit();
}
try
{
w = Workbook.getWorkbook(inputWorkbook);
else
{
excel_data[j] = "";
}
}
createRecord(excel_data);
}
}
catch (BiffException e)
{
e.printStackTrace();
}
}
15. Congratulation you have successfully finished. Run Your page and Test Your Work