In Oracle Application Framework (OAF), you can use the getXSID() method of the OAFwkUtil class to get the current XSID (cross-session ID). The XSID is a unique identifier that is generated for each user session in OAF.
Here is an example of how you might use the getXSID() method in an OAF application:
Sql for this : select XSID from icx_sessions
Simple , You can use this (import this before any work WebAppsContext)
String xsid = webAppsContext.getEnvStore().setEnv("ICX_SESSION_COOKIE_VALUE");
Explanation:If you are trying to retrieve the value of the ICX_SESSION_COOKIE_VALUE environment variable and store it in a variable called xsid, you can use the getEnvStore().setEnv() method of the webAppsContext object in your code. This method will retrieve the value of the specified environment variable and store it in the xsid variable.
It is important to note that the getEnvStore().setEnv() method will only work if the ICX_SESSION_COOKIE_VALUE environment variable has been set in the environment where your code is running. If the variable has not been set, the setEnv() method will return null.
I hope this helps clarify how to retrieve the value of an environment variable using the getEnvStore().setEnv() method.
Oracle Tutorial, We have covered all Oracle articles which includes Oracle Database, Application, Framework, Oracle HRM, ADF Training and Financial Training. Further more we have queries and scripts for Oracle EBS Modules.
Showing posts with label OAF. Show all posts
Showing posts with label OAF. Show all posts
Thursday, 5 January 2023
Wednesday, 29 April 2020
Upload File to Application Server Oracle OAF
Upload-File-to-Application-Server-Oracle-OAF
This library is the step of our journey to build java based utilities, Use this Utilities and report if found any Bug.
Source is available here
Setup for Installation
Install OAF and configure its envirnoment as per your Oracle E-Buisness Suite.
Read Documentations: Documents.
Open This project in Oracle JDeveloper
OAF Current Row Values
Add Current Row Values in Event Parameters.
Parameters: Open dialog and add parameters by choosing your own Parameter name and its value from current row.
${oa.FileSetupVO1.SrlFileSetupId}
FileSetupVO1 is my view name
Tuesday, 21 April 2020
How to get Current Row in OAF
We can Get current Row Using findRowByRef method of ApplicationModule.
Here Example Code.
Code of my AM
UploadFileAMImpl am = (UploadFileAMImpl)pageContext.getApplicationModule(webBean);
Code of RowImp
FileSetupVORowImpl setupRow = (FileSetupVORowImpl) am.findRowByRef(pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE)) ;
findRowByRef is standard method that will return Current Rowimplement
.
Note: Your Action Type must be FireAction. findRowByRef will return null for firePartialAction.
Here Example Code.
Code of my AM
UploadFileAMImpl am = (UploadFileAMImpl)pageContext.getApplicationModule(webBean);
Code of RowImp
FileSetupVORowImpl setupRow = (FileSetupVORowImpl) am.findRowByRef(pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE)) ;
findRowByRef is standard method that will return Current Rowimplement
.
Note: Your Action Type must be FireAction. findRowByRef will return null for firePartialAction.
Thursday, 19 March 2020
Java File.deleteOnExit() method
- import java.io.File;
- import java.io.IOException;
- public class DeleteOnExitExample
- {
- public static void main(String[] args)
- {
- File temp;
- try
- {
- temp = File.createTempFile("abc", ".temp"); //creating a .temp file
- System.out.println("Temp file created at location: " + temp.getAbsolutePath());
- temp.deleteOnExit(); //delete file on runtime exit
- System.out.println("Temp file exists : " + temp.exists());
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- }
Get Current Row in OAF Button Event
private void DeleteEntryLines(OAPageContext pageContext, OAWebBean webBean)
{
EslFaVerifyLinesAllGViewImpl l_linesVO = this.getEslFaVerifyLinesAllGView1();
EslFaVerifyLinesAllGViewRowImpl l_Lines_Row = (EslFaVerifyLinesAllGViewRowImpl) this.findRowByRef(pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE));
l_Lines_Row.remove();
}
{
EslFaVerifyLinesAllGViewImpl l_linesVO = this.getEslFaVerifyLinesAllGView1();
EslFaVerifyLinesAllGViewRowImpl l_Lines_Row = (EslFaVerifyLinesAllGViewRowImpl) this.findRowByRef(pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE));
l_Lines_Row.remove();
}
Wednesday, 18 March 2020
Update file to server OAF java
public void uploadFileToServer(OAPageContext pageContext,String fileName,BlobDomain pBlobDomain)
{
try
{
File file = new File("/opt/apps/apps_st/comn/temp", fileName);
FileOutputStream output = new FileOutputStream(file);
for (int bytes = 0; bytes < pBlobDomain.getLength(); bytes++)
{
output.write(pBlobDomain.getInputStream().read());
}
System.out.println(" file writing");
output.close();
}
catch (Exception e)
{
e.printStackTrace();
throw new OAException(e.getMessage(),OAException.ERROR);
}
throw new OAException(("file size:"+pBlobDomain.getLength()),OAException.ERROR);
}
{
try
{
File file = new File("/opt/apps/apps_st/comn/temp", fileName);
FileOutputStream output = new FileOutputStream(file);
for (int bytes = 0; bytes < pBlobDomain.getLength(); bytes++)
{
output.write(pBlobDomain.getInputStream().read());
}
System.out.println(" file writing");
output.close();
}
catch (Exception e)
{
e.printStackTrace();
throw new OAException(e.getMessage(),OAException.ERROR);
}
throw new OAException(("file size:"+pBlobDomain.getLength()),OAException.ERROR);
}
Friday, 13 March 2020
load Files to Database Oracle
Upload-Files-to-Database-Oracle
This library is the first step of our journey to build java based utilities, Use this and report if found Bug.
Setup for Installation
Install OAF and configure its envirnoment as per your Oracle E-Buisness Suite.
Open This project in Oracle JDeveloper
Generate java Classes and configure to EBS Application. After this you will be able to upload files.
Source Link: Upload-Files-to-Database-Oracle
Thursday, 12 March 2020
Unable to create an entity object OAF
if Database objects are disable for selection in EO Window.
perform following setups
1)Re-Create Workspace with Oracle application settings and then try to create EO.
2) Go to tools/SQL Work sheet and then login to database, After this again try EO creation setups.
3) Set JDEV_USER_HOME environment variable as :\jdevhome\jdev,
perform following setups
1)Re-Create Workspace with Oracle application settings and then try to create EO.
2) Go to tools/SQL Work sheet and then login to database, After this again try EO creation setups.
3) Set JDEV_USER_HOME environment variable as :\jdevhome\jdev,
Now you should be able to create the Entity Object.
JDeveloper Screen display problems while scrolling
JDeveloper on Windows using a laptop had serious problems with the display when the IDE tried to scroll as it was leaving visible marks.
It ended up that the remedy was adding
AddVMOption -Dsun.java2d.noddraw=true
at the $JDEV_HOME/jdev/bin/jdev.conf
file.Tuesday, 3 December 2019
OAF Page to Upload Files into Server from local Machine
1. Create a New Workspace and Project
File > New > General > Workspace Configured for Oracle Applications
File Name – PrajkumarFileUploadDemo
Automatically a new OA Project will also be created
Project Name -- FileUploadDemo
Default Package -- prajkumar.oracle.apps.fnd.fileuploaddemo
2. Create a New Application Module (AM)
Right Click on FileUploadDemo > New > ADF Business Components > Application Module
Name -- FileUploadAM
Package -- prajkumar.oracle.apps.fnd.fileuploaddemo.server
Check Application Module Class: FileUploadAMImpl Generate JavaFile(s)
3. Create a New Page
Right click on FileUploadDemo > New > Web Tier > OA Components > Page
Name -- FileUploadPG
Package -- prajkumar.oracle.apps.fnd.fileuploaddemo.webui
4. Select the FileUploadPG and go to the strcuture pane where a default region has been created
5. Select region1 and set the following properties --
Attribute
|
Property
|
ID
|
PageLayoutRN
|
AM Definition
|
prajkumar.oracle.apps.fnd.fileuploaddemo.server.FileUploadAM
|
Window Title
|
Uploading File into Server from Local Machine Demo Window
|
Title
|
Uploading File into Server from Local Machine Demo
|
6. Create messageComponentLayout Region Under Page Layout Region
Right click PageLayoutRN > New > Region
Attribute
|
Property
|
ID
|
MainRN
|
Item Style
|
messageComponentLayout
|
7. Create a New Item messageFileUpload Bean under MainRN
Right click on MainRN > New > messageFileUpload
Set Following Properties for New Item --
Attribute
|
Property
|
ID
|
MessageFileUpload
|
Item Style
|
messageFileUpload
|
8. Create a New Item Submit Button Bean under MainRN
Right click on MainRN > New > messageLayout
Set Following Properties for messageLayout --
Attribute
|
Property
|
ID
|
ButtonLayout
|
Right Click on ButtonLayout > New > Item
Attribute
|
Property
|
ID
|
Submit
|
Item Style
|
submitButton
|
Attribute Set
|
/oracle/apps/fnd/attributesets/Buttons/Go
|
9. Create Controller for page FileUploadPG
Right Click on PageLayoutRN > Set New Controller
Package Name: prajkumar.oracle.apps.fnd.fileuploaddemo.webui
Class Name: FileUploadCO
Write Following Code in FileUploadCO processFormRequest
import oracle.cabo.ui.data.DataObject;
import java.io.FileOutputStream;
import java.io.InputStream;
import oracle.jbo.domain.BlobDomain;
import java.io.File;
import oracle.apps.fnd.framework.OAException;
import java.io.FileOutputStream;
import java.io.InputStream;
import oracle.jbo.domain.BlobDomain;
import java.io.File;
import oracle.apps.fnd.framework.OAException;
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{ super.processFormRequest(pageContext, webBean);
{ super.processFormRequest(pageContext, webBean);
if(pageContext.getParameter("Submit")!=null)
{
upLoadFile(pageContext,webBean);
}
}
{
upLoadFile(pageContext,webBean);
}
}
CODE #1 -- If Page has not deployed at instance, testing at Local Machine, use following Code
public void upLoadFile(OAPageContext pageContext,OAWebBean webBean)
{ String filePath = "D:\\PRajkumar";
System.out.println("Default File Path---->"+filePath);
{ String filePath = "D:\\PRajkumar";
System.out.println("Default File Path---->"+filePath);
String fileUrl = null;
try
{
DataObject fileUploadData = pageContext.getNamedDataObject("MessageFileUpload");
try
{
DataObject fileUploadData = pageContext.getNamedDataObject("MessageFileUpload");
//FileUploading is my MessageFileUpload Bean Id
if(fileUploadData!=null)
{
String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
String contentType = (String) fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
System.out.println("User File Name---->"+uFileName);
if(fileUploadData!=null)
{
String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
String contentType = (String) fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
System.out.println("User File Name---->"+uFileName);
FileOutputStream output = null;
InputStream input = null;
InputStream input = null;
BlobDomain uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, uFileName);
System.out.println("uploadedByteStream---->"+uploadedByteStream);
File file = new File("D:\\PRajkumar", uFileName);
System.out.println("File output---->"+file);
System.out.println("uploadedByteStream---->"+uploadedByteStream);
File file = new File("D:\\PRajkumar", uFileName);
System.out.println("File output---->"+file);
output = new FileOutputStream(file);
System.out.println("output----->"+output);
input = uploadedByteStream.getInputStream();
input = uploadedByteStream.getInputStream();
System.out.println("input---->"+input);
byte abyte0[] = new byte[0x19000];
int i;
while((i = input.read(abyte0)) > 0)
output.write(abyte0, 0, i);
byte abyte0[] = new byte[0x19000];
int i;
while((i = input.read(abyte0)) > 0)
output.write(abyte0, 0, i);
output.close();
input.close();
}
}
catch(Exception ex)
{
throw new OAException(ex.getMessage(), OAException.ERROR);
}
}
input.close();
}
}
catch(Exception ex)
{
throw new OAException(ex.getMessage(), OAException.ERROR);
}
}
CODE #2 -- If Page has been Deployed at Instance, Use Following Code
public void upLoadFile(OAPageContext pageContext,OAWebBean webBean)
{ String filePath = "/u01/app/apnac03r12/PRajkumar/";
System.out.println("Default File Path---->"+filePath);
{ String filePath = "/u01/app/apnac03r12/PRajkumar/";
System.out.println("Default File Path---->"+filePath);
String fileUrl = null;
try
{
DataObject fileUploadData = pageContext.getNamedDataObject("MessageFileUpload");
try
{
DataObject fileUploadData = pageContext.getNamedDataObject("MessageFileUpload");
//FileUploading is my MessageFileUpload Bean Id
if(fileUploadData!=null)
{
String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
String contentType = (String) fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
System.out.println("User File Name---->"+uFileName);
if(fileUploadData!=null)
{
String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
String contentType = (String) fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
System.out.println("User File Name---->"+uFileName);
FileOutputStream output = null;
InputStream input = null;
InputStream input = null;
BlobDomain uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, uFileName);
System.out.println("uploadedByteStream---->"+uploadedByteStream);
File file = new File("/u01/app/apnac03r12/PRajkumar", uFileName);
System.out.println("File output---->"+file);
System.out.println("uploadedByteStream---->"+uploadedByteStream);
File file = new File("/u01/app/apnac03r12/PRajkumar", uFileName);
System.out.println("File output---->"+file);
output = new FileOutputStream(file);
System.out.println("output----->"+output);
input = uploadedByteStream.getInputStream();
input = uploadedByteStream.getInputStream();
System.out.println("input---->"+input);
byte abyte0[] = new byte[0x19000];
int i;
while((i = input.read(abyte0)) > 0)
output.write(abyte0, 0, i);
byte abyte0[] = new byte[0x19000];
int i;
while((i = input.read(abyte0)) > 0)
output.write(abyte0, 0, i);
output.close();
input.close();
}
}
catch(Exception ex)
{
throw new OAException(ex.getMessage(), OAException.ERROR);
}
}
input.close();
}
}
catch(Exception ex)
{
throw new OAException(ex.getMessage(), OAException.ERROR);
}
}
10. Congratulation you have successfully finished. Run Your page and Test Your Work
Page has deployed and Used CODE #2
Before Upload the File
After Upload the File
Page has not been deployed and Used CODE #1
Before Upload the File
After Upload the File
Subscribe to:
Posts (Atom)
OADBTransactionImpl in Oracle Application Framework (OAF)
OADBTransactionImpl is a class in Oracle Application Framework (OAF), which is a framework for building Oracle E-Business Suite applications...
-
Create Type Loop_Type is table of Varchar2(400) Create or Replace Function Find_Loop_F (P_End_loop in NUmber Default 10) Return Loop_Typ...
-
//import oracle.cabo.ui.validate.Formatter; important Class for Formatting // Set Number fields Format public void se...
-
FND_PROFILE values: fnd_profile.value('PROFILEOPTION'); fnd_profile.value'MFG_ORGANIZATION_ID'); fnd_profile.value(...