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.

Similar Messages

  • 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 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

  • I am trying to upload a file to an accounting website for work. It will not allow me to select any type of file, they are all greyed out.

    I am trying to upload a file to an accounting website for work. My computer will not allow me to select any type of file, they are all greyed out.

    Try using a different browser. If it works, then the problem is most likely Safari. If the other browser doesn't work, perhaps it is the web site.
    Firefox

  • 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 can I attach any type of file in forms runtime

    Hi Friends,
    I need some help from any one of you.
    Is there any possibility to attach any type of file in forms runtime?
    If there is, how can. Please let me know the code.
    Thanks

    I think that you are going to have to explain what you want to do more clearly...

  • While downlaoding any type of file instead of showing the file size 'unknown time remaining' is showing?

    While downlaoding any type of file instead of showing the file size 'unknown time remaining' is showing? Please suggest solution to these problems?

    I followed ALL the Above suggestions to NO AVAIL!
    When I start a download, if I then Click PAUSE, it WILL NOT CANCEL & IT WILL NOT RESUME, just sits there stating "unknown time remaining"
    and I CAN'T GET RID OF IT!
    It would seem that Something Changed with the latest Firefox Beta Update that is causing this Anomalie.. Please FIX ASAP as I find this Very Annoying.
    With ANY Download in Limbo the Firefox Taskbar Icon displays a Partial Download Progress THAT NEVER CHANGES and I can not tell what Other Downloads are doing - It also Warns me that X-Number of Downloads are Still Pending when I go to Close Firefox, but as I stated, these Downloads are DOING NOTHING & CAN'T BE REMOVED!
    HELP! - BJ

  • Whenever I open a file of any type, that file will open, as well as multiple other files I do not wish to open.  How do I prevent this from happening.

    Whenever I try to open a file of any type, that file will open, as well as several other files I do not wish to open.  How do I prevent this from happening?

    Dealing With The Resume Feature of Lion
    Managing Mac OS X Lion's application resume feature.
    If you shutdown your computer you should get a dialog asking if you want applications to resume on the next startup. Simply uncheck the box to prevent that from occurring. Open General preferences and uncheck the option to Restore windows when quitting and re-opening apps. You can also install a third-party utility to control resume features on individual applications: RestoreMeNot or Application State Cleaner.
    It is possible to completely stop the Resume feature although I'm unconvinced that it is that annoying. Nevertheless see the following:
    If you have not yet done so you must first make your /Home/Library/ folder visible. Open the Terminal application in the Utilities folder. At the prompt paste the following command line:
    chflags nohidden ~/Library
    Press RETURN. Quit the Terminal application.
    In the Finder navigate to the /Home/Library/Saved Application State/ folder. Delete the contents of the folder. Back up to the /Home/Library/ folder. Select the Saved Application State folder. Press COMMAND-I to open the Get Info window. In the Sharing and Permissions panel at the bottom click on the lock icon and authenticate. Set each of the listed entries to Read Only. Close the Get Info window.
    Quit all open programs except the Finder (this is very important.) Next, navigate to the /Home/Library/Preferences/ByHost/ folder. Look for a .plist file with "com.apple.loginwindow." in the file name followed by some numbers in hexadecimal. Select the file. Press COMMAND-I to open the Get Info window and in the Sharing and Permissions panel click on the lock icon and authenticate. Set each of the listed entries to Read Only. Close the Get Info window. If you also find a file with the same filename but with a last extension of ".lockfile," then you should delete it.
    The above should eliminate the Resume feature system-wide. Note that any future system updates or upgrades will likely undo these changes. You will then need to repeat this procedure assuming there are no major changes in OS X related to it.

  • My firefox 17.0.1 on Win 7 64 bit SP1 still crashes when I download ANY type of file EVEN browser.download.manager.scanWhenDone is false ... WHY ???

    my firefox 17.0.1 on Win 7 64 bit SP1 still crashes when I download ANY type of file EVEN browser.download.manager.scanWhenDone is false ... WHY ???

    If that plugin isn't working properly then its developer needs to fix this via an update.
    Try to ask advice at the Free Download Manager forum
    *http://www.freedownloadmanager.org/board/

  • 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

  • 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.

  • 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

  • Identifying the correct MIME type for file uploads

    How does Apex identify the MIME type of an uploaded file? I have a page that uploads a file and accesses it via APEX_APPLICATION_FILES. That works fine. The problem is that, for certain file types, the mime_types column is "application/octet-stream" instead of the correct file type. I think it's using the Content-Type from the client browser, though I'm not quite sure. Is there any way to override this server-side in Apex?
    I'm running Apex with mod_plsql. Adding an AddType directive to Apache and adding the correct association to the mime.types file did not work.

    Hi,
    I also noticed this - it seems that Microsoft's 4 char extensions like .docx are not being recognized by application type so that either the web server or mod-plsql is defaulting to the "application/octet-stream" mime type which refers to a file with binary content - instead of the traditional "application/msword" mime type you would expect.
    If you know, at the point of insert into your database table, both the mime type and file name, one workaround would be to check if the mime type is 'application/octet-stream' and the file's extension is ".docx" or other likely extensions and then treat it as mime type 'application/msword", etc.
    Not really a solution but might be sufficient workaround depending on your situation.
    Ted
    Edited by: Ted Martin on Oct 25, 2012 7:27 PM

  • Unable to save ANY types of files in Elements 5.0

    Today I was working with Elements, creating a photomanipulation. This involved several layers, including a background of a beach, a horse, and some text. I've done this before with this exact same program on this exact same computer and not had too many problems. But not today.
    Today when I try to save my creation, in ANY format, I get this message:
    Could not save as
    "C:\Users\User\...\Untitled-1.jpg" because the file is already in use or was left open.
    GAHH!!!! Well of COURSE the stupid file is open, I'm working ON IT and trying to save my work!!! If I try to close the file, I get the standard question:
    Save changes to the Adobe Photoshop Elements document "Untitled-1" before closing?
    to which if I say yes, I get the same old crap:
    Could not save as
    "C:\Users\User\...\Untitled-1.jpg" because the file is already in use or was left open.
    Now if I select save as *PSD or *PDD, *SOMETIMES* it acts like it has saved my work, (Instead of just saying it can't) but when I look for what I saved, all I find are a bunch of crap files that can't be opened. Example:
    Cannot open 'C:\Users]User\Pictures\Photo Manips\~ps2AA0.tmp' because it is the wrong type of file.
    Please note that I never actually chose to save ANY files called ~ps2aa0.tmp at any point in this process.
    So I am stuck in a vicious cycle where before everything was working just fine. And it's not just editing photos or doing manipulations. I can take a brand new blank canvas, scribble a line on it with a paintbrush, and I am completely and totally unable to save even the simplest thing in ANY format whatsoever.
    I tried uninstalling Elements and reinstalling it and that did absolutely nothing, except cause me to lose all the special effect brushes I spent hours downloading. And when I started it back up, I was right where I was before, it even had the same custom color preloaded on the palette, as if it did not truly uninstall AT ALL. (Just the special brushes were missing, thanks for nothing!)
    My computer is maybe 8 months old now, a nice Hewlitt Packard with Vista. I specifically bought this computer so I could do more things with my art and more photos, and the first thing I loaded on it was the Bamboo tablet by Wacom, which came with Photoshop Elements 5.0 free. I've been using it ever since with hardly a problem and now today, I can't save the simplest little thing, and it is really aggravating me to death.
    ANY light that anyone could shed on this would be most appreciated. I'm sure it's something extremely stupid, like I found the secret invisible "do not save anything ever again" button and somehow managed to press it. Whatever it is, I can not for the life of me figure out how to make it work like it's SUPPOSED to work. Somebody please help me before I go stark raving mad.

    Further note: I have uninstalled this stupid program now THREE different times, including using a registry cleaner, which then deleted my DVD drive, thankyouverymuch. And even after I got the DVD drive back so I could reinstall the program, it was like I'd never uninstalled it (with the exception of the custom brushes still being missing) right down to the canvas size and paint color I had been using when all this started.
    So uninstalling it does nothing, resetting preferences does nothing... I can not save my work, period. I've been fighting with this for about 8 hours and I am so frustrated I could just throttle someone with my bare hands for putting me through this crap.
    For a product that came bundled with a $200 graphics tablet, it sure isn't worth a damn. Anybody got any ideas? I'm at my wits' end here.

  • How i can send an email with attachement of any type format file in form10g

    I developed an application in forms 10g my application send an email via outlook but i want to attach any type of PDF or WORD document how i can attach the file and send this
    email via outlook if any one know please share your valuable experience with me.
    Thanks.
    deemy

    Hello,
    There is a javamail bean in the Oracle Forms 10gR2 Demos available on OTN
    http://www.oracle.com/technology/sample_code/products/forms/index.html
    Francois

Maybe you are looking for