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.
Similar Messages
-
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 Di 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 read the excel file using webdynpro abap?
Hi,
how to read and modify excel file using webdynpro abap?
Regards,
PavaniFor 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 -
How to start to work on MDM JAVA API by using webdynpro for java
Hi all
I have basic idea on MDM business package thru portal by using standard iViews.
now i am planning to work on MDM JAVA APIs by using Webdynpro for Java as UI.
1) can you please share the required documents on the same. how to start working on this by using MDM JAVA APIs in webdynpro for java
2) what are the JARs files are required and how to integrate those jar files into webdynpro for java application.
3) is there any SDN help on MDM JAVA API with webdynpro for java? . can you please send the link on the same.
4) can you please help by providing sample code on how to use JAVA APIs for retrieving,deleting,inserting and Updating the data in the database.
if anybody helps on the same then it is the great help to me.
points are always rewardable...
Regards
Suresh babuHi Suresh,
You can have the MDM JAVA API javadocs from the link
http://help.sap.com/javadocs/MDM/SP06P2/index.html
There you can see a package named com.sap.mdm.examples.The classes in it contains some examples using which you can start understanding the code.
You need to have MDM JAR files for it. And these JAR files to be used at build time can be added to the project thru :-
Right click on project-> properties->Java Build Path - > Add external JARs
At run time you can add them the reference in
Right click on project-> properties->web dynpro references->library reference.
Thanks
Namrata -
Accessing knowledge management documents using webdynpro for java
Dear all,
iam having some documnets in KNLOWLEDGE MANAGEMENT documents folder in portal using webdynpro for java clicking on a link means perner(employee no) i should get that perpicular employee number documents.
examples documents are stored like this in knowledege management folder 20016319.pdf , 20016397.pdf , 20016398.
how to access those employee using webdynpro for java for perticular employee number if i want 20016319
Send me the code for above requirement and where i have to wrirte that code exactly
RegardsDear Kishore,
To get the Employee ID you have to create a Adaptive RFC Model (call BAPI) which will return you the employee pernr, for this
1. Create a model using : BAPI_EMPLOYEE_GETDATA
2. Get User ID using the code
public java.lang.String getUserID( )
//@@begin getUserID()
String userID = new String();
try
// getting Logged in userid
IWDClientUser myUser = WDClientUser.getCurrentUser();
userID = myUser.toString().substring(19).trim();
StringTokenizer filterdUID = new StringTokenizer(userID,")");
userID = filterdUID.nextToken();
catch (WDUMException e)
e.printStackTrace();
return userID;
//@@end
3. Execute the BAPI
public java.lang.String getEmployeeID( java.lang.String userID )
//@@begin getEmployeeID()
String employeeID = new String();
Bapi_Employee_Getdata_Input employeeData = new Bapi_Employee_Getdata_Input();
Bapi_Employee_Getdata_Output outData = new Bapi_Employee_Getdata_Output();
Bapip0105B comm = new Bapip0105B();
com.sap.aii.proxy.framework.core.AbstractList list = new Bapip0105B.Bapip0105B_List();
list.add(comm);
employeeData.setUserid(userID);
Calendar cal = Calendar.getInstance(Locale.UK);
Date date = new Date(cal.getTimeInMillis());
employeeData.setDate(date);
employeeData.setAuthority_Check("");
employeeData.setCommunication(list);
outData.addCommunication(comm);
wdContext.nodeBapi_Employee_Getdata_Input().bind(employeeData);
wdContext.nodeOutput_BAPI().bind(outData);
try
wdContext.nodeBapi_Employee_Getdata_Input().currentBapi_Employee_Getdata_InputElement().modelObject().execute();
wdContext.nodeOutput_BAPI().invalidate();
catch (WDDynamicRFCExecuteException e) {printMsg("Failed to Obtain Employee Data");
e.printStackTrace();
employeeID = wdContext.nodeBapi_Employee_Getdata_Input().nodeOutput_BAPI().nodeOrg_Assignment().currentOrg_AssignmentElement().getPerno();
return employeeID;
//@@end
Hope it Helps!!
Warm Regards
Upendra Agrawal -
Playing sound/beep on the handheld device using WebDynpro for Java (NW7.01)
Does anybody know if we could play sounds or beeps on the handheld device using WebDynpro for Java (NW7.01)? We have a client requirement to have the handheld device beeps/makes different kind of sounds after the goods receipt is posted. We are looking for a way to play the sounds thatu2019s saved on the deviceu2019s directory. Appreciate any suggestions or input.
Thank you!
TeerachaHi Terracha,
you can use bellow mentioned methods for playing a sound using javascript :
function playSound( url ){
document.getElementById("sound").innerHTML="<embed src='"+url+"' hidden=true autostart=true loop=false>";
or
https://github.com/admsev/jquery-play-sound
$.playSound('http://example.org/sound.mp3');
Hope that helps you as a workaround way.
Regards,
Srinivas Divakarla -
How to upload excel file in Webdynpro application using ABAP
Hi Experts,
Am developing a webdynpro application in which it will take an excel file as input and display the contents in the form of a table in output. I am able to upload tab delimited text file and populate the table using the below code but not able to do the same with .xls file. Pls let me know if I need to use a different function module for upload excel file.
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_data = wd_context->get_child_node( 'DATA_TAB' ).
lo_nd_data->bind_table( T_TABLE1 ).
Thanks,
SubathraDear Exports
Can anyone guide me how to uplode the .xlsx or ..xls formatted excel file using abap webdynpro without converting it to .txt file. Because my client requirement is only to upload the excel file. because to convert the .xlsx flie to .txt file it will be time taking and cost expanssive. Another requirement is suppose today i have create a application for uploading a file which has 8 columns and 10 rows. suppose tomorrow the client will make some changes in that flat file means the client will add 2 extra columns and 10 more columns in that fil. and will upload that file. Then the new file will be display on the browser or old file. but my requirement is to display the new file in browser.
Can anyone kindly help to solve my problem. I am completely fresher in this field and I need to do it as soon as possible. Please help to solve the problem.
Regards
Rashmita -
Problem in uploading a file using Ws_upload.
Hi Experts,
I am using WS_UPLOAD for uploading .xls file into SAP Standard table T558A.
Problem is file is not uploaded to DB table.....getting error like
ERROR DURING FILE UPLOAD/DOWNLOAD as pop up message.....
can any boady please help on this issue.
Regards,
Praveena.Hi,
If you want to upload the data using EXCEL file use the function module ALSM_EXCEL_TO_INTERNAL_TABLE.
Examples for ALSM_EXCEL_TO_INTERNAL_TABLE.
http://wiki.sdn.sap.com/wiki/display/Snippets/Howtouse+FM'ALSM_EXCEL_TO_INTERNAL_TABLE' -
Uploading Excel file using 'ALSM_EXCEL_TO_INTERNAL_TABLE'
Hi,
I am uploading excel file into an internal table using 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.
but I'm getting a popup with the message
'There is a large amount of the information on the clipboard. Do you want to be able to paste this information into another programme later.' and there are three buttons in the popup 'YES', 'CANCEL' and 'NO'. but for any choice there is no data in the internal table.
the progrsm is working in other systems but giving problem in customer laptop, can you please tell me is there any settings need to set for EXCEL or SAP.
system details are as below
OS: windows 7
MS-Office - 2007
SAP : ECC06Looks like there was an intention to clear the clipboard in the code, but this does not seem to work.
I copied the function module to my own version and added the following code, which seems to work :
* clear clipboard
refresh excel_tab.
call method cl_gui_frontend_services=>clipboard_export
importing
data = excel_tab
changing
rc = ld_rc
exceptions
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
others = 4
* Copy only one cell to prevent the clipboard data message.
call method of worksheet 'Cells' = h_cell
exporting #1 = 1 #2 = 1.
m_message.
call method of worksheet 'Cells' = h_cell1
exporting #1 = 1 #2 = 1.
m_message.
call method of worksheet 'RANGE' = range
exporting #1 = h_cell #2 = h_cell1.
m_message.
call method of range 'SELECT'.
m_message.
* copy marked area (whole spread sheet) into Clippboard
call method of range 'COPY'.
m_message.
* quit Excel and free ABAP Object - unfortunately, this does not kill
* the Excel process
call method of application 'QUIT'.
m_message. -
Problem while uploading excel file to server
Hello,
I have created an excel file using OLE and saved it to local desktop. Then I use GUI_UPLOAD to upload the excel into SAP and attach it to mail. but while using Function GUI_UPLOAD I am getting dump for CNTL_ERROR.
If I skip the process of excel creation by OLE and passes the excel file created earlier then it gives no dump and is executed successfully.
Kindly help on this.Hi Suchendar,
Try using the FM - F4_FILENAME to get the valid file name and use TEXT_CONVERT_XLS_TO_SAP FM to upload into SAP based on the required format.
Regards,
Suresh -
Problem in connecting to database from webdynpro for java
Hi
I have a problem in connecting to database from webdynpro application
I am using oracle 10 express edition as database and was able to connect to database from a java application.But was unable to connect from a webdynpro for java.
<b>I guess webdynpro for java uses open sql instead of vendor sql(I looked in the visual admin ,DB is using open sql) so unable to connect to database.Am i right.?</b>
Do i need to make any settings in the visual admin to make it work?
How to solve this problem.Please give me pointers
Thanks
BalaHi,
For connecting to Oracle, either you can use the normal JDBC connectivty code directly which is given below :
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@Oracle_server_ip:Oracle port:SID of the Database","user_name","password");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("your query");
In case you want to fetch data through ejbs, these are the steps to be followed :
1) Open the J2EE perspective
2) Create an EJB Module project
3) Right click on ejbModule, create a new EJB (select your EJB type)
4) While creating the ejb itself, you can add business methods by clicking Next in the UI. Another option is after creating the ejb, write the method in the bean, then select the method from ejb-jar.xml -> <bean name> ->method. Right click and select propogate to local & remote.
5) Double click on ejb-j2ee-engine.xml. select your bean and specify a Jndi name for eg: MyJndi.
6) Right click on the EJB project and add classes12.zip file (provided by Oracle) to its build path. (under libraries tab). Also check the same file under Order & Export.
7) Create an Enterprise Application project.
8) Right click on the EJB module project and select add to EAR project, then select the created EAR project.
9) Right click on the EJB project, select Build EJB Archive
10) Right click on the EAR project, select Build Application Archive
11) Open the WebDynpro perspective, open a new project, right click on the project ->properties. Do the following configurations :-
Java Build path - select the EJB project from projects , check the selected project under Order & Export
Project references select the EAR project
WebDynpro references select sharing references tab, click add & make an entry as : <vendor>/<EAR project name without .ear extension>
You can find the vendor name under application-j2ee-engine.xml file of the EAR project. By default it is sap.com. So if my EAR projects name is ABC, my entry would look like sap.com/ABC
12) Now the configurations are over and the EJB can be invoked by writing the client code inside the webdynpro component. Like:
InitialContext context = new InitialContext();
Object obj = context.lookup("MyJndi");
MyEJBHome home = MyEJBHome)PortableRemoteObject.narrow(obj,MyEJBHome.class);
MyEJB mybean = home.create();
int a = 0;
a= mybean.add(10,15);
wdContext.currentContextElement().setSum(a);
where MyEJB is my EJB name and MyJndi is my JNDI name
To connect to Oracle , you can write the usual Java code (given below) as a business methos of the ejb (similar to add() method in the example). And access it like mybean.<businessMethodName>().
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@Oracle_server_ip:Oracle port:SID of the Database","user_name","password");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("your query");
Extracted from Re: Webdynpro and Oracle
http://help.sap.com/saphelp_webas630/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm
May be of use to understand the VA Conf /people/varadharajan.krishnasamy/blog/2007/02/27/configuring-jdbc-connector-service-to-perform-database-lookups
Regards
Ayyapparaj -
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 GuptaHi 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 -
Problem in uploading excel file
HI ,
i need to upload a excel file, I am able to get records form excel to internal table, using ws_upload FM.
But i m getting a # in between every fields.
I have used split at '#' into field1 field2... but it is not working. Can anybody help me onthis.. plz..
KumarHi I have encountered this problem too. After trying different solutions, I guess that FM 'GUI_UPLOAD' is
not supposed to upload an excel file. So please try FM 'TEXT_CONVERT_XLS_TO_SAP' as below. It works.
*: Description :
*: This is a simple example program to get data from an excel :
*: file and store it in an internal table. :
*: Author : www.sapdev.co.uk, based on code from Jayanta :
*: SAP Version : 4.7 :
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename. "To retrieve the upload file name
TYPES: BEGIN OF t_datatab,
col1(10) TYPE c,
col2(10) TYPE c,
col3(10) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
*START-OF-SELECTION.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR = 'X'
i_line_header = 'X' "To ignore the header line(the first line) if it is 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP. -
Error in uploading excel file using Java pages
Hello,
We are using oracle ERP (R12.1.1) and we have developed one JSP page to upload an excel.
After selecting the excel and browse button is clicked we are gettign the OLE stream error when the excel file is .csv or .xlsx. There is no issue with .xls excel files. For loading the excel data to custom table we are using the "jxl-2.6.jar".
Can we get higher version of "jxl-2.6.jar to support CSV upload?
Thanks.Are you Registered this jsp upload page to EBS before test?
You have to register the page to EBS first.
Regards,
Dilip -
I have problem of uploading excel file to my internal table
Hi,
I trying to upload data from excel file to my internal table and when i tried to debug the program and check the data in internal table and iam gettin # in all the fields and the data in not populated in internal table , as we are using 4.0b version and we are using UPLOAD FUNCTION.
BUKRS(4) TYPE C,
PONO(8) TYPE C,
GRNNO(8) TYPE C,
DELNOTE(16) TYPE C,
RECPTDT(10) TYPE C,
SUPPCODE(20) TYPE C,
RECPT(12) TYPE C,
GLACCT(10) TYPE C,
CCTR(6) TYPE C,
CALL FUNCTION 'UPLOAD'
TABLES DATA_TAB = STRU.
IF SY-SUBRC NE 0.
WRITE: /'Data file error'.
ENDIF.
i am using the same sequeuence in the above structure in excel.Hi KODAMANCHILI,
Refer following link :
http://help.sap.com/saphelp_40b/helpdata/en/fc/eb3d9d358411d1829f0000e829fbfe/frameset.htm
This will surely solve your problem.
Regards,
Vivek
Maybe you are looking for
-
I have pages for the iPad 3 and it does not seem to sync with the cloud
I have the newest pages, an iCould account, an internet connection and every other possible thing. I have been troubleshooting this problem and I cant seem to get it working. Is anyone else having these issues with the iCloud syncing?
-
I would like to know if there is a way I can possibly default the built in mail application on my iPhone to send emails in HTML format rather than Plain Text. I have already read a variety of posts with some suggestions, like bolding or applying some
-
Did a fresh Solman 4 SR3 install. Completed the post install config. Cannot activate OSS connection yet due to firewall rules. Two issues: 1) when doing the Part II config wizard step, an error occurs and the config step terminates. Nothing in the sy
-
MySQL uprgrade: 5.0.22 -- 5.0.82
We're currently running OS X Server 10.4.11 and MySQL 5.0.22. A recent attempt at upgrading MySQL from 5.0.x to 5.1.x was awful (to say the least) and I'm wondering if anyone's had experience doing an incremental upgrade from 5.0.x to 5.0.x? It's nee
-
Can I upload my Aperture photos with Lightroom trial?
I just downloaded the Lightroom software on my desktop. When I go to plug-in extra, ALL the plug-ins are greyed out.