Thursday 8 March 2012

How attach concurrent program to request group


BEGIN
FND_PROGRAM.add_to_group('XYZ_ABC_EMPLOYEE' -- program_short_name
, 'XYZ' -- application
, 'XYZ Group' -- Report Group Name
, 'XYZ'); -- Report Group Application

END;

example...
begin
FND_PROGRAM.add_to_group('XXPONEEDBY',
                         'Purchasing',
                         'Application Developer Reports',---request group name  FND_REQUEST_GROUPS
                         'Purchasing');
                         commit;
                         end;

OAF (Importing page and Application module in 11i)

1)Import Page from the bin  of jdev of jdeveloper9i
steps to remember --write the below code in single line only
import D:\JDEVELOPER9i\jdevbin\jdev\myprojects\xxtest\oracle\apps\per\selfservice\an_expense\webui\APPROVEREJECTPAGE.xml -username xxapps -password xxapps -rootdir D:\JDEVELOPER9i\jdevbin\jdev\myprojects\ -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.129.231.234)(PORT=1520))(CONNECT_DATA=(SID=XXDEV)))"

2)Importing Am from bin of jdev of jdeveloper9i
steps to remember --write the below code in single line only
import D:\JDEVELOPER9i\jdevbin\jdev\myprojects\xx1\oracle\apps\pos\suppreg\webui\xxeextendedRG.xml -username xxapps -password xxapps -rootdir D:\JDEVELOPER9i\jdevbin\jdev\myprojects\ -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xx.xxx.xxx.xxx)(PORT=1520))(CONNECT_DATA=(SID=xxxx)))"

OAF jpx remove Code for 11i

begin
jdr_utils.deleteDocument('/oracle/apps/pos/suppreg/server/customizations/site/0/SupplierRegAM');
end;

execute the above script by replacing  path of document and  finally commit 
commit;

OAF(How To Bounce 11i)

/u03/DEV/devcomn/admin/scripts/DEV_msftora2
no need to bounce OACORE server only need to bounce HTTP server...
adapcctl.sh stop
adapcctl.sh start

OAF(How To Bounce R12)

Environment File.......
cd $ADMIN_SCRIPTS_HOME
. APPSCLONE_trainingsrv.env
adapcctl.sh      -- for HTTP server .
adoacorectl.sh -- for OACORE server.

/u02/CLONE/inst/apps/CLONE_trainingsrv/admin/scripts

adapcctl.sh stop
adoacorectl.sh stop
adoacorectl.sh start
adapcctl.sh start

ADDING RESPONSIBILITY TO USER FROM BACKEND

begin
fnd_user_pkg.addresp(
        ‘&User_Name’, /*Application User Name */
        ‘&Responsablity_Application_Short_Name’, /*get from Query Below */
        ‘&Responsibility_Key’,/*get from Query Below */
        ‘&Security_Group’, /* Most of cases it is ‘STANDARD’ so you can hard code it */
        ‘&Description’, /* Any comments you want */
        ‘&Start_Date’, /* Sysdate From Today */
        ‘&End_Date’ ); /* Sysdate + 365 Rights for Next One Year*/
commit;
dbms_output.put_line(‘Responsibility Added Successfully’);
exception
        when others then
                dbms_output.put_line(‘ Responsibility is not added due to ‘ SQLCODE substr(SQLERRM, 1, 100));
                Rollback;
end;
 EXAMPLEEEE..................................


BEGIN
        fnd_user_pkg.addresp ('SYSADMIN','FND','FND_FUNC_ADMIN','STANDARD','Add Responsibility to USER using pl/sql',SYSDATE,SYSDATE + 100);
         COMMIT;
        DBMS_OUTPUT.put_line ('Responsibility Added Successfully');
EXCEPTION
        WHEN OTHERS
        THEN
        DBMS_OUTPUT.put_line (   ' Responsibility is not added due to '|| SQLCODE|| SUBSTR (SQLERRM, 1, 100));
        ROLLBACK;
END;

OAF Things to Remeber in Mind....

1)The Path to take DBC File from middle tier..
the DBC file is present at the application folder in the fnd TOP
/u03/FAUAT/fauatappl/fnd/11.5.0/secure/FAUAT_msftora2

2)query to find the responsibility key for creating OAF application

SELECT FAV.APPLICATION_SHORT_NAME, FAV.APPLICATION_NAME,FRV.RESPONSIBILITY_KEY, FRV.RESPONSIBILITY_NAME
FROM FND_APPLICATION_VL FAV, FND_RESPONSIBILITY_VL FRV
WHERE FRV.APPLICATION_ID=FAV.APPLICATION_ID and responsibility_name like '%Functional Administrator%'
ORDER BY FRV.RESPONSIBILITY_NAME ;

3)give the proper username and password  and give the responsibility short name and the responsibility key

4)give  proper database connection details
as
   1)  hostname
   2)  port
   3) SID or SERVICE NAME

OAF(mandatory who columns while creating table for oracle R12)

 CREATED_BY                      NUMBER(15),
  LAST_UPDATE_LOGIN               NUMBER(15),
  LAST_UPDATED_BY                 NUMBER(15),
  CREATION_DATE                   DATE,
  LAST_UPDATE_DATE                DATE);

OAF(mandatory who columns while creating table for oracle 11i)

  CREATED_BY              NUMBER,
  CREATION_DATE           DATE,
  LAST_UPDATED_BY         NUMBER,
  LAST_UPDATE_DATE        DATE,
  OBJECT_VERSION_NUMBER   NUMBER,
  LAST_UPDATE_LOGIN       NUMBER,

OAF(File Download from application server)


steps
1)create item as link or button or whatever u want which will fire after clicking or selecting
(here i have created button and event name is actionInMainSearchScreen )
2)make changes only at highlighted places

 import com.sun.java.util.collections.ArrayList;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.Date;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.sql.NUMBER;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.OARow;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.jbo.domain.Number;
import java.io.Serializable;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.OAException;
import oracle.cabo.ui.data.DataObject;
import java.io.FileOutputStream;
import java.io.InputStream;
import oracle.jbo.domain.BlobDomain;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import oracle.apps.fnd.common.URLTools;
import oracle.apps.fnd.common.WebAppsContext;
import oracle.apps.fnd.framework.server.OADBTransactionImpl;
import oracle.apps.fnd.framework.server.OAViewRowImpl;
import oracle.apps.fnd.framework.webui.beans.OABodyBean;
import oracle.jbo.AttributeDef;

 write the logic under the process form request  as actionInMainSearchScreen is the event name  and i have called the method    downloadFileFromServer(pageContext,"D:/c sharp development guide.pdf","c sharp development guide.pdf"); here  D:/c sharp development guide.pdf is the whole path of file to which u have to give access to download (u have to specify the path of server ) c sharp development guide.pdf is also the same name of file
if (actionInMainSearchScreen.equals("download"))
      {
          downloadFileFromServer(pageContext,"D:/c sharp development guide.pdf","c sharp development guide.pdf");
      }







public void downloadFileFromServer(OAPageContext pageContext,
    String file_name_with_path,
    String file_name_with_ext)
    {
    HttpServletResponse response =
    (HttpServletResponse) pageContext.getRenderingContext().getServletResponse();
    if (((file_name_with_path == null) ||
    ("".equals(file_name_with_path))))
    {
    throw new OAException("File path is invalid.");
    }

    File fileToDownload = null;
    try
    {
    fileToDownload = new File(file_name_with_path);
    }
    catch (Exception e)
    {
    throw new OAException("Invalid File Path or file does not exist.");
    }

    if (!fileToDownload.exists())
    {
    throw new OAException("File does not exist.");
    }

    if (!fileToDownload.canRead())
    {
    throw new OAException("Not Able to read the file.");
    }

    String fileType = getMimeType(file_name_with_ext);
    response.setContentType(fileType);
    response.setContentLength((int)fileToDownload.length());
    response.setHeader("Content-Disposition",
    "attachment; filename=\"" + file_name_with_ext +
    "\"");

    InputStream in = null;
    ServletOutputStream outs = null;

    try
    {
    outs = response.getOutputStream();
    in = new BufferedInputStream(new FileInputStream(fileToDownload));
    int ch;
    while ((ch = in.read()) != -1)
    {
    outs.write(ch);
    }

    }
    catch (IOException e)
    {
    // TODO
    e.printStackTrace();
    }
    finally
    {
    try
    {
    outs.flush();
    outs.close();
    if (in != null)
    {
    in.close();
    }
    }
    catch (Exception e)
    {
    e.printStackTrace();
    }
    }
    }

    /**
    * @param s
    * @return file mime type from its name
    */
    public String getMimeType(String s)
    {
    int i = s.lastIndexOf(".");
    if (i > 0 && i < s.length() - 1)
    {
    String s1 = s.substring(i + 1);
    if (s1.equalsIgnoreCase("amr"))
    {
    return "audio/amr";
    }
    if (s1.equalsIgnoreCase("mid"))
    {
    return "audio/midi";
    }
    if (s1.equalsIgnoreCase("mmf"))
    {
    return "application/vnd.smaf";
    }
    if (s1.equalsIgnoreCase("qcp"))
    {
    return "audio/vnd.qcelp";
    }
    if (s1.equalsIgnoreCase("hqx"))
    {
    return "application/mac-binhex40";
    }
    if (s1.equalsIgnoreCase("cpt"))
    {
    return "application/mac-compactpro";
    }
    if (s1.equalsIgnoreCase("doc"))
    {
    return "application/msword";
    }
    if (s1.equalsIgnoreCase("jsp"))
    {
    return "application/jsp";
    }
    if (s1.equalsIgnoreCase("oda"))
    {
    return "application/oda";
    }
    if (s1.equalsIgnoreCase("pdf"))
    {
    return "application/pdf";
    }
    if (s1.equalsIgnoreCase("ai"))
    {
    return "application/postscript";
    }
    if (s1.equalsIgnoreCase("eps"))
    {
    return "application/postscript";
    }
    if (s1.equalsIgnoreCase("ps"))
    {
    return "application/postscript";
    }
    if (s1.equalsIgnoreCase("ppt"))
    {
    return "application/powerpoint";
    }
    if (s1.equalsIgnoreCase("rtf"))
    {
    return "application/rtf";
    }
    if (s1.equalsIgnoreCase("bcpio"))
    {
    return "application/x-bcpio";
    }
    if (s1.equalsIgnoreCase("vcd"))
    {
    return "application/x-cdlink";
    }
    if (s1.equalsIgnoreCase("Z"))
    {
    return "application/x-compress";
    }
    if (s1.equalsIgnoreCase("cpio"))
    {
    return "application/x-cpio";
    }
    if (s1.equalsIgnoreCase("csh"))
    {
    return "application/x-csh";
    }
    if (s1.equalsIgnoreCase("dcr"))
    {
    return "application/x-director";
    }
    if (s1.equalsIgnoreCase("dir"))
    {
    return "application/x-director";
    }
    if (s1.equalsIgnoreCase("dxr"))
    {
    return "application/x-director";
    }
    if (s1.equalsIgnoreCase("dvi"))
    {
    return "application/x-dvi";
    }
    if (s1.equalsIgnoreCase("gtar"))
    {
    return "application/x-gtar";
    }
    if (s1.equalsIgnoreCase("gz"))
    {
    return "application/x-gzip";
    }
    if (s1.equalsIgnoreCase("hdf"))
    {
    return "application/x-hdf";
    }
    if (s1.equalsIgnoreCase("cgi"))
    {
    return "application/x-httpd-cgi";
    }
    if (s1.equalsIgnoreCase("jnlp"))
    {
    return "application/x-java-jnlp-file";
    }
    if (s1.equalsIgnoreCase("skp"))
    {
    return "application/x-koan";
    }
    if (s1.equalsIgnoreCase("skd"))
    {
    return "application/x-koan";
    }
    if (s1.equalsIgnoreCase("skt"))
    {
    return "application/x-koan";
    }
    if (s1.equalsIgnoreCase("skm"))
    {
    return "application/x-koan";
    }
    if (s1.equalsIgnoreCase("latex"))
    {
    return "application/x-latex";
    }
    if (s1.equalsIgnoreCase("mif"))
    {
    return "application/x-mif";
    }
    if (s1.equalsIgnoreCase("nc"))
    {
    return "application/x-netcdf";
    }
    if (s1.equalsIgnoreCase("cdf"))
    {
    return "application/x-netcdf";
    }
    if (s1.equalsIgnoreCase("sh"))
    {
    return "application/x-sh";
    }
    if (s1.equalsIgnoreCase("shar"))
    {
    return "application/x-shar";
    }
    if (s1.equalsIgnoreCase("sit"))
    {
    return "application/x-stuffit";
    }
    if (s1.equalsIgnoreCase("sv4cpio"))
    {
    return "application/x-sv4cpio";
    }
    if (s1.equalsIgnoreCase("sv4crc"))
    {
    return "application/x-sv4crc";
    }
    if (s1.equalsIgnoreCase("tar"))
    {
    return "application/x-tar";
    }
    if (s1.equalsIgnoreCase("tcl"))
    {
    return "application/x-tcl";
    }
    if (s1.equalsIgnoreCase("tex"))
    {
    return "application/x-tex";
    }
    if (s1.equalsIgnoreCase("textinfo"))
    {
    return "application/x-texinfo";
    }
    if (s1.equalsIgnoreCase("texi"))
    {
    return "application/x-texinfo";
    }
    if (s1.equalsIgnoreCase("t"))
    {
    return "application/x-troff";
    }
    if (s1.equalsIgnoreCase("tr"))
    {
    return "application/x-troff";
    }
    if (s1.equalsIgnoreCase("roff"))
    {
    return "application/x-troff";
    }
    if (s1.equalsIgnoreCase("man"))
    {
    return "application/x-troff-man";
    }
    if (s1.equalsIgnoreCase("me"))
    {
    return "application/x-troff-me";
    }
    if (s1.equalsIgnoreCase("ms"))
    {
    return "application/x-troff-ms";
    }
    if (s1.equalsIgnoreCase("ustar"))
    {
    return "application/x-ustar";
    }
    if (s1.equalsIgnoreCase("src"))
    {
    return "application/x-wais-source";
    }
    if (s1.equalsIgnoreCase("xml"))
    {
    return "text/xml";
    }
    if (s1.equalsIgnoreCase("ent"))
    {
    return "text/xml";
    }
    if (s1.equalsIgnoreCase("cat"))
    {
    return "text/xml";
    }
    if (s1.equalsIgnoreCase("sty"))
    {
    return "text/xml";
    }
    if (s1.equalsIgnoreCase("dtd"))
    {
    return "text/dtd";
    }
    if (s1.equalsIgnoreCase("xsl"))
    {
    return "text/xsl";
    }
    if (s1.equalsIgnoreCase("zip"))
    {
    return "application/zip";
    }
    if (s1.equalsIgnoreCase("au"))
    {
    return "audio/basic";
    }
    if (s1.equalsIgnoreCase("snd"))
    {
    return "audio/basic";
    }
    if (s1.equalsIgnoreCase("mpga"))
    {
    return "audio/mpeg";
    }
    if (s1.equalsIgnoreCase("mp2"))
    {
    return "audio/mpeg";
    }
    if (s1.equalsIgnoreCase("mp3"))
    {
    return "audio/mpeg";
    }
    if (s1.equalsIgnoreCase("aif"))
    {
    return "audio/x-aiff";
    }
    if (s1.equalsIgnoreCase("aiff"))
    {
    return "audio/x-aiff";
    }
    if (s1.equalsIgnoreCase("aifc"))
    {
    return "audio/x-aiff";
    }
    if (s1.equalsIgnoreCase("ram"))
    {
    return "audio/x-pn-realaudio";
    }
    if (s1.equalsIgnoreCase("rpm"))
    {
    return "audio/x-pn-realaudio-plugin";
    }
    if (s1.equalsIgnoreCase("ra"))
    {
    return "audio/x-realaudio";
    }
    if (s1.equalsIgnoreCase("wav"))
    {
    return "audio/x-wav";
    }
    if (s1.equalsIgnoreCase("pdb"))
    {
    return "chemical/x-pdb";
    }
    if (s1.equalsIgnoreCase("xyz"))
    {
    return "chemical/x-pdb";
    }
    if (s1.equalsIgnoreCase("gif"))
    {
    return "image/gif";
    }
    if (s1.equalsIgnoreCase("ief"))
    {
    return "image/ief";
    }
    if (s1.equalsIgnoreCase("jpeg"))
    {
    return "image/jpeg";
    }
    if (s1.equalsIgnoreCase("jpg"))
    {
    return "image/jpeg";
    }
    if (s1.equalsIgnoreCase("jpe"))
    {
    return "image/jpeg";
    }
    if (s1.equalsIgnoreCase("png"))
    {
    return "image/png";
    }
    if (s1.equalsIgnoreCase("tiff"))
    {
    return "image/tiff";
    }
    if (s1.equalsIgnoreCase("tif"))
    {
    return "image/tiff";
    }
    if (s1.equalsIgnoreCase("ras"))
    {
    return "image/x-cmu-raster";
    }
    if (s1.equalsIgnoreCase("pnm"))
    {
    return "image/x-portable-anymap";
    }
    if (s1.equalsIgnoreCase("pbm"))
    {
    return "image/x-portable-bitmap";
    }
    if (s1.equalsIgnoreCase("pgm"))
    {
    return "image/x-portable-graymap";
    }
    if (s1.equalsIgnoreCase("ppm"))
    {
    return "image/x-portable-pixmap";
    }
    if (s1.equalsIgnoreCase("rgb"))
    {
    return "image/x-rgb";
    }
    if (s1.equalsIgnoreCase("xbm"))
    {
    return "image/x-xbitmap";
    }
    if (s1.equalsIgnoreCase("xpm"))
    {
    return "image/x-xpixmap";
    }
    if (s1.equalsIgnoreCase("xwd"))
    {
    return "image/x-xwindowdump";
    }
    if (s1.equalsIgnoreCase("html"))
    {
    return "text/html";
    }
    if (s1.equalsIgnoreCase("htm"))
    {
    return "text/html";
    }
    if (s1.equalsIgnoreCase("txt"))
    {
    return "text/plain";
    }
    if (s1.equalsIgnoreCase("rtx"))
    {
    return "text/richtext";
    }
    if (s1.equalsIgnoreCase("tsv"))
    {
    return "text/tab-separated-values";
    }
    if (s1.equalsIgnoreCase("etx"))
    {
    return "text/x-setext";
    }
    if (s1.equalsIgnoreCase("sgml"))
    {
    return "text/x-sgml";
    }
    if (s1.equalsIgnoreCase("sgm"))
    {
    return "text/x-sgml";
    }
    if (s1.equalsIgnoreCase("mpeg"))
    {
    return "video/mpeg";
    }
    if (s1.equalsIgnoreCase("mpg"))
    {
    return "video/mpeg";
    }
    if (s1.equalsIgnoreCase("mpe"))
    {
    return "video/mpeg";
    }
    if (s1.equalsIgnoreCase("qt"))
    {
    return "video/quicktime";
    }
    if (s1.equalsIgnoreCase("mov"))
    {
    return "video/quicktime";
    }
    if (s1.equalsIgnoreCase("avi"))
    {
    return "video/x-msvideo";
    }
    if (s1.equalsIgnoreCase("movie"))
    {
    return "video/x-sgi-movie";
    }
    if (s1.equalsIgnoreCase("ice"))
    {
    return "x-conference/x-cooltalk";
    }
    if (s1.equalsIgnoreCase("wrl"))
    {
    return "x-world/x-vrml";
    }
    if (s1.equalsIgnoreCase("vrml"))
    {
    return "x-world/x-vrml";
    }
    if (s1.equalsIgnoreCase("wml"))
    {
    return "text/vnd.wap.wml";
    }
    if (s1.equalsIgnoreCase("wmlc"))
    {
    return "application/vnd.wap.wmlc";
    }
    if (s1.equalsIgnoreCase("wmls"))
    {
    return "text/vnd.wap.wmlscript";
    }
    if (s1.equalsIgnoreCase("wmlsc"))
    {
    return "application/vnd.wap.wmlscriptc";
    }
    if (s1.equalsIgnoreCase("wbmp"))
    {
    return "image/vnd.wap.wbmp";
    }
    if (s1.equalsIgnoreCase("css"))
    {
    return "text/css";
    }
    if (s1.equalsIgnoreCase("jad"))
    {
    return "text/vnd.sun.j2me.app-descriptor";
    }
    if (s1.equalsIgnoreCase("jar"))
    {
    return "application/java-archive";
    }
    if (s1.equalsIgnoreCase("3gp"))
    {
    return "video/3gp";
    }
    if (s1.equalsIgnoreCase("3g2"))
    {
    return "video/3gpp2";
    }
    if (s1.equalsIgnoreCase("mp4"))
    {
    return "video/3gpp";
    }
    }
    return "application/octet-stream";
    }

OAF(File upload to application server)

Following is the code which u have to written in Controller class
steps to follow 
1) create one item on page as  type messagefileupload
2)and call the method  from any event
uploadFileToServer(pageContext,"item2","/u03/DEV/devcomn/java");
3) and simply make changes as change the item2  and the path that is highlighted
(you can check it by changing the path to local system as "D:/new folder/") this is for testing 

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import java.io.Serializable;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.OAException;
import oracle.cabo.ui.data.DataObject;
import java.io.FileOutputStream;
import java.io.InputStream;
import oracle.jbo.domain.BlobDomain;
import java.io.File;

in process form request write under  event
{
 uploadFileToServer(pageContext,"item2","/u03/DEV/devcomn/java");
}

public void uploadFileToServer(OAPageContext pageContext,
String fileuploadBeanId,
String server_dir_path)
{
DataObject fileUploadData =
(DataObject) pageContext.getNamedDataObject(fileuploadBeanId);
if(fileUploadData!=null)
{
String uFileName =
(String) fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
String contentType =
(String) fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");

File file = new File(server_dir_path, uFileName);
FileOutputStream output = null;
InputStream input = null;
try
{
output = new FileOutputStream(file);
BlobDomain uploadedByteStream =
(BlobDomain) fileUploadData.selectValue(null, uFileName);
input = uploadedByteStream.getInputStream();
for (int bytes = 0; bytes < uploadedByteStream.getLength(); bytes++)
{
output.write(input.read());
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
try
{
if (input != null)
{
input.close();
}
if (output != null)
{
output.close();
output.flush();
}
}
catch (Exception ez)
{
ez.printStackTrace();
}
}

}
}

steps to remember
-1)always check the item id of messagefileupload item  and change at highlighted  item2 place
2)sometimes the u are unable to store the file at application server because u dont have full access to create or write any thing on server so check with DBA and told him give the full access rights to the folder.