I would like to upload a excel file using jsp
Hi,
I would like to upload the excel file using jsp in my netbeans ide. Please help.
I don Know what is the error in this jsp file. It is not showing any thing and the file is also not getting uploaded.
Please gothru the code below.
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ page import="java.io.*" errorPage="err.jsp"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<html:rewrite page="/design.css" />" rel="stylesheet" type="text/css">
<title>Upload Page</title>
</head>
<body onKeyDown="DisablingBackFunctionality()" onLoad="DisablingBackFunctionality()">
<html:form action="download" >
<div style="position:absolute; left:100;top:200;">Select an excel File :<input type="file" name="uploadfile"></div>
<div style="position:absolute; left:190;top:250;"><input type="submit" name="Submit" value="Read"></div>
<div style="position:absolute; left:336;top:250;"><input type="reset" name="Reset" value="Clear"></div>
mainmenu
</html:form>
</body>
</html>
<%
String contentType = request.getContentType();
if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead < formDataLength) {
byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
totalBytesRead += byteRead;
String file = new String(dataBytes);
//out.println("<br> file :"+file);
String saveFile = file.substring(file.indexOf("filename=\"") + 10);
//out.println("<br> savefile :"+saveFile);
saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
//out.println("<br> now file1 :"+saveFile);
saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1, saveFile.indexOf("\""));
//out.println("<br> now file2 :"+saveFile);
//out.print(dataBytes);
String ext = "";
if (saveFile.indexOf(".") != -1) {
ext = saveFile.substring(saveFile.lastIndexOf("."));
int lastIndex = contentType.lastIndexOf("=");
//out.println("<br>lst index of"+lastIndex);
String boundary = contentType.substring(lastIndex + 1, contentType.length());
//out.println("<br> boundary"+boundary);
//out.println("<br> file :"+file);
int pos;
pos = file.indexOf("filename=\"");
//out.println("<br> now 0 :"+pos);
pos = file.indexOf("\n", pos) + 1;
//out.println("<br>now 1 :"+pos);
pos = file.indexOf("\n", pos) + 1;
//out.println("<br>now 2 :"+pos);
pos = file.indexOf("\n", pos) + 1;
//out.println("<br>now 3"+pos);
int boundaryLocation = file.indexOf(boundary, pos) - 4;
int startPos = ((file.substring(0, pos)).getBytes()).length;
int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
FileOutputStream fileOut = new FileOutputStream("D:\\" + saveFile);
//FileOutputStream fileOut = new FileOutputStream(saveFile);
//fileOut.write(dataBytes);
fileOut.write(dataBytes, startPos, (endPos - startPos));
fileOut.flush();
fileOut.close();
session.setAttribute("fil", saveFile);
//out.println("File saved as " +saveFile);
%>
<script type="text/javascript" >
function DisablingBackFunctionality()
var URL;
var i ;
var QryStrValue;
URL=window.location.href ;
i=URL.indexOf("?");
QryStrValue=URL.substring(i+1);
if (QryStrValue!='X')
window.location=URL + "?X";
</script>
Please let me know the result as soon as possible. Its my very urgent.
Thanking Yu,
Muthu Kumar.R
No.
Mylenium
Similar Messages
-
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′. First name
wa_record-name1 = itab-value.
when 0002′. Surname
wa_record-name2 = itab-value.
when 0003′. 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 MaheshwariThe 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? -
How to upload a image file using JSP
hello to all.
i am in the learning stage please help me to upload a image file
using jsp. give the explanation to the code also if possible.
thanks in advance
sincerely
ChezhianYou may find the following articles useful for the JSP/Servlet part:
Uploading files: http://balusc.blogspot.com/2007/11/multipartfilter.html
Downloading files: http://balusc.blogspot.com/2007/07/fileservlet.html -
Upload an excel file using servlet
want to upload an excel file read it and do some updates and then again build an excel sheet
step 1: display an Excel sheet inside the browser
step 2: edit the sheet
step 3: send the sheet data to a Servlet to read it.
i am using POI to read an excel file and use POIFS
when i upload an excel file and get servletinputstream it gives the header+data+tailor
stand alon i have done it but using servlet i failed
can anybody give me an simple example to upload an excel file and shoe it
plz help meSurprise! Look what the forum says...
BEFORE YOU POST A TOPIC HERE: Please be sure your topic is related to features or functionality of this site. This forum is not for general technology questions. Not sure which forum to use? Try searching for your topic in the "Search Forums" element on the left panel.Please post your question on http://forum.java.sun.com/forum.jspa?forumID=33
Do not reply here. -
How to upload an html file using jsp and jdbc
Hi,
im trying to upload an html page using JSP and jdbc. but of no success.
my aim is to keep some important html pages in the database.the file size can vary.the file has to be selected from a local machine (through the browser) and uploaded to a remote machine(where the databse resides).
any help/sample code or pointer to any helpful link is appreciated.
thanks in advance
javajar2003When uploading a file, I use a byte array as a temporary buffer..
So, you should then be able to store the byte array in the
database as binary data.
example>
//Temporary Buffer To Store File
byte[] tmpbuffer = new byte[860];
//Some Code To Upload File...
//File Should Now Be In Byte Array
//Get DB Connection and execute Prepared Statement
Connection con=//GET DB CONNECTION;
String sql=insert into TABLE(page) values(?);
PreparedStatement ps=con.prepareStatement(sql);
ps.setBytes(1,tempbuffer);
ps.executeUpdate();
//Close PS and Free DB Connection
..... and this method looks like you dont even have
to store the file in a byte array, you can just give
it the input stream.
ps.setBinaryStream(int, inputStream, int);
You may have to make several attempts at this. I have
uploaded a file and temporarily stored it in a byte array,
but have never from there stored it in the DB as binary
data.. but this looks like it'll work.
Good Luck! -
How to upload a excel file using BDC
how should i upload a file using BDC
i have downloaded a excel file containing the values of table A006 a X server.
now i hav to upload it into new server Y server using BDC , how do i do it?
wat all things one shud consider ?Hi,
This is very simple, follow the below mention steps to do so:
1.Declare an internal table having same structure as db table, but take all the fields type as 'C' and length same as defined in the table.
TYPES:BEGIN OF it,
key(20) TYPE c,
indicator(20) TYPE c,
bldat(20) TYPE c,"bkpf-bldat
budat(20) TYPE c,"bkpf-budat
END OF it.
DATA: itab TYPE STANDARD TABLE OF it,
wa TYPE it.
2.Include TRUX as type pool and declare a variable of type trux_t_text_data to be passed in the FM that actually reads data from excel sheet into above declared intrenal table.
TYPE-POOLS: truxs.
DATA: it_raw TYPE truxs_t_text_data.
3. Call the FM 'TEXT_CONVERT_XLS_TO_SAP' and pass the file name and the internal table name into the parameter
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR = 'X'
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file "name of the excel file
TABLES
i_tab_converted_data = itab[] "internal table where data will be stored
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.
4. loop at internal table and modify the ztable/dbtable where data to be upload .
Hope this solve your problem.
Pooja -
Uploading an excel file using webutil in AIX
Hi,
When i am uploading data in an excel file to my Forms(Windows) the screen works fine
But when i am uploading the same excel file to my forms in AIX(Where the application is running) the data is wrongly uploaded
The field is a number type and no format mask is set.
Eg:
Actual data:---------------------- In Form(Windows)---------- In Form (AIX)
31015134807500*30000* 31015134807500*30000* 31015134807500*29800*
I am using below code to copy the value
cell_value :=Client_OLE2.get_num_property(cell, 'Value');
COPY(cell_value,'data.field'||k);
Can anyone please help me understand why in AIX it reads a different value???Your question is hard to respond too because we don't have access to your Excel file and don't know the structure of the data.
...In Form (AIX)...31015134807500*29800*>
Does the value "29800" exist in your Excel file? If so, where?
Perhaps your code is skipping a row for some reason? Are you opening the exact same Excel file on each computer?
What version of Oracle Forms are you using?
Craig... -
Hi All,
I am working on a JAVA/JSP application. JSP page passes the user inputs to JAVA page (using POST method) which queries to the database and generate an Excel file and returns the link for that file. I am displaying that link in JSP page ("Your file is successfully saved. Click here to download or view your file).
Now what I want is when the user clicks on the link, open/save dialog will appear which give flexibility to the user to download or view the file in same JSP page. The problem is I don�t want to post again the data or dont want to open a child window. How to set the content type without posting it (I don�t know much about this). Is there any way to do this?
Any help is highly appreciated. Thanx in advance
Cheers
InderpalHi
Iam retreiving a file which is in image type in Ms SQl database, but while im retreiving the data from database using Servlet OutputStream the data is showing in binary format with all speciall symbols and text inside .Iamunable to find the solution for that,
Pleas help me
my code
response.setContentType("application/msword");
OutputStream ros = response.getOutputStream();
ros.flush();
ros.write(bt,0,bt.length);
Thankz for ur help ,
my id: [email protected] -
How to upload a graphic file using JSP?
Thanks
The same way you upload any other file. Your form must be declared with multipart/form-data encoding and then, upon the form submit, you will have to parse a multipart request. There are a bunch of libraries around that do that. Our product, TICL (at http://www.kobrix.com) includes a server-side FileUpload component that does it and there a few free, special purpose ones that may help too - do an internet search ;)
-
CRM ABAP How to upload an Excel file into an internal table?
How to upload an Excel file using GUI_UPLOAD?? what should be the values of the parameters? The function modules ALSM_EXCEL_TO_INTERNAL_TABLE and KCD_EXCEL_OLE_TO_INT are not present in CRM. Please suggest me a way out!
Hi saurabh,
you can try the folowing sample..
and make modifications according to your requirement..
TYPE-POOLS: truxs.
DATA: i_text_data TYPE truxs_t_text_data,
v_filename_string TYPE string.
DATA: BEGIN OF itab OCCURS 0,
Name(30),
Phone(15),
Fax(500).
DATA: END OF itab.
PARAMETERS: p_file LIKE rlgrap-filename.
START-OF-SELECTION.
v_filename_string = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename_string
filetype = 'ASC'
has_field_separator = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
dat_mode = ''
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = i_text_data
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
* I_LINE_HEADER =
i_tab_raw_data = i_text_data
i_filename = p_file
TABLES
i_tab_converted_data = itab
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.
this is a sample code that uploads a excel file using GUI_UPLOAD, but uses another function module to convert that uploaded data into an internal table..
regards
satesh -
I'm doing a test on uploading an Excel file using JAVA. Right now I have my code set up to upload to an Access database. Everything works great except the last record in my Excel file is not being uploaded. I can make it load the last record by adding redundant code { stSQL.executeUpdate(strSQL); }
outside the loop as shown below. This doesn't really make sense to me since I am printing the last SQL statement twice, once inside the loop and once outside the loop so why the SQL statement isn't executed is beyond me. Any thoughts? Thanks,
import java.io.*;
import java.sql.*;
import java.util.regex.*;
public class UploadExcel{
public static void main(String[] args){
Connection connection = null;
String TableName = "GSABill";
String strBeginSQL = "INSERT INTO " + TableName + " VALUES( ";
try{
int iCount = 0;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=c:/test3.xls;DriverID=22;READONLY=false;" );
Connection Access = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=c:/temp/test.mdb;Uid=Admin;Pwd=;");
Statement st = con.createStatement();
Statement stSQL = Access.createStatement();
ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
int rows;
String strSQL;
strSQL = "";
while (rs.next()) {
strSQL = strBeginSQL;
iCount++;
strSQL = strBeginSQL + iCount + ", ";
for (int i = 1; i <= numberOfColumns; i++) {
String columnValue = rs.getString(i);
try{
if (!columnValue.equals("")){
strSQL = strSQL.substring(0, strSQL.length()-1) + "'" + columnValue + "', ";
} else {
strSQL = strSQL.substring(0, strSQL.length()-1) + "'', ";
} catch(Exception e) {
strSQL = strSQL.substring(0, strSQL.length()-1) + "'', ";
strSQL = strSQL.substring(0, strSQL.length() - 2) + ")";
System.out.println(strSQL);
stSQL.executeUpdate(strSQL);
System.out.println(strSQL);
stSQL.executeUpdate(strSQL);
stSQL.close();
st.close();
con.close();
} catch(Exception ex) {
System.err.print("Exception: ");
System.err.println(ex.getMessage());jsp file upload code (any type of file): (fileUpload.jsp)
<%@ page import="java.io.*,javax.servlet.http.HttpServletRequest,javax.servlet.ServletInputStream" %>
<%@ page import="java.io.FileWriter,java.io.IOException" %>
<%
String savePath = "", filepath = "", filename = "";
String contentType = "", fileData = "", strLocalFileName = "";
int startPos = 0;
int endPos = 0;
%>
<%!
//copy specified number of bytes from main data buffer to temp data buffer
void copyByte(byte [] fromBytes, byte [] toBytes, int start, int len)
for(int i=start;i<(start+len);i++)
toBytes[i - start] = fromBytes;
%>
<%
int BOF = 0, EOF = 0;
contentType = request.getContentType();
out.println("<br>Content type is :: " +contentType);
if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0))
DataInputStream in = new DataInputStream(request.getInputStream());
DataInputStream in1 = in;
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead < formDataLength)
byteRead = in1.read(dataBytes, totalBytesRead, formDataLength);
totalBytesRead += byteRead;
out.println("<br>totalBytesRead : " + totalBytesRead + " : formDataLength = " + formDataLength);
//String file = new String(dataBytes);
//out.println("<br>File Contents:<br>////////////////////////////////////<br>" + file + "<br>////////////////////////////////<br>");
byte[] line = new byte[128];
if (totalBytesRead < 3)
return; //exit if file length is not sufficiently large
String boundary = "";
String s = "";
int count = 0;
int pos = 0;
//loop for extracting boundry of file
//could also be extracted from request.getContentType()
do
copyByte(dataBytes, line, count ,1); //read 1 byte at a time
count+=1;
s = new String(line, 0, 1);
fileData = fileData + s;
pos = fileData.indexOf("Content-Disposition: form-data; name=\""); //set the file name
if(pos != -1)
endPos = pos;
}while(pos == -1);
boundary = fileData.substring(startPos, endPos);
//loop for extracting filename
startPos = endPos;
do
copyByte(dataBytes, line, count ,1); //read 1 byte at a time
count+=1;
s = new String(line, 0, 1);
fileData = fileData + s;
pos = fileData.indexOf("filename=\"", startPos); //set the file name
if(pos != -1)
startPos = pos;
}while(pos == -1);
do
copyByte(dataBytes, line, count ,1); //read 1 byte at a time
count+=1;
s = new String(line, 0, 1);
fileData = fileData + s;
pos = fileData.indexOf("Content-Type: ", startPos);
if(pos != -1)
endPos = pos;
}while(pos == -1);
filename = fileData.substring(startPos + 10, endPos - 3); //to eliminate " from start & end
strLocalFileName = filename;
int index = filename.lastIndexOf("\\");
if(index != -1)
filename = filename.substring(index + 1);
else
filename = filename;
//loop for extracting ContentType
boolean blnNewlnFlag = false;
startPos = endPos; //added length of "Content-Type: "
do
copyByte(dataBytes, line, count ,1); //read 1 byte at a time
count+=1;
s = new String(line, 0, 1);
fileData = fileData + s;
pos = fileData.indexOf("\n", startPos);
if(pos != -1)
if(blnNewlnFlag == true)
endPos = pos;
else
blnNewlnFlag = true;
pos = -1;
}while(pos == -1);
contentType = fileData.substring(startPos + 14, endPos);
//loop for extracting actual file data (any type of file)
startPos = count + 1;
do
copyByte(dataBytes, line, count ,1); //read 1 byte at a time
count+=1;
s = new String(line, 0, 1);
fileData = fileData + s;
pos = fileData.indexOf(boundary, startPos); //check for end of file data i.e boundry value
}while(pos == -1);
endPos = count - boundary.length();
//file data extracted
out.println("<br><br>0. Local File Name = " + strLocalFileName);
out.println("<br><br>1. filename = " + filename);
out.println("<br>2. contentType = " + contentType);
out.println("<br>3. startPos = " + startPos);
out.println("<br>4. endPos = " + endPos);
out.println("<br>5. boundary = " + boundary);
//create destination path & save file there
String appPath = application.getRealPath("/");
out.println("<br>appPath : " + appPath);
String destFolder = appPath + "images/banner/";
filename= destFolder + filename;
FileOutputStream fileOut = new FileOutputStream(filename);
fileOut.write(dataBytes, startPos, (endPos - startPos));
fileOut.flush();
fileOut.close();
out.println("<br>File saved as >> " + filename);
//file saved at destination
//out.println("<br>File data : <br><br>**************************<br>" + (new String(dataBytes,startPos, (endPos - startPos))) + "<br><br>**************************");
else
out.println("Error in uploading ");
%>
supporting html file:
<form method="post" action="fileUpload.jsp" name="upform" enctype="multipart/form-data">
<table width="60%" border="0" cellspacing="1" cellpadding="1" align="center" class="style1">
<tr>
<td align="left"><b>Select a file to upload :</b></td>
</tr>
<tr>
<td align="left">
<input type="file" name="uploadfile" size="50">
</td>
</tr>
<tr>
<td align="left">
<input type="hidden" name="todo" value="upload">
<input type="submit" name="Submit" value="Upload">
<input type="reset" name="Reset" value="Cancel">
</td>
</tr>
</table>
</form>
</body>
</html> -
I would like to upload a file for a client and have it expire (lock them out of it) at a prescribed time, say, 2 days after delivery. Any way to put a time limit on a file?
No.
Mylenium -
Hi,
I am getting an error while trying to upload a excel file. I am using the function HR_KR_XSTRING_TO_STRING for conversion. The error message is "Unable to interpret as a number"First of all, are you sure you know what you are working with here. If this is standard Excel file in the Microsoft binary/propriatery format there is not function module or class in ABAP that can magically just transform this to a character string. You should search the forums as this has been discussed extensively. On that topic, please also do not post duplicate threads. I have already locked your other thread with the same basic question.
Instead of the binary/propriatery format of Excel, the file should be saved on the client as a text based format - like XML or Text Tab Delimited. You can then use several different options on the server to convert the XSTRING to STRING and process the content (becuase it was text based to begin with). You could use CL_BCS_CONVERT, the function modules in the function group SCMS_CONV, or the class CL_ABAP_CONV_IN_CE. -
Need help in uploading an excel file into SAP
Hi All,
I got a requirement to upload an excel file to SAP.
But When i tried with the FM "ALSM_EXCEL_TO_INTERNAL_TABLE" , file not getting uploaded to internal table.
Getting expection 2, UPLOAD_OLE...
I think the problem is with the file... the following the sample text of the file...
Technical IdentNo. Line No. Text Location
BS-PZ-180 1 035-05 EXZENTER-SCHNECKENPUMPE 0026
BS-PZ-180 2 LIEFERANT : SOCSIL-INTER SA ECUBLENS 0026
BS-PZ-180 3 HERSTELLER : MONO PUMPS LIMITED MANCH 0026
BS-PZ-180 4 MODELL/TYP : SH 60 0026
But when I tried with only one Column..its getting successfully uploaded...
Pls suggest me how to upload the file? ( May be with sample code)
Also pls let me know hw to handle the file..which contains 5 differnt sheets of texts.. ( May be with sample code)
Your suggestion will be highly appreciated...
Thanks,
PriyaHi,
Use the FM: TEXT_CONVERT_XLS_TO_SAP. It will work perfectly. I used this function module and uploaded data from xls to sap. check the following code:
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.
TYPES: BEGIN OF t_datatab,
PROP_NAME like SDOKPROP-PROP_NAME,
PROP_CHECK like SDOKPROP-PROP_CHECK,
TABNAME like SDOKPROP-TABNAME,
FIELDNAME like SDOKPROP-FIELDNAME,
DESCRIPT(30) type c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
itab TYPE STANDARD TABLE OF t_datatab,
wa_itab TYPE 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.
SELECT * FROM sdokprop INTO CORRESPONDING FIELDS OF TABLE itab
WHERE PROP_NAME LIKE 'DMS%'.
WRITE / 'Before Modification'.
LOOP AT itab INTO wa_itab.
WRITE:/1 wa_itab-PROP_NAME, 27 wa_itab-PROP_CHECK, 31 wa_itab-TABNAME, 65 wa_itab-FIELDNAME, 96 wa_itab-DESCRIPT.
CLEAR wa_itab.
ENDLOOP.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = '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.
WRITE / 'After Modification'.
MODIFY sdokprop FROM TABLE it_datatab.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/1 wa_datatab-PROP_NAME, 27 wa_datatab-PROP_CHECK, 31 wa_datatab-TABNAME, 65 wa_datatab-FIELDNAME, 96 wa_datatab-DESCRIPT.
CLEAR wa_datatab.
ENDLOOP.
IF sy-subrc = 0.
MESSAGE 'successfull' TYPE 'S'.
ELSE.
MESSAGE 'failed' TYPE 'E'.
ENDIF.
Regards,
Bhaskar
Maybe you are looking for
-
XML File not Found for the Container BC4J.cpx
Hi, Have following error when I start a BC4J-JSP/Struts application (with Embedded and standalone OC4J) : 500 Internal Server Error oracle.jbo.NoXMLFileException: JBO-26001: XML File not found for the Container BC4J.cpx oracle.jbo.mom.ContainerD
-
No longer sending or receiving imessager on iPhone 4s
I am no longer able to receive or post iMessages on iPhone 4s
-
Web Services in Inter Organisation BPM
Hi All, What are the pros and cons of using web service based decentralise approach for managing Inter-Organisational BPM? What are the challenges and what are the benefits? Regards, Ganesh Sawant
-
Outer Joins with multiple conditions - alternatives to UNION?
It is my understanding that Oracle 8i does not directly support mutiple conditions for outer joins. For instance, I'm looking for PEOPLE who may, or may not, be on MEDICATIONS. All MEDICATIONS are listed with DRUGNAME and DRUGID. There thousand of di
-
How To Install internal Mac Pro Bluetooth?
Could anyone draw me a picture in my head of how to install this bluetooth device before I get it and put it in pretty quick? Users guide is no joy. Can';t be too hard? I'm softwared up and external now. Keyboard connectivity is not what I'd like...