Uploading Datas From Spread sheet to Database Table
I went to URL http://htmldb.oracle.com/pls/otn/f?p=38131:1 and download Vikas' CSV Upload application (a zip file) as well as the script to create the HTMLDB_TOOLS package.
I follow the steps in the link : Re: File Browse, File Upload
The application is created,Preview shows that the datas in the form of Excel sheet,but I cant upload the spread sheet.
If I click the Upload button It shows the Error:
ORA-01861: literal does not match format string
Error ORA-01861: literal does not match format string
OK
Kindly let me know the reason for the error.
Please help me to solve this Issue.
Thanks in Advance
by
Suresh
Hi Gussay,
Thanks for ur reply.
I found the error,it was due to the date format.
If i drop the date column from the table and also from spread sheet,then it uploads.
How can we load dates in spread sheet to database column.
Thanks in advance
Suresh
Similar Messages
-
Regarding uploading data from excel sheet to internal table
hi,
while executing the code im getting the output one by one but i want it to be displayed in a table format can any one help me regarding this issue.
thanks and regards,
siriHi Sirisha,
Through this FM we can't get the data in tabular format. After getting data from this FM we have to convert to tabular format. As far as i know there is no FM for Excel upload which directly gives data in tabular format.
Check below sample code which uploads 3 columns from excel file.
U can add as many case statements as the number of fields.
PARAMETERS: po_file TYPE rlgrap-filename DEFAULT 'E:test.xls'.
TYPES: BEGIN OF t_final,
empno(10) TYPE c,
name(30) TYPE c,
state(25) TYPE c,
END OF t_final.
DATA: i_tab TYPE STANDARD TABLE OF alsmex_tabline,
i_final TYPE STANDARD TABLE OF t_final,
wa_tab TYPE alsmex_tabline,
wa_final TYPE t_final.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR po_file.
PERFORM open_folder.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = po_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 3
i_end_row = 65256
TABLES
intern = i_tab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
CHECK NOT i_tab[] IS INITIAL.
LOOP AT i_tab INTO wa_tab.
CASE wa_tab-col.
WHEN 1.
wa_final-empno = wa_tab-value.
WHEN 2.
wa_final-name = wa_tab-value.
WHEN 3.
wa_final-state = wa_tab-value.
ENDCASE.
AT END OF row.
APPEND wa_final TO i_final.
CLEAR wa_final.
ENDAT.
ENDLOOP.
FORM open_folder .
DATA: li_file TYPE TABLE OF sdokpath,
lwa_file TYPE sdokpath.
CLEAR: po_file, lwa_file.
REFRESH li_file[].
CALL FUNCTION 'TMP_GUI_FILE_OPEN_DIALOG'
TABLES
file_table = li_file
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc IS INITIAL.
READ TABLE li_file INTO lwa_file INDEX 1.
IF sy-subrc IS INITIAL.
po_file = lwa_file-pathname.
ENDIF.
ENDIF.
ENDFORM. " open_folder
Just try executing above code in debug mode. U will understand the functionality.
Thanks,
Vinod. -
Hi,
How to upload data from XL sheet to internal table , can u please provide the sample code.
thanks
krishnaHI Krishna
See this code where i had writen to UPLOAD A EXCEL SHEET AND again pass that to APPLICATION server
i think it wil be very useful for you
you can understand this very easily
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 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.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop. -
Uploading data from excel sheet
HI,
Can anyone provide me the details to upload vendor data from excel sheet to database through bdc?
Thankyou.upload the excel file in your internal table and then use BDC to updated the database table.
FM's to upload Excel:
GUI_UPLOAD
KCD_EXCEL_OLE_TO_INT_CONVERT
ALSM_EXCEL_TO_INTERNALTABLE
refer to the link:
http://diocio.wordpress.com/2007/02/12/sap-upload-excel-document-into-internal-table-2/
http://www.sap-img.com/abap/learning-bdc-programming.htm
With luck,
Pritam. -
Upload data from excel file to Oracle table
Dear All,
I have to upload data from excel file to Oracle table without using third party tools and without converting into CSV file.
Could you tell me please how can i do this using PLSQl or SQL Loader.
Thnaks in Advance..Dear All,
I have to upload data from excel file to
Oracle table without using third party tools and
without converting into CSV file.
Could you tell me please how can i do this
using PLSQl or SQL Loader.
Thnaks in Advance..As billy mentioned using ODBC interface ,the same HS service which is a layer over using traditional ODBC to access non oracle database.Here is link you can hit and trial and come out here if you have any problem.
http://www.oracle-base.com/articles/9i/HSGenericConnectivity9i.php[pre]
Khurram -
Uploading data from excel sheets through BDC's into sap system
hi guys,
can you please help me with this. As we use gui_upload to upload data from flat file to sap system, which function module you use to upload data from Excel sheet to sap system through bdc'shello pavan,
welcome to SDN
check the below program
REPORT ZEXCEL_TO_INTERNAL .
data: begin of itab occurs 0,
name(20) type c,
addre(20) type c,
end of itab.
DATA : ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
DATA : B1 TYPE I VALUE 1,
C1 TYPE I VALUE 1,
B2 TYPE I VALUE 100,
C2 TYPE I VALUE 9999.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME =
'C:\Documents and Settings\administrator\Desktop\ppcon001bd_24.xls'
I_BEGIN_COL = B1
I_BEGIN_ROW = C1
I_END_COL = B2
I_END_ROW = C2
TABLES
INTERN = itab1
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at itab1.
write:/ itab1.
Endlop.
Regards,
Naveen -
How to extract data from text file to database table
Hi ,
I am trying to upload data in text file to database table using GUI_UPLOAD function .what would be the program for that.
thanks in advance.Hi,
I don't think you have a standard sap program to upload data from file to database table...
Instead you can create a custom program like this..
DATA: T_FILEDATA(1000) OCCURS 0 WITH HEADER LINE.
DATA: T_ZTABLE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\TEST.TXT'
tables
data_tab = T_FILEDATA
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.
LOOP AT T_FILEDATA.
T_ZTABLE = T_FILEDATA.
APPEND T_ZTABLE.
ENDLOOP.
MODIFY ZTABLE FROM TABLE T_ZTABLE.
COMMIT WORK..
Thanks,
Naren -
Import/insert data from XML into Oracle database tables?
Hi. (I am using JDeveloper 10.1.3.3.0 and Oracle 10g)
I have been able to export the data from one of my database tables by using a View Object and .writeXML.
Now, I want to take an xml file that is formatted in the same way as what is spit out by the writeXML and put that info in my database table. I followed online examples and have tried using .readXML like so:
Element element = XMLDoc.getDocumentElement();
vo.readXML(element, -1);
I know it is sort of working, because at first I got an error message that one of the required attributes was missing. So, I added that attribute to my xml file and ran my code. No errors. But, I checked my database, and the new records were not added.
Is there something I have done wrong? Or is there perhaps something I left out? I also noticed there were several versions of readXML like readFromXML. Which one should I use and how?
Thanks.KUBA, I changed my code to match your example:
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
File xmlFile = new File("C:/myfilehere.xml");
Document doc = db.parse(xmlFile);
Element element = doc.getDocumentElement();
vo.readXML(element, -1);
vo.getDBTransaction().commit();
I still get no errors, but my database table has no new records.
Any ideas why?
Thanks. -
Upload data from excel sheet into md61
Hi Gurus,
Can anybody please tell me the solution like how to upload the data from excel sheet into the MD61
if u suggest me to write an ABAP code then its fine or any other way would be great
and can u also send me the abap code i would be thankful to allHi,
I can be done in 2 ways.
1. Using LSMW you can upload your MD61 demand thru Excel sheet.
2. You can use BDC to upload the demand from Excel. For this you need to take help from the ABAP. You need to record the macro usinf SHDB and the table maintenance will be taken care by the developer.
For LSMW you need not depend on your developer, as a functional consultant you can do it yourself.
Regards,
V. Suresh -
Uploading data from an excel to internal table.
Hi All,
I have a small problem when uploading data from an excel sheet to internal table using the function "GUI_UPLOAD".
Some garbage value is getting stored in the internal table after the upload. If i change the format of the file to ".txt" then its working fine. Pls help me out to upload the data frm Excel to Internal Table.
Thanks.
Sirisha.hi
good
pls check this code , this might help you to solve your problem
Multiple excel sheets generation in a workbook
CREATE OBJECT EXCEL 'EXCEL.SHEET'.
GET PROPERTY OF EXCEL 'Application' = APPLICATION.
SET PROPERTY OF APPLICATION 'Visible' = 1.
CALL METHOD OF APPLICATION 'Workbooks' = BOOKS.
CALL METHOD OF BOOKS 'Add' = BOOK.
CALL METHOD OF BOOK 'WORKSHEETS' = SHEET.
CALL METHOD OF SHEET 'ADD'.
Fill all the sheets with relavant data
PERFORM SHEET1 TABLES ITAB1.
PERFORM SHEET2 TABLES ITAB2.
PERFORM SHEET3 TABLES ITAB3.
PERFORM SHEET4 TABLES ITAB4.
Quit the excel after use
CALL METHOD OF EXCEL 'QUIT'.
FREE OBJECT: COLUMN,SHEET,BOOK,BOOKS,APPLICATION,EXCEL. "NO FLUSH.
CLEAR V_SHEET.
FORM FILL_CELL USING ROW COL VAL.
CALL METHOD OF SHEET 'cells' = CELL NO FLUSH
EXPORTING #1 = ROW #2 = COL.
SET PROPERTY OF CELL 'value' = VAL.
FREE OBJECT CELL NO FLUSH.
ENDFORM. " FILL_CELL
FORM SHEET1 TABLES ITAB1 STRUCTURE ITAB1.
V_SHEET = Sheet Name.
V_NO = V_NO + 1.
CALL METHOD OF BOOK 'worksheets' = SHEET NO FLUSH EXPORTING #1 = V_NO.
SET PROPERTY OF SHEET 'Name' = V_SHEET NO FLUSH.
PERFORM FILL_SHEET1 TABLES ITAB1 USING V_NO V_SHEET.
CALL METHOD OF SHEET 'Columns' = COLUMN.
FREE OBJECT SHEET.
CALL METHOD OF COLUMN 'Autofit'.
FREE OBJECT COLUMN.
ENDFORM.
Repeat above procedure for all sheets you want to add
FORM FILL_SHEET1
TABLES ITAB1 STRUCTURE ITAB1
USING V_NO V_SHEET.
ROW = 1.
PERFORM FILL_CELL USING ROW 1 'Column1 Name'.
PERFORM FILL_CELL USING ROW 2 'Column2 Name'.
PERFORM FILL_CELL USING ROW 3 'Column3 Name'.
ROW = ROW + 1.
LOOP AT ITAB1.
PERFORM FILL_CELL USING ROW 1 ITAB1-Column1.
PERFORM FILL_CELL USING ROW 2 ITAB1-Column2.
PERFORM FILL_CELL USING ROW 3 ITAB1-Column3.
ROW = ROW + 1.
ENDLOOP.
ENDFORM.
Repeat above procedure for all sheets you want to add
Try this also
TYPE-POOLS: truxs.
DATA: it_raw TYPE truxs_t_text_data.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
Upload Excel file
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file
TABLES
i_tab_converted_data = i_XCEL[]
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.
Thanks®ds,
Sree.
Edited by: Sree on Mar 17, 2008 8:07 AM -
BDC for Uploading data from XL sheet with unknown order of fields
Hi SAP Gurus,
My requirement is as follows,
A BDC is to be developed for uploading data from an XL sheet, but the problem here is , the order of fileds in the sheet can be changed .
ie, for example the fields in the XL sheet are :-
matnr maktx menge amount
but the user can give as
matnr amount menge maktx
or
maktx matnr amount menge
how i can solve this problem.
Thanks and Regards,
pavan.Hi Pavan,
You need to handle it by your self, you can create a dynamic table based on the file value.
The field name pass from file with the record as a header, and based on the header name create your dynamic table.
afterward you can pass your value to BDC.
for creating dynamic table you can use this method
call method cl_alv_table_create=>create_dynamic_table
exporting
i_style_table =
it_fieldcatalog = it_field[]
i_length_in_byte =
importing
ep_table = dyn_tab
e_style_fname =
exceptions
generate_subpool_dir_full = 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.
-Dhirendra -
Moving data from .xls spreadsheet to database table
Hi,
Does any one know a script or the procedure to move data from an .xls spreadsheet to a database table?
Thanks,
RanjanaHi,
check this out.. !!
Import data from Excel to Oracle Database and
Added link From Ask Tom.. your requirement you would be satisfied.. I supppose.. !!
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:908428873069
- Pavan Kumar N -
Uploading Data From Excel Sheet to SAP Database Tables
Dear Friends,
We are having an Excel Sheet with 90 different columns. Now we want only 2 of the columns to be uploaded in the database tables. So, Plz tell me which function module will be suitable for this. And plz help me with the code also.
Thanks,
Nishant JainHi Nishu,
A sample for the same..
data it_excel like table of ALSMEX_TABLINE with header line.
here we retrieve only 2 cols directly..
now itab will contain only 2 cols of all rows seperated by comma ..
data str(1000).
data itab like table of str with header line.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = 'C:sample1.xls'
i_begin_col = 1
i_begin_row = 1
i_end_col = 2
i_end_row = 100
tables
intern = it_excel
LOOP AT it_excel.
AT NEW row.
CLEAR itab.
ENDAT.
IF itab IS INITIAL.
MOVE it_excel-value TO itab.
ELSE.
CONCATENATE itab ',' it_excel-value INTO itab.
ENDIF.
AT END OF row.
APPEND itab.
ENDAT.
ENDLOOP.
regards
satesh -
I want to upload data from excel to R.12 tables
Dear All,
We have implemented R.12 we have already migrate data from legacy to EBS but during go live period many transaction cannot be record.
I have data in excel I want to upload. What is the best & save way please let me know.
Regards,
Muhammad Faraz
EBS Coordinator I.C.THi Muhammad,
The easiest way to upload data into a table from excel is to use Import Data feature of SQLDeveloper.
What you need to do is :
Right-Click on the table name in the Navigator.
Select Import Data
Choose the excel file you want to load the data from.
Map the columns of the xls file to the columns in the table
Upload.
Thanks
Pushkar. -
Uploading data from Excel sheet into SAP.
Dear All,
I want to upload data existing in Excel sheet into SAP. Is there any possibility with the following requirements?
1) Excel file contains serial numbers with different values.Like power(230Wp),Voc,Isc,Vmp and Imp.
2) We need to upload the same data into SAP with validations.
3) Validations are like no serial number should be repeated.
4) And depending on the Power value, the serial number should be assigned to different batches.Eg:The batches are as follows:
201 - 210
210 - 220
220 - 230
and if the Pmax of the serial number is 205.It should be assigned to batch 201 - 210 .
5) At present we are using MB31 to post the serial numbers which are existing in the flat file.
Thanks and Regards,
Varun SiddharthHi,
Refer to the following code:
DATA: lv_filetype(10) TYPE c,
lv_gui_sep TYPE c,
lv_file_name TYPE string.
lv_filetype = 'ASC'.
lv_gui_sep = 'X'.
lv_file_name = pa_dfile.
FM call to upload file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file_name
filetype = lv_filetype
has_field_separator = lv_gui_sep
TABLES
data_tab = gi_zhralcon_file
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.
The excel file must be a tab delimited file.
Hope it helps.
Regards,
Rajesh Kumar
Maybe you are looking for
-
Bean not found in forms10g application
Hi, how to solve this problem oracle.forms.webutil.clientinfo.getclientinfo bean not found this is the message iam getting when i implement my forms10g application with WEBUTIL.PLL library to export data form forms10g application to excel
-
Hello all, I am a bit new with boot camp and I am not sure about the size of patition. What do you suggest me for OS X and Windows partition size? Thank for advices
-
PDF size exceeds email attachment limit
Hi, I got some PDF files which exceed the limit as an email attachment, is there a way that I can add them directly via iTunes to read on my iPad2 via Adobe Reader, if so how? Any help is much appreciated...
-
I've got a Macbook Pro 2008 with Snow Leopard installed, 4Gb Ram and 500Gb DD ... is it possible or recomendable to update to OSX Mavericks? Compatibility says: OS 10.6.8 or later. I'm just that 10.6.8 Can you help me out? Thank you!
-
If I run a report on 0CCA_C11 with Cost Center Hierarchy as a Mandatory variable - Does it have to show exactly how the Cost Center Hierarchy looks in IO Maintenance considering there will be no data in the cube for some cost centers? I dont see man