How to read the excel file using webdynpro abap?

Hi,
how to read and modify excel file using webdynpro abap?
Regards,
Pavani

For reading excel file follow the steps :
1. Use a File upload UI element and bind it with xstring.
2. Now your excel will be uploaded and stored in Xstring.
3. Convert Xstring to String data using FM 'HR_KR_XSTRING_TO_STRING'.
4. Now split the string at new line so as to make an internal table .
  Ex . SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE it_table.
  here it_table is type table of string.
5.now loop at the internal table and separate the content of this table separated by tab.
  Ex. SPLIT wa_table AT cl_abap_char_utilities=>horizontal_tab INTO TABLE it_new.
it_new type string_table.
6. For more info , refer this thread :
Re: How to upload excel file in Webdynpro application using ABAP

Similar Messages

  • How to read an excel file in webdynpro application

    Hello Experts,
    Can someone please tell me how to read an excel file in a webdynpro application?
    There is a tutorial for how to write contect into an excel, but i want to read the excel.
    Can someone help please !!
    Thanks and Kind regards,
    G.Singh.

    Hello Experts,
    I have done all the given above.
    I want to read a excel file from KM. My code is as below
    ResourceContext resourceContext = buildResourceContext();
    IResourceFactory resourceFactory = ResourceFactory.getInstance();
    RID pathRID = RID.getRID("/documents/ExcelReport.xls");     
    IResource resource =     resourceFactory.getResource(pathRID, resourceContext);
    Workbook wb = Workbook.getWorkbook(resource.getURI().getPath());
    Sheet sh = wb.getSheet(0);
    int columns = sh.getColumns();
    int rows = sh.getRows();
    wdComponentAPI.getMessageManager().reportSuccess(" Rows: " + rows);
    wdComponentAPI.getMessageManager().reportSuccess(" Columns: " + columns);
    This does not give me the excel file form the KM
    Can you please just what i can do at this point?
    Kind Regards,
    G Singh.

  • How to upload a pdf file using webdynpro abap

    Hi Experts,
    I need to upload pdf files using webdynpro abap.my question is where to upload this files and how to upload this files, and how to display this pdf file.
    Please Provide Requried Information.
    Waiting for Reply.
    Thanks & Regards.
    Bhushan.

    Hi,
    There is a UI element with the type 'File Upload'.
    You can use that in your view.
    For further details and coding, please refer to
    [http://www.****************/Tutorials/WebDynproABAP/Upload/Page1.htm]
    Hope this helps you.
    Regards,
    Dolly

  • How to extract the excel file using web dynapro

    Hi Expert,
       I want to know how to generate an excel file to extract the internal  data. Please give me your help.
      Thanks in advance.

    I think you you can use File download UI element. Refer following link for more info:
    [FileDownload|http://help.sap.com/saphelp_tm60/helpdata/en/09/a5884121a41c09e10000000a155106/content.htm]
    Regards,
    Saket

  • How can I read the EXCEL file while Program is running in background.

    Hi all Expert,
    How can I read the EXCEL file while Program is running in background.
    Thanks

    you need to place ur excel file on application server and follow this thread: Reading an Excel file from the application server?
    loots of information if you can search forum.. thanks

  • Problem in Uploading excel file using WebDynpro for Java

    Hi  All
    I have followed for Uploading excel file using WebDynpro for Java added by  Tulasi Palnati
    I done all, but I'm getting 500 Exception please contact u r system admin meag  at run time also  Jxl/Workbook class not found msag  but i downloaded Jxl.jar file and  there is no error signals  in coding part. How can I solve the Problem.
    Thanks
    Polaka

    Please ask the people in the Web Dynpro Java forum for a solution.

  • Reading/Writing .xlsx files using Webdynpro for Java

    Dear All
    I have a requirement to read/write excel files in .xlsx format. I am good in doing it with .xls format using jxl.jar. The jxl.jar doesn't support .xlsx format. Kindly help me in understanding how do I need to proceed on reading/writing .xlsx files using Webdynpro for Java.
    Thanks and Regards
    Ramamoorthy D

    i am using jdk 1.6.22 and IBM WebSphere
    when i use poi-3.6-20091214.jar and poi-ooxml-3.6-20091214.jar  to read .xlsx file. but i am getting following errors
    The project was not built since its classpath is incomplete. Cannot find the class
    file for java.lang.Iterable. Fix the classpath then try rebuilding this project.
    This compilation unit indirectly references the missing type java.lang.Iterable
    (typically some required class file is referencing a type outside the classpath)
    how can i resolve it
    here is the code that i have used
    public class HomeAction extends DispatchAction {
         public ActionForward addpage(
                             ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
                             throws Exception {     
                             String name = "C:/Documents and Settings/bharath/Desktop/Book1.xlsx";
               FileInputStream fis = null;
               try {
                   Object workbook = null;
                    fis = new FileInputStream(name);
                    XSSFWorkbook wb = new XSSFWorkbook(fis);
                    XSSFSheet sheet = (XSSFSheet) wb.getSheetAt(0);
                    Iterator rows = sheet.rowIterator();
                    int number=sheet.getLastRowNum();
                    System.out.println(" number of rows"+ number);
                    while (rows.hasNext())
                        XSSFRow row = ((XSSFRow) rows.next());
                        Iterator cells = row.cellIterator();
                        while(cells.hasNext())
                    XSSFCell cell = (XSSFCell) cells.next();
                    String Value=cell.getStringCellValue();
                    System.out.println(Value);
               } catch (IOException e) {
                    e.printStackTrace();
               } finally {
                    if (fis != null) {
                         fis.close();
                return mapping.findForward("returnjsp");

  • How to store a Excel document using Webdynpro

    Hi Folks,
    I need a Web application, where user will have an option of uploading an Excel file. Then the application should store  this file in application server in Excel format.
    Then I need another web application where, I will display a tabular structure with two date column and third column showing as a link to the file. Also this second application will have an option to save the file on desktop. I need a button to pass the data in this file to another program.
    Technical issues:
    I know how to read data from an excel by using Upload UI element. But how can I store the file on application server in excel format. And then how can I read the Excel file in such way that, I can show a link of this Excel file in a tabular structure displayed on a Webdynpro application.
    Please provide your valuable inputs on this technical issue.
    Regards
    PG

    Hi Thomas,
    Thanks for your suggestion.
    I will use open and transfer dataset to create and store the Excel sheet on application server.
    But in next application,  I need to show a Tabular structure with link to this Excel sheet. How can I achieve this target.
    Thanks
    Regards
    PG

  • How to upload an excel file using ABAP.

    Hi,
    Can anyone please help me in understanding how to upload an excel file using ABAP.
    Thanks!!

    http://diocio.wordpress.com/2007/02/12/sap-upload-excel-document-into-internal-table/
    check the link
    TYPES: Begin of t_record,
    name1 like itab-value,
    name2 like itab-value,
    age   like itab-value,
    End of t_record.
    DATA: it_record type standard table of t_record initial size 0,
    wa_record type t_record.
    DATA: gd_currentrow type i.
    *Selection Screen Declaration
    PARAMETER p_infile like rlgrap-filename.
    *START OF SELECTION
    call function ‘ALSM_EXCEL_TO_INTERNAL_TABLE’
    exporting
    filename                = p_infile
    i_begin_col             = ‘1′
    i_begin_row             = ‘2′  “Do not require headings
    i_end_col               = ‘14′
    i_end_row               = ‘31′
    tables
    intern                  = itab
    exceptions
    inconsistent_parameters = 1
    upload_ole              = 2
    others                  = 3.
    if sy-subrc <> 0.
    message e010(zz) with text-001. “Problem uploading Excel Spreadsheet
    endif.
    Sort table by rows and colums
    sort itab by row col.
    Get first row retrieved
    read table itab index 1.
    Set first row retrieved to current row
    gd_currentrow = itab-row.
    loop at itab.
      Reset values for next row
    if itab-row ne gd_currentrow.
    append wa_record to it_record.
    clear wa_record.
    gd_currentrow = itab-row.
    endif.
    case itab-col.
    when ‘0001&#8242;.                              “First name
    wa_record-name1 = itab-value.
    when ‘0002&#8242;.                              “Surname
    wa_record-name2 = itab-value.
    when ‘0003&#8242;.                              “Age
    wa_record-age   = itab-value.
    endcase.
    endloop.
    append wa_record to it_record.
    *!! Excel data is now contained within the internal table IT_RECORD
    Display report data for illustration purposes
    loop at it_record into wa_record.
    write:/     sy-vline,
    (10) wa_record-name1, sy-vline,
    (10) wa_record-name2, sy-vline,
    (10) wa_record-age, sy-vline.
    endloop.

  • Read an excel file using JSP in MII 12.1

    Hi,
    I want to read an excel file using jsp page. I dont want to use the UDS or ODBC for connecting to excel.
    I am trying to use org.apache.poi to read the excel file in jsp page.
    While running, its showing a compilation error "package org.apache.poi.hssf.usermodel does not exist"
    I have the jar files for it, where do we need to upload it so that jsp page works.
    Thanks a lot
    Regards,
    Neha Maheshwari

    The user doesn't want to save the excel file in server.
    I want to upload file and save its contents in database.
    I have the code to read and save excel data in database but not able to get the location to deploy the jar file.
    In general, if we are creating a jsp page in MII workbench which is using some jar file.
    Whats the location to upload this jar file so that the jsp page works correctly?

  • Problem in reading the excel file path in WINDOWs machine from UNIX environ

    Hello friends,
    My requirement is to read each row of the excel sheet and sent that row to the database. I have implemented it by using jxl and apache poi framework. locally in my WINDOWS machine it is working fine..
    But when i deploy the code in UNIX machine. My application runs on a Unix server , trying to read the excel file in WINDOWS environment. I am not able to retrieve the file path. for ex : C:\Documents and Settings\sabbanik\My Documents\KARUNAKAR\excel.xls
    I am getting error in this line
    workbook = Workbook.getWorkbook(filepath)
    Error message : input file not found.
    Thanks in advance..

    You said: I am getting error in this line workbook = Workbook.getWorkbook(filepath) >
    Based on this, I will assume you are trying to use OLE to access information about the Excel file. As mentioned by Andreas, your code will be executing on the server (Unix) and since Excel isn't on the server (and cannot be) an error will result. OLE can only be used in Windows environments (client or server). To access client side OLE calls and content, you need a java bean and Excel installed on the client machine. Oracle provides WebUtil as an option to writing your own Java Bean. To use this, you will need to be running Forms 10.1.2 or newer. Details can be found here along with a demo:
    http://www.oracle.com/technetwork/developer-tools/forms/webutil-090641.htm

  • How to read a text file using Java

    Guys,
    Good day!
    Please help me how to read a text file using Java and create/convert that text file into XML.
    Thanks and God Bless.
    Regards,
    I-Talk

         public void fileRead(){
                 File aFile =new File("myFile.txt");
             BufferedReader input = null;
             try {
               input = new BufferedReader( new FileReader(aFile) );
               String line = null;
               while (( line = input.readLine()) != null){
             catch (FileNotFoundException ex) {
               ex.printStackTrace();
             catch (IOException ex){
               ex.printStackTrace();
         }This code is to read a text file. But there is no such thing that will convert your text file to xml file. You have to have a defined XML format. Then you can read your data from text files and insert them inside your xml text. Or you may like to read xml tags from text files and insert your own data. The file format of .txt and .xml is far too different.
    cheers
    Mohammed Jubaer Arif.

  • How to read the properties file available in Server File structure in webdy

    hi all,
    I have developed one webdynpro application. In this application i need to access mdm server to continue. For getting the connection i need to pass the IP addresses.
    Can i have code  how to read the properties file which is residing in the server file. with out included along with the application. keeping some where in the file structure in the server. I want to read that properties file by  maintain the iP addresses and users in  properties file based on the key i want to read like below.
    servername="abcServer"
    username="john"
    password="test123"
    Please send me the code how to read this properties file from the file structure and how to read this values by key  in webdynpro application
    Regards
    Vijay

    Hi Vijay,
    You can try this piece of code too:
    Properties props = new Properties();
    //try retrieve data from file
    //catch exception in case properties file does not exist
    try {
             props.load(new FileInputStream("c:\property\Test.properties")); //File location
             String serverName = props.getProperty("servername"); //Similarly, you can access the other properties
             if(serverName==null)
               //....do appropriate handling
         }     catch(IOException e)
                   e.printStackTrace();
    Regards,
    Alka.

  • Read a excel file using swings

    Does anyone know about reading an excel file using swings?
    Right now, I am using com.f1j.ss.*. But looking for more examples like reading and writing a excel file.
    Please suggest me with some good examples?

    1- Swing allows you to design a graphical user interface (to display data from a db or excel file for example)
    2- [Here |http://www.rgagnon.com/javadetails/java-0516.html] several ways to read/write excel.

  • How to read the backup file of my own iphone...

    how to read the backup file of my own iphone... becase I'm running out of space in my iphone so  need to delete some photos. I wanna know do i have to copy photos to my computer or is it available in the back up file ????

    Always move (copy and delete) your photos from Camera Roll to your computer.
    Camera Roll is the digital camera card.

Maybe you are looking for

  • Multiple Thumb Slider with Multiple Track Colors

    Hi All, Does any one implemented a Multiple Thumb Slider component with Multiple Track Colors. Please find the screen shot of the component below which I am talking about. Any ideas or any link or sample source of code given would be highly appreciat

  • ALE Third Party Purchase

    Hi gurus, I tried to use item category ALES "ALE Third Party Purchase" in sales order and expected to have both purchase requsition and purchase order created when I saved sales order. It turned out only purchase requsition was created. Then I create

  • HiRes photos

    I have created photo pages using the conventional iPhoto / iWeb functionality. But my photos only load in low / med resolution when accessing the site. Can I provide an option for HiRes - large size - access to the photos?

  • What is the safest way to unlock my Iphone5

    I wish to switch to another phone supplier and I was wondering how and where can I unlock my Iphone 5 I was with Telus but switched to videotron.

  • Can't fill input fields for TableView - HELP!!!!

    Hi, I know this is probably a stupid question, but... I've created a value node and bound it to a table making all of the entries "InputField."  When I change the value and click into other cells, the original values re-appear! What am I doing wrong?