Skip to Content

Requirement

In my Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache), we have seen how to pass data to an Excel File using MS-Excel formatting. There was another Web Dynpro Java a couple of weeks ago. This time, it was how to read data from an MS-Excel file.

There are Assessment for Excel Solutions in Java to do this. I used the jexcelapi which enables us to achieve this.

Pre-Requisites

  1. Web Dynpro Binary Cache
  2. File Upload – 1
  3. File Upload – 2

Setup

The setup is exactly the same as shown Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)

Implementation

To just demonstrate how this works , we need the following things:

Layout

  1. File Upload UI Element
  2. Upload Excel File Button UI Element – onAction -> Upload

Context Elements

  1. FileName – bound to File Upload UI Element property – fileName
  2. FileResource – bound to File Upload UI Element property – data

Code

onActionUpload

Output

Excel Sheet

image

Application

image

Output – Application

image

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. BingLin Zhong
    Hi
      I got the Exception at the sentence ‘IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();’
    The Exception as following message:
    java.lang.ClassCastException

        at com.pjs.proce.ProcessExcelView.onActionUpload(ProcessExcelView.java:240)
        at com.pjs.proce.wdp.InternalProcessExcelView.wdInvokeEventHandler(InternalProcessExcelView.java:146)
        at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
        at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
        at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)

    How to deal with this exception?
    Best regards,Lin

    (0) 
  2. Deepika Bulli
    Hi

    I was going through your blog and followed your procedure.

    I was getting following exception:
    java.lang.NoClassDefFoundError: jxl/Workbook; for the line “wb = Workbook.getWorkbook(bais);”

    I’ve tried setting classpath, yet I’m getting the above mentioned error.

    How can I resolve this issue?

    Thanks
    Deepika

    (0) 
      1. Deepika Bulli
        Hi
        Ya i have refered to your earlier Blog.I have downloaded the jxl.jar file and added it to the Project Libraries and also set it in the CLASSPATH parameter as CLASSPATH= C:\j2sdk1.4.2_08\jre\lib;C:\j2sdk1.4.2_08\lib\tools.jar;C:\j2sdk1.4.2_08\jre\lib\ext\jxl.jar;C:\j2sdk1.4.2_08\jre\lib\rt.jar

        But still i am getting the same exception java.lang.NoClassDefFoundError: jxl/Workbook; for the line “wb = Workbook.getWorkbook(bais);”

        I have checked the Forum but did not get the solution.

        Regards,
        Deepika

        (0) 

Leave a Reply