File upload in WebDynpro

Hi,
How uploading of a file can be done in webdynpro.
I had a label 'File" with a text box and a browse button. I need to select a file and when I click the button the selected file should be attached. How we can do it in webdynpro?
Thank you

Hi Klaus,
do you know that there is a special Web Dynpro Java.
Regards
Gregor

Similar Messages

  • Excel File Upload In Webdynpro For ABAP

    Hi All,
    I have a doubt regarding EXCEL file upload for Webdynpro for ABAP.
    I am able to get the path of file using 'FILEUPLOAD' UI element.Now I need to upload the EXCEL file into ALV.I have tried out with GUI_UPLOAD and other excel upload function module.But these Function Module throws Dump.
    Can you please suggest how to go about it.It will be a great help if u can suggest any function module or method.

    Hi Amita,
    Insetad of using GUI_UPLOAD use 'HR_KR_XSTRING_TO_STRING'
    Here is the sample code,
    TYPES :BEGIN OF str_itab,
                  name(10) TYPE c,
                  age(10) TYPE c,
                 END OF str_itab.
    DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
           i_data TYPE STANDARD TABLE OF string,
                   lo_nd_sflight TYPE REF TO if_wd_context_node,
                    lo_el_sflight TYPE REF TO if_wd_context_element,
                    l_string TYPE string,
            fs_table TYPE str_itab,
                    l_xstring TYPE xstring,
    fields TYPE string_table,
    lv_field TYPE string.
    DATA : t_table TYPE if_main=>elements_data_tab,
    data_table TYPE if_main=>elements_data_tab.
      * get single attribute
    wd_context->get_attribute(EXPORTING name =  `DATASOURCE`  
                              IMPORTING value = l_xstring ).
    CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
    EXPORTING
    in_xstring = l_xstring
    IMPORTING
    out_string = l_string.
    SPLIT l_string  AT
    cl_abap_char_utilities=>newline INTO TABLE i_data.
      * Bind With table Element.
    LOOP AT i_data INTO l_string.
    SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE
    fields.
    READ TABLE fields INTO lv_field INDEX 1.
    fs_table-name = lv_field.
    READ TABLE fields INTO lv_field INDEX 2.
    fs_table-age = lv_field.
    APPEND fs_table TO t_table1.
    ENDLOOP.
    lo_nd_sflight = wd_context->get_child_node( 'DATA_TAB' ).
    lo_nd_sflight->bind_table( t_table1 ).
      ENDMETHOD.
    if correct give correct answer
    Thanks & Regards,
    Meenachi.R

  • How to Save a file uploaded in WebDynpro Java to Windows server

    Hi Guys,
    I need to save a file uploaded in WebDynpro Java to a location on one of my companys many internal Window servers but I cannot get it to work.  I do not get any errors with the following code, but NOTHING happens...  And when I check the folder it is still emply...  Please advise.  I am particularly not sure about specifying the Path syntax.  Also, I do have permission to write to this server.  Is it even possible to save to a Windows server from WebDynpro??
    //uploaded document already in context...
    byte[] file = element.getFileResource();
                //    get the size of the uploaded file  
                element.setFileSize(this.getFileSize(file));
                wdContext.currentContextElement().setFSize(this.getFSize(file)); 
                //    get the extension of the uploaded file       
                element.setFileExtension(binaryType.getMimeType().getFileExtension());
                String fName = wdContext.currentContextElement().getFName();
                String fExt = wdContext.currentContextElement().getFileExtension();
                String foName1 = "
    server01.w9\Files\P
    HRP_Attachments\" + fName + ".pdf";
                File f1 = new File(foName1);
                DataOutputStream dos1;
                dos1 = new DataOutputStream(new FileOutputStream(f1));
                dos1.write(file);
                dos1.flush();
                dos1.close();
    Edited by: christiaanp on Sep 30, 2011 8:07 AM

    Hi Christiaan,
    When specifying the path, make sure you escape the slashes
    So, when you would normally use something like
    \\server\path\file.txt
    in your code you must use it in the form:
    String fileName = "\\\\server\\path\\file.txt";
    Hope this helps!
    Robin van het Hof

  • File Upload Using WebDynpro

    Hi All,
    I want to upload single or multiple CSV files using a user interface written in WebDynpros. The files will then be parsed and converted to XML.
    I did something similar with jsps earlier but am not sure how to go about it with WebDynpros.
    If anyone has already done something similar then please share your views.
    Thanks in advance.
    Noaman

    Hi,
    check this link
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/web dynpro sample applications and tutorials.htm#ui
    File Upload/Download 23/30
    Tutorials will help you.
    Regards,
    RK

  • Problem facing with file upload in webdynpro

    hi
    this is sathya, i very thank ful  to your answers, coming to my problem
    i have written the code for file upload action method, in this below code there is no syntax problem.
    but there is a run time error , i.e convt_no_number
    kindly rectify that.
      data:  lt_final type table of zalvtab,
             ls_final type zalvtab,
             "t_table1 TYPE STANDARD TABLE OF str_itab,
             "fs_table TYPE str_itab,
             i_data TYPE STANDARD TABLE OF string,
             lo_nd_zalvtab TYPE REF TO if_wd_context_node,
             lo_el_zalvtab TYPE REF TO if_wd_context_element,
             l_string TYPE string,
             l_xstring TYPE xstring,
             fields TYPE string_table,
             lv_field TYPE string.
      DATA : t_table TYPE if_main=>elements_sel_node,
             data_table TYPE if_main=>elements_sel_node.
    " get single attribute
        wd_context->get_attribute(
           EXPORTING
           name =  `upload`
           IMPORTING
             value = l_xstring ).
      CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
        EXPORTING
          in_xstring = l_xstring
        IMPORTING
          out_string = l_string.
        SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE i_data.
    " Bind With table Element.
       LOOP AT i_data INTO l_string.
        SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
        READ TABLE fields INTO lv_field INDEX 1.
        ls_final-ebeln = lv_field.
         READ TABLE fields INTO lv_field INDEX 2.
        ls_final-ekorg = lv_field.
         READ TABLE fields INTO lv_field INDEX 3.
         ls_final-bukrs = lv_field.
         READ TABLE fields INTO lv_field INDEX 4.
         ls_final-ebelp = lv_field.
          READ TABLE fields INTO lv_field INDEX 5.
         ls_final-menge = lv_field.
         READ TABLE fields INTO lv_field INDEX 6.
         ls_final-netpr = lv_field.
         READ TABLE fields INTO lv_field INDEX 7.
         ls_final-aedat = lv_field.
         READ TABLE fields INTO lv_field INDEX 8.
         ls_final-waers = lv_field.
         READ TABLE fields INTO lv_field INDEX 9.
         ls_final-description = lv_field.
          APPEND ls_final  TO lt_final.
      ENDLOOP.
      lo_nd_zalvtab = wd_context->get_child_node( 'sel_node' ).
    lo_nd_zalvtab->bind_table( lt_final ).

    Hi Sathya,
             I guess you are trying to upload data from excel file(XLS format).
             If it is correct then you cannot do this in webdynpro, first you save the excel file as tab delimited.
             Open your excel file->save as->other formats->give file type as TEXT(Tab delemited).
             Now use this file to upload. It should work perfectly.

  • Flat File Upload from WebDynpro ABAP

    Hi,
    I am struggling to find a solution for this requirement and I hope I get some help from the Gurus here.
    I have to upload a ".csv" file from the WebDynpro application, and then store the data in the flat file in a Z# table.
    Can some one explain me how to go ahead with this requirement??
    Regards,
    Nadh

    Hi Nrisimhanadh Yandamuri  ,
    After reading the csv file using file up load you can use the following code to tranfer the same to an itab of your required format
        DATA : loc_conv TYPE REF TO cl_abap_conv_in_ce,
          var_string TYPE string.
    Convert XString to String
        CALL METHOD cl_abap_conv_in_ce=>create
          EXPORTING
            input       = item_content
            encoding    = 'UTF-8'
            replacement = '?'
            ignore_cerr = abap_true
          RECEIVING
            conv        = loc_conv.
    *Read the file contents
        TRY.
            CALL METHOD loc_conv->read
              IMPORTING
                data = var_string.
          CATCH cx_sy_conversion_codepage.
    *-- Should ignore errors in code conversions
          CATCH cx_sy_codepage_converter_init.
    *-- Should ignore errors in code conversions
          CATCH cx_parameter_invalid_type.
          CATCH cx_parameter_invalid_range.
        ENDTRY.
        SPLIT var_string AT crlf INTO TABLE it_string_tab.
    Regards
    Sarath

  • File upload in webdynpro java

    Hi, I have a reqirement where I have to upload the file ino server, and later user can down load the same from server.
    i have seen file upload and down load  example in SDN /docs/DOC-8061#15
    but here they are just displaying the name and other details of the file that is trying upload but they are not really uploading the file in to the server. can any one guide me how to upload the file and where does the uploaded file resides in the server once it is succeefully uploded.
    Regards,
    Venki.

    Hi Venki,
    The following is the Procedure to DownLoad File from the Server Path.
    1.) Take One Context Attribute named as "Texts" with Cardinality 0..n & Selection 0..1 & singleton = true .
    2.) Take Two Context Attributes named " FileName " & " urlValue " of type String Under above Node "Texts".
    3.) Bind Table UI Element & bind it's dataSource Property to the taken Context Node. Here it is "Texts".
    4.) Insert One Column to The Table UI Element.
    5.) Insert TableCellEditor( Take LinkToURL UI Element ).
    6.) Bind " Texts.urlValue " to the references Property of the LinkToURL UI Element.
    7.) Bind " Texts.FileName " to the text Property of the LinkToURL UI Element.
    8.) All The UpLoaded Files in the Folder "FolderXYZ" are appeared as rows in the Table.
    9.) Write the following code In the wdDoInit() Method of DownLoad View/After Upload Operation Performed.
         int count=0;
         WDWebResourceType obj=null;
         File folder=null;
         IWDMessageManager objMessageManager=wdComponentAPI.getMessageManager();
         folder=new File("FolderXYZ");  // The Folder Name which we gave in the Upload Code.
         File arr[]=folder.listFiles();
        if(arr==null)
              objMessageManager.reportWarning("No files exist in server.. Please Upload ");
              return;
         String str[]=new String(arr.length);
    Put Array brackets as it is a Array.
         String names[]=new String(arr.length);
    Put Array brackets as it is a Array.
         int c=0;
         for(int k=0;k<arr.length;k++)
           if(!(arr[k].isDirectory()))
               c++;
         int j=0;
         for(int i=0;i<arr.length;i++)
           try {
              if(!arr<i>.isDirectory())
                   FileInputStream fis = new FileInputStream(arr<i>);
                  FileChannel fc = fis.getChannel();
                   byte[] data = new byte((int)(fc.size()));
    Put Array  brackets as it is a Array.
                   ByteBuffer bb = ByteBuffer.wrap(data);
                   fc.read(bb);
                   IWDCachedWebResource objCachedWebResource = null;
                   if (data != null)
                     String sr[]=arr<i>.getName().split("
                     obj=new WDWebResourceType(sr[1],"html/"+sr[1],true);
                     objCachedWebResource = WDWebResource.getWebResource(data,obj);
                     objCachedWebResource.setResourceName(arr<i>.getName());
                   str[j]= objCachedWebResource.getAbsoluteURL();
                   names[j]=arr<i>.getName(); j++;
                   count++;
            }catch(Exception e)
                   objMessageManager.reportException("Unable to  get files from server "+e,false);
                   return;
         ArrayList al=new ArrayList();
         for(int k=0;k<count;k++)
              IPrivateHeaderDisplayView.ITextsElement test=wdContext.createTextsElement();
              test.setFileName(names[k]);
              test.setUrlValue(str[k]);
              al.add(test);
         wdContext.nodeTexts().bind(al);
         wdContext.currentContextElement().setVisibleCount(count);  
    With Regards,
    Roop Kumar.
    Edited by: Roop kumar Annavarapu on Sep 5, 2008 6:14 PM
    Edited by: Roop kumar Annavarapu on Sep 5, 2008 6:16 PM

  • File Upload in Webdynpro ABAP

    Hello,
    I would like upload a excel file in Webdynpro for ABAP and I get the data in a attribute in the context node.
    The data is there in Binary format.
    If it is possible to get the data in the ASC format like the function "ws_upload"?
    I had tested with the class "CL_GUI_FRONTEND_SERVICES" and
    the function "ws_upload" both don't work in Webdynpro for ABAP can anyone give me information's how to get the file data in a internal table.
    Regards
    Klaus

    Hi Klaus,
    do you know that there is a special Web Dynpro Java.
    Regards
    Gregor

  • .xls and .xlsx file upload in webdynpro

    Hi All,
    Its very urgent.Tried for many options, Searched the scn. But no result. None of them are consistent while uploading xls and xlsx file.
    Sometimes the same file is working garbage value and sometime is working fine.
    Even I tried using CL_FDT_XL_SPREADSHEET , but its always been caught by cx_fdt_excel_core.
    Could anyone suggest me what to do in this case, as my client is not agreeing to any other kind of file .

    Hi Prabhati,
         i had a similar requirement  but i was able to persuade my clients to use tab delimeted file(saved as xls).
    XLS and XLSX excel upload in WDA - webdynpro
    Thanks & Regards,
    Tashi

  • Excel or Any type of file upload in WebDynpro ABAP

    Hi All,
    I need to upload two files in my requirement, where one file is always going to be an excel sheet and another file could be of any type of file.
    I am using below code for cracking the same but it is not behaving the expected way. It is working fine for TXT, CSV and PDF file but not for XLS files.
      DATA: lc_file TYPE string.
    get element via lead selection
      lo_el_context = wd_context->get_element(  ).
    get single attribute
      lo_el_context->get_attribute(
    EXPORTING
          name =  `FILE_CONTENT`
    IMPORTING
          value = lv_file_content ).
      CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
        EXPORTING
          im_xstring  = lv_file_content
         im_encoding = 'UTF-8'
        IMPORTING
          ex_string   = lc_file.
    I would appreciate if any one could suggest me some other way to achieve the desired functionality.
    Regds,
    Ashish

    Hi,
    Please try to use the UI element "Office Control" of a web dynpro view.
    For more details, refer to the web dynpro component: IOS_TEST_HELLOWORLD_MS.
    Best regards,
    Shalini.

  • File Upload from Webdynpro to R/3 Server

    Hi all
    We have a scenario. In that we want to upload any type of file (can be .txt, .pdf, .doc, .xls, .jpg, .gif etc.) to the R/3 server. We r using a FileUpload UI Element.
    The problem is we want to pass the contents of the file (any type of file) to the rfc.
    If anybody  knows the solution for this please help us.
    (It will be of great help if u give the code)
    Thanks & Regards
    Aparnna

    Hi Aparna,
    It happens becuse u r trying to access the byte array of the file in a loop.
    For small file it will not make any pblm, but for for big files, the loop may have to iterate millions of times which result in server hang.
    So dont try to access the byte array in loop in ur code. Try to pass the byte array u r getting as whole to RFC.
    Regards
    Fahad Hamsa

  • Creating Progress Bar for File Upload

    Hi, I'm trying to implement a progress bar indicator for a file upload in WebDynpro, without very good results.
    I'm using a fileupload UI element, a TimerTrigger and a ProgressIndicator UI elements for this purpose.
    It seems that using the fileupload UI element the iview is locked during the file upload, and therefore it prevents for the timer triggered action to be performed (this action updates the progress bar).
    Additionally I havent been able to capture the transfered bytes from the upload. Maybe I'm using the wrong elements?
    How could I achieve this. Has anyone done it?
    I would really appreciate all the help I could get.
    Homer Vargas

    Hi,
    Can anyone please tell me the way to upload file from client system to server.
    The code i have is as follows:-
    Jsp:-
    function saveImage(){
         //projectname.javafilename
         var strStatus = "save";
         document.saveImageForm.action="/irj/servlet/prt/portal/prtroot/TestXML.TextImageLink?frmstatus="+ strStatus;
         document.saveImageForm.method="post";
         document.saveImageForm.submit();     
    <form name="saveImageForm" encrypt="multipart/form-data">
    <table width="388" cellpadding="1" cellspacing="1" bgcolor="#F0F0F0" border='0'>
           <tr>
                 <td><font color="blue" face="verdana" size="2">IMAGE:</font></td><td><input id="image" type="file" name="image" value=""/></td>
         </tr>
    <tr>
         <td><input type="submit" name="submit" value="Submit" onclick="saveImage();"/></td>
         </tr>
    </table>
    </form>
    now i am not getting what to write in java file
    using IPortalComponentRequest.
    Using the jsp file upload in tomcat is working but here it is not working
    please help meee
    Thanks in Advance
    Regards
    Sirisha

  • How to upload multiple files in Webdynpro using File upload Screen Element

    Hi Experts,
          Can anybody tell me how to upload multiple files/pdfs in webdynpro using file upload screen element, and also please tell me what is the maximum storage limit of RAWSTRING data type,Advance Thanks.
    Regards,
    Sandesh

    Hi Sandesh,
    this is simply not supported, not in WebDynpro nor in standard HTML.
    A workaround is to upload a ZIP with all files and on server side unpack the ZIP and operate on the single files.
    I hope it will  help u..
    ----------------------OR-------------------------
    As you know using File upload UI element we can upload only one file at a time. There may be a scenario where user may want to upload any no of files at a time which is not determined at design time. This can be acheived using the ACF UpDownload UI element which requires a security whiltelist to be created
    http://scn.sap.com/docs/DOC-2270
    ----------------------OR-------------------------
    You can use Table UI element.
    Regards,
    Deepak Singh

  • Reg File Upload Object in abap Webdynpro

    Hi Friends,
    Would like to enquire one doubt in the file upload object in abap webdynpro.
    By default when we press the browse button, near to the file name there is a button which shows the the file types like:
    ., *.html, ,gif,.jpeg etc.
    Is there any way we can control that, as i have an requirement where in to upload only certain extension types.
    thankyou.

    HI,
    I would suggest you to follow this approach :
    1. Create a Table in your View in which FileUpload is there.
    2. Populate this value with valid file extension.
    3. Make it invisible by default.
    4. Now when you have entered value in Fileupload and click on Ok button.
    5. Check whether Mimetype matches any value in Table.
    6. If it is invalid, Throw an error message and mke Table of Valid extension Visible.
    Sample code to have Table with Valid entries.
    types : begin of str,
                 valid_ext type string,
             end of str.
    data : wa type str,
              itab type table of str.
    wa-valid_Ext = 'EXL'.
    append wa to itab.
    wa-valid_ext = 'DOC'.
    append wa to itab.
    lo_nd->bind_Table( itab ).
    here lo_nd is your ref to node of Table having valid extensions.
    7. Bind this Table's Visible property wiht wdui_visiblity .
    8. Set it Visible - 02 , Inviisible - 01.
    I hope it is clear.

  • IMP:ClassCastException while using File upload UI in Webdynpro for java

    Hi All,
    I have used a FileUpload UI element in my screen , which is working fine for only the first time we upload a file. If we try to upload any file with out refreshing the application , a ClassCastException is being thrown. Please help me in resolving the issue.
    Thanks in advance.
    Srikanth

    Thank you!!
    1. But when i use the File Upload UI and try to use the 'data' property to retrieve the bytes i am getting a null pointer exception meaning the data is not being picked up by the UI even though browsed file has data.
    2. How I am I supposed to set the 'Resource' property while downloading a PDF which has UTF-16 text and picture??
    Note: I have done the same scenario using WD04 java without any trouble.
    reg
    vln

Maybe you are looking for

  • Why can't I print a photo package

    why can't I print a photo package

  • Creating Search prompt to display a particular record row

    Hi, I have a crystal report with an Excel sheet as my data source. I want to create a prompt which would ask for a certain value (say, "name") and when we enter a name (say "John") ; it will display the record row(age, income, savings, etc..) for the

  • When restoring ipod, recieve error message saying i dont have the resources

    When i try to restore the ipod to factory settings using the itunes summary tab. I recieve a message saying that i dont have the resources to restore. How do i restore the ipod without damaging it? Custom Build   Windows XP   High Spec Custom Compute

  • CRXI R2 and VS 2005 select expert

    Hello Every One, For our Project we use CR XI 2 and VS2005. We use ODBC connection to run the reports. At the time of designing the report i have added the paramter and filler to select expert. In our windows application I asses the parameter and ass

  • Jar file cryptation/decryptation

    Hi, I'm currently using Java Web Start for downloading components to the client. The jar files are signed, and I'm using a Certificate for the verification on the client side. My question is: is there a way to encrypt my jar-files and then decrypt th