HI Masters , I need information for file upload program in web dynpro java

Hi masters,
       i need some inforamtion and documentation on file upload program in web dynpro java

Hi surya,
You can follow this procedure to upload the file
i) Take One Context Attribute named as "D1" of Type "binary".
ii) Take one FileUpload UI Element in the Layout Tab.
iii) Bind FileUpload UI Element's data Property to the taken Context Attribute. Here it is "D1".
iv) Take one Button UI Element in the Layout Tab named "Upload" and in the Action of that Button write the following Code.
v) The following code Generates one Folder in the Server & inside that Folder given file is Uploaded.
File ff=new File("FolderXYZ"); // Creates One Folder with the given Name ( Here Folder name is "FolderXYZ")
ff.mkdir();
try
byte b[]=null;
IWDAttributeInfo objAttinfo=null;
IWDModifiableBinaryType binType=null;
File f=null;
FileOutputStream fos=null;
if(wdContext.currentContextElement().getD1()!=null)
b=wdContext.currentContextElement().getD1();
objAttinfo=wdContext.getNodeInfo().getAttribute(IPrivateAttachView.IContextElement.D1);
binType=(IWDModifiableBinaryType)objAttinfo.getModifiableSimpleType();
f=new File(ff.getName()+"
"+binType.getFileName());
fos=new FileOutputStream(f);
fos.write(b);
fos.flush();
fos.close();
objMessageManager.reportSuccess("File uploaded to server");
} catch (Exception e)
objMessageManager.reportException("Unable to upload file to server, error is:"+e,false);
return;
The Uploaded file is stored in the folder & that folder is stored in the Server's following Path.
<Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0
You can access your Uploaded file from the following Path
<Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0\FolderXYZ
Regards
Sagar Ingalwar

Similar Messages

  • File upload & download through web Dynpro

    Hai All,
         Now i am working in webDynpro 2.0.9. For file upload
    and download through webdynpro "resource" is used.But in my webdynpro version 2.0.9. "resource" is not possible.so tell me how to upload & download by using this version & what is the alternative way for this.
    Thanks in advance.
    Kindly Regards,
    s.v.selva bala

    HI,
    Try out this code :
    FileInputStream is = new FileInputStream(file);
          long length = file.length();
          byte[] bytes = new byte[(int)length];
          long bytesRead = is.read(bytes);
          if (bytesRead < length)
           throw new IOException("Could not completely read file "+file.getName());
          is.close();
    element.setDocumentContent(bytes);
    Create a context attribute of binary type and assign the read data to it and bind the dataSource property of your File Upload and Download properties to this context Attribute.
    Regards
    Sid

  • I Need Information Regarding File Upload?

    Where can I get information regarding the File uploading packages in Portal. Is there a specification I can get a hold of. I know such a package exists, as it is used by portal itself. I just need to know where I can get hold of information as to what it is called and how to invoke it.

    Suraj,
    The APIs to do file upload are not public as of yet. We are looking into the feature right now. Currently, the only supported method of file upload is using the Web Interface.
    You may find more information about this in the 9iAs Portal forum
    Sue

  • Need help for file upload - reposted for Steve Muench

    Hi Steve,
    I have been involved developing a web application that requires a file upload operation. I have studied your example on Upload Text File and Image Example in the Not Yet Documented ADF Sample Applications section. I got the file upload part worked but could not get the original file name to populate the name field..i.e. if I upload myFile.txt to the database, the name field will be myFile.txt (not the name enter by user). Is there a way to capture the filename info? or is it possible to do so within ADF framework? I am using ADF/Struts/JSP with ORDDoc data type. Thanks very much.
    Bill

    Hello Nani,
    You need to change any settings in 'FILE' transaction. This transaction is used to set up Logical file paths. ( In general it will be set already for your system).
    You can use the following code.
      DATA: LC_LOGICAL_FILENAME_EXPSRC LIKE RCGIEDIAL-IEFILE
                                                    VALUE 'EHS_IMP_SOURCES'.
      DATA:      L_EMERGENCY_FLAG            TYPE C.
      DATA:      L_FILE_FORMAT               LIKE FILENAME-FILEFORMAT.
      data : X_RCGIEDIAL LIKE  RCGIEDIAL occurs 0 with HEADER LINE.
      read the default pathname on application server
        CALL FUNCTION 'FILE_GET_NAME'
             EXPORTING
                CLIENT                  = SY-MANDT
                  LOGICAL_FILENAME        = LC_LOGICAL_FILENAME_EXPSRC
                  OPERATING_SYSTEM        = SY-OPSYS
                parameter_1             = ' '
                PARAMETER_2             = ' '
                USE_PRESENTATION_SERVER = ' '
                WITH_FILE_EXTENSION     = ' '
                USE_BUFFER              = ' '
             IMPORTING
                  EMERGENCY_FLAG          = L_EMERGENCY_FLAG
                  FILE_FORMAT             = L_FILE_FORMAT
                  FILE_NAME               = X_RCGIEDIAL-IEFILE
             EXCEPTIONS
                  FILE_NOT_FOUND          = 1
                  OTHERS                  = 2.
        write :/ 'file format', L_FILE_FORMAT,
               / 'file name', X_RCGIEDIAL-IEFILE.
    Thanks,
    Jyothi

  • Need information for file type conversion from Oracle

    Hi,
    I need a scenario where there is third party tool which supports file types (.lnb (Link Notebook Chart),.anb(Analyst Notebook Analytical Chart),.anx(Analyst Notebook Exchange Chart),.tcv(Text Chart Visualisation))
    I am having a Oracle database where I want to create a file from a Table so that the third party tool could understand
    the file supported types.
    Any help will be benefitial for me
    Thanks and Regards

    Hi,
    If I use as:
    DECLARE
    fileHandler UTL_FILE.FILE_TYPE;
    BEGIN
    fileHandler := UTL_FILE.FOPEN('test_dir', 'test_file.tcv', 'W');
    UTL_FILE.PUTF(fileHandler, 'Writing TO a file\n');
    UTL_FILE.FCLOSE(fileHandler);
    EXCEPTION
    WHEN utl_file.invalid_path THEN
    raise_application_error(-20000, 'ERROR: Invalid PATH FOR file.');
    END;
    If I use the file naming convention i.e extension type as .tcv will it support ?
    Thanks and Regards

  • Code for  File upload / down load from WD java application

    Hi experts ,
    I am creating a WD java application , I want to add Picture upload and piucture download ( from / To ) KM . I also want to specify the path ( where it has to be uploaded in KM ) and picture name . can i get any code so that i can use it in WD application .
    Regards
    Abhay

    First you need to make sure your web dynpro application has permissions to access the file in the first place, but you could use the standard java.io.File class:
    File file = new File("/path/file.sh");
    file.setExecutable(false);
    file.setReadable(false);
    file.setWritable(false);

  • To get content of file upload element in web dynpro

    Hi . . .
    h1 : how can i get the string content   (i.e., path of file) store in variable in web dynpro abap . . . .

    Hi . . .
    h1 : how can i get the string content   (i.e., path of file) store in variable in web dynpro abap . . . .

  • What is best practice for calling XI Services with Web Dynpro-Java?

    We are trying to expose XI services to Web Dynpro via "Web Services".  Our XI developers have successfully generated the WSDL file(s) for their XI services and handed off to the Web Dynpro developers.
    The Java developers put the WSDL file to their local PC's and import as "Adaptive Web Services" data models.  When the application is constructed and deployed to our development box, the application abends because the J2EE server on that box cannot locate the WSDL file at runtime (it was on the developers box at, say, "C:\temp\" and that directory does not exist on the dev server).
    Since XI does not have a way of directly associating the generated WSDL file to the XI service, where is the best place to put the WSDL so it is readable at design time and at run time?  Also, how do we reconcile that we'll have 3 WSDL files for each service (one for Dev, one for QA and one for Prod) and how is the model in Web Dynpro configured so it gets the right ome?
    Does anyone have any good guide on how to do this?  Have found plenty of "how to consume a Web Service in Web Dynpro" docs on SDN, but these XI services are not really traditional Web Services so the instructions break down when it comes time to deploy.

    HI Bob,
    As sometimes when you create a model using a local wsdl file then instead of refering to URL mentioned in wsdl file it refers to say, "C:\temp" folder from where you picked up that file. you can check target address of logical port. Due to this when you deploy application on server it try to search it in "c:\temp" path instead of it path specified at soap:address location in wsdl file.
    Best way is  re-import your Adaptive Web Services model using the URL specified in wsdl file as soap:address location.
    like http://<IP>:<PORT>/XISOAPAdapter/MessageServlet?channel<xirequest>
    or you can ask you XI developer to give url for webservice and username password of server

  • How to read a Properties Resource File in KM with Web Dynpro Java

    Hello all,
    I would like to store a resource file in KM and have my web dynpro application read that file at runtime.  Is this possible?  Any examples of how to achieve this?
    I hoping to be able to modify this resource file in KM to easily change certain behaviors in my webdynpro application.

    Thanks Naga Raju Meesala.
    How come all these methods are deprecated...getEP5User
    Also, since I am building a weddynpro DC, what is the proper way to include these jar files as Used DCs?
    Now proceed in the same way with the variable PORTAL_HOME and add the following .jar files:
    u2022 \lib\prtapi.jar The portal runtime APIs
    u2022 \portalapps\com.sap.portal.usermanagement\lib\com.sap.security.api.ep5.jar The user management APIs of the Enterprise Portal 5.0 are deprecated, but still in use in SAP NetWeaver 04
    u2022 \portalapps\com.sap.netweaver.bc.rf\lib\bc.rf.framework_api.jar KM Repository Framework APIs
    u2022 \portalapps\com.sap.netweaver.bc.rf.service\lib\bc.rf.global.service.urlgenerator_api.jar Repository Framework Utility: URL Generator
    u2022 \portalapps\com.sap.netweaver.bc.sf\lib\bc.sf.framework_api.jar Repository Framework: Repository Services
    u2022 \portalapps\com.sap.netweaver.bc.util\lib\bc.util.public_api.jar Repository Framework Utilities

  • URGENT! File Upload Utility or a Custom UI for File Upload is needed!

    Hi all,
    I'm trying to find or develop a file upload utility or custom user interface rather than editing and adding file type item to a page. There is a free portlet for file upload in Knowledge Exchange resources, but it is for 3.0.9 release. I'm using portal 9.0.2.
    I could not any sample about the new release. Also API such as wwsbr_api that is used to add item to content areas is out dated.
    I create a page with a region for "items". When "edit" page and try to add an "file" type item the generated url is sth like this;
    "http://host:7779/pls/portal/PORTAL.wwv_additem.selectitemtype****"
    After selecting item type as a simple file autogenerated url is sth. like ;
    "http://host:7779/pls/portal/PORTAL.wwv_add_wizard.edititem"
    I made search about these API but could not find anything (in PDK PL/SQL API help, too).
    I need this very urgent for a proof of consept study for a customer.
    Thanks in advance,
    Kind Regards,
    Yeliz Ucer
    Oracle Sales Consultant

    Answered your post on the General forum.
    Regards,
    Jerry
    PortalPM

  • BI IP --- Planning function for File Upload

    Hai All,
    In BI IP , When I am trying to load the data (text file) by using Planning function for File Upload. I am getting an error message When I am clicking on Update .
    Error Message : Inconsistent input parameter (parameter: <unknown>, value <unknown>).
    In Text file I am using Tab Separation for each value
    Anyone help me out.
    Thanks,
    Bhima

    Hi Bhima
    Try one of these; it should work:
    1. If you are on SP 14 you would need to upgrade to SP 15. It would work fine
    2. If not, then -
         a] apply note 1070655 - Termination msg CL_RSPLFR_CONTROLLER =>GET_READ_WRITE_PROVIDS
         b] Apply Correction Instruction 566059 [i.e: in Object - CL_RSPLFR_CONTROLLER GET_READ_WRITE_PROVIDS,
    delete the block: l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = p_infoprov ).
    and insert block - l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = i_infoprov ).
    Goodluck
    Srikanth

  • ALBPM 6.0 : The maximum size for file uploads has been exceeded.

    Hi,
    I use AquaLogic BPM Entreprise server to deploy my Process. When I try to publish a process on my server I get the following error:
    An unexpected error ocurred.
    The error's technical description is:
    "javax.servlet.jsp.JspException: null"
    Possible causes are:
    The maximum size for file uploads has been exceeded.
    If you are trying to publish an exported project you should publish it using the remote project option.
    If you are trying to upload the participant's photo you should choose a smaller one.
    An internal error has ocurred, please contact support attaching this page's source code.
    Has someone resolve it?
    Thank's.

    Hi,
    Sure you've figured this out by now, but when you get the "Maximum size for file uploads" error during publish consider:
    1. if your export project file is over 10mb, use "Remote Project" (instead of "Exported Project") as the publication source. That way when you select the remote project, you will point to ".fpr" directory of the project you are trying to publish.
    Most times your project is not on a network drive that the server has access to. If this is the case, upload the .exp file to the machine where the Process Administrator is running, then expand it in any directory (just unzip the file). Then, from the Process Administrator, use the option to publish a Remote Project by entering the path to the .fpr directory you just created when unzipping the project.
    2. Check to see if you have cataloged any jars and marked them as non-versionable. Most of the times the project size is big just because of the external jar files. So as a best practice, when you do a project export select the option "include only-versionable jars", that will get reduce the project size considerably (usually to Kb's). Of course you have to manually copy the Jar files to your Ext folder.
    hth,
    Dan

  • Validator for file upload component is not working !!

    This validator method for a file upload component is throwing a java.lang.NullPointerException.
    public void fileUpload1_validate(FacesContext context, UIComponent component, Object value) {
    long size= fileUpload1.getUploadedFile().getSize();
    if (size>65535){
    throw new ValidatorException(new FacesMessage("Your image is too big!"));
    Any help to solve this problem is very much appreciated.
    Thanks.

    Hi i have a fileUpload in a pop-up and the methods are :
    public void fileUpload1_validate(FacesContext context, UIComponent component, Object value) {
    try {
    com.sun.rave.web.ui.model.UploadedFile uploadedFile = ((Upload)component).getUploadedFile();
    long l_filesize = uploadedFile.getSize();
    if ( l_filesize > 1000000)
    throw new ValidatorException(new FacesMessage("File Size should be less than 1000000 bytes! It is" + l_filesize));
    else {
    String tipo = uploadedFile.getContentType();
    if ( tipo.compareTo("application/word") == -1 )
    if ( tipo.compareTo("application/rtf") == -1 )
    if ( tipo.compareTo("application/pdf") == -1 )
    throw new ValidatorException(new FacesMessage("Error : los tipos de archivo aceptados son PDF, WORD y RTF"));
    } catch (Exception ex) {
    this.mauvaisFichier = true;
    error(ex.getMessage());
    public String botonValidar_action() {
    if ( !this.mauvaisFichier )
    if ( this.fileUpload1.getUploadedFile() != null )
    if ( this.fileUpload1.getUploadedFile().getSize() > 0 )
    try {
    this.getSessionBean1().getComunicacion().setArchivo( new javax.sql.rowset.serial.SerialBlob(this.fileUpload1.getUploadedFile().getBytes() ) );
    this.getSessionBean1().getComunicacion().setTipoArchivo( this.fileUpload1.getUploadedFile().getOriginalName().substring(this.fileUpload1.getUploadedFile().getOriginalName().length() - 3 ) );
    } catch(Exception e){
    e.getMessage();
    return null;
    I have to put a boolean value because the first time, validation code doesn't function ( the method botonValidar_action() is called ) correctly. The error message appears but empty.
    If I try next time then it's ok.
    Thx for any issue.

  • Reading contents of uploaded excel file in web dynpro java

    Hi All.
    I am aware how to provide facility to upload files in web dynpro java. But my requirement is that on uploading a particular file (for eg. an excel file having 10 columns), I need to read the contents of that file and store it in a table in R/3.Can anyone suggest a way how I can read the contents of the uploaded file?
    Thanks and Regards,
    Saurabh.

    Hi.
    I am having the following requirement : I have a FileUpload UI element where user clicks Browse button, selects a file from the local system and presses a Upload button. Upon pressing Upload, the name of the selected file and the contents of the file should be shown.
    In the View context, I have two value attributes: FileName of type String and FileResource of type binary.
    This is the code that I have in the Upload button action handler :
      public void onActionUpload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload(ServerEvent)
        IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(
                 IPrivateReadExcelView.IContextElement.FILE_RESOURCE);
        IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)attributeInfo.
                 getModifiableSimpleType();
        IPrivateReadExcelView.IContextElement element = wdContext.createContextElement();
        String fname = binaryType.getFileName();
        wdComponentAPI.getMessageManager().reportSuccess("File selected - "+fname);  //Statement 1
         try {
              wdComponentAPI.getMessageManager().reportSuccess("Successful");    // Statement 2
              InputStream in = new FileInputStream(fname);
              HSSFWorkbook wb = new HSSFWorkbook(in);
              wdComponentAPI.getMessageManager().reportSuccess("Successful");    //Statement 3
              int sheetsNo = wb.getNumberOfSheets();
              for (int i=0;i<sheetsNo;i++) {
                   HSSFSheet sheet = wb.getSheetAt(i);
                   Iterator rowsNo = sheet.rowIterator();
                   while(rowsNo.hasNext()) {
                        HSSFRow rows = (HSSFRow)rowsNo.next();
                        Iterator colsNo = rows.cellIterator();
                        while(colsNo.hasNext()) {
                             HSSFCell cell = (HSSFCell)colsNo.next();
                             wdComponentAPI.getMessageManager().reportSuccess("File uploaded" +
                                  "successfully");
                             if(cell.getCellType()==1) {
                                  wdComponentAPI.getMessageManager().reportSuccess("00000"+
                                       cell.getStringCellValue());
                             else if(cell.getCellType()==0) {
                                  String str=""+cell.getNumericCellValue();
                                  wdComponentAPI.getMessageManager().reportSuccess("11111"+str);
         catch(Exception e) { wdComponentAPI.getMessageManager().raisePendingException();
        //@@end
    On pressing Upload button, name of selected file is being shown(Statement 1). I am also getting Statement 2 in the output. However I am not getting Statement 3 onwards.
    Where am I going wrong? Can anyone shed some light on this?

  • File Visibility in uploading the file using web DynPro java

    hello,
    i have gone through the tutorial " uploading & downloading the file using web DynPro java".
    the upload functionalty is working fine. but i need to know thw path where these files are getting uploaded ??
    Waiting for the reply..
    Regards,
    Viren Gupta

    Hi Viren,
    Are you are refering to the below tutorial for upload and download:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0e10426-77ca-2910-7eb5-d7d8982cb83f?QuickLink=index&overridelayout=true
    If yes, then answer is that the file is stored in the context of the application only as "com.sap.ide.webdynpro.uielement-definitions.Resource" object. Please read through the tutorial to understand the full process.
    WD doesn't really upload to server automatically unless there is any explicit code written. All it does is to store the file in a temp context which you can access and write your own code to store it in a particular location.
    Regards,
    Mahesh

Maybe you are looking for

  • I need to change the preferences in Adobe InDesign CS6, please HELP!!

    I have been trying to learn how to change the dimensions of a new document in preferences from picas (default), to inches. Everything I have found says that I need to go up to the menu bar, and choose InDesign>Preferences to change it, but I do not h

  • [Project Pro 2013] User Custom Field w/ Formula does not calculates on Group Tasks

    This issue happens only on Project 2013. When I make a formula (using Duration, Cost, Number, etc...) on a custom field and set "Use formula" option in "Calculation for task and group summary rows", works fine without groups, on resume tasks. But whe

  • 4620 Officejet All-in-one

    I am considering buying a Chromebook and it say the printer must be cloud capatible. What do I need to do to my HP Model 4620 Officejet All-in-one to make it work with a Chromebook?

  • (NOLOCK) is giving syntax error

    Hi, I have query which runs properly in 1 server and in the other server it gives syntax error because of (NOLOCK). When i remove (NOLOCK) its working fine. my query is a big one... But it is something like INSERT INTO @abc SELECT a.id,SUM(b.count) F

  • Purpose of ufs logging?

    Can someone explain the concept of ufs logging to me. Being a student of Oracle database administration, I learned the concept of logging changes in redo log files. Is this concept similiar to usf logging? Thanks.