Uploading Data from a Flat file into Oracle Database
Hi,
I am a novice to Java . SO, please bear with me. I have a reqiurement where I have a flat file or excel file from which I need to read the data and insert into Oracle Database. The falt file will exist on the client machine. I have been reading and I see this can be done through I/O Streams. Correct me if I am wrong. I am looking for a sample code to get started. Any Java expert has an answer for it, I will appreciate it.
Thanks
Try UploadBean. It allows to upload files (from a browser) in Oracle.
http://www.javazoom.net/jzservlets/uploadbean/uploadbean.html
You will find JSP and servlet samples.
Similar Messages
-
How do I import the data from Excel (.xls) file into Oracle Database table
I have an excel file with 5 columns of 5000 rows.
I have to import 5000 rows of data into my oracle table with
same column names & Data types.
What is the best advise for this ?
Thanks.
SriniYou can connect to Oracle from Excel directly. I know you can read data but am not sure if you can export data.
Other option is to import the data into Access.
Create an ODBC connection for Oracle
Use the to connect to Oracle from Access
Export data to Oracle from Access
Shakti
http://www.impact-sol.com
Developers of Guggi Oracle - Tool for DBAs and Developers -
How to export the data from an excel file to Oracle database by using macro
Hi,
I want to export data from an excel file into Oracle database.There is one method that by creating the macros through excel we are able to do this.
can anybody please send me the code to create macros?
Thanks in advance.
Regards,
Surendra.VThere are several resources on the web, but you could start analyzing if this code fits your needs --> VBA Macro for Excel 2003 Export of Text File with Comma and Quote Delimiters.
~ Madrid -
Uploading the data from a flat file into ztable
Hi,
I have a requirement where I have to upload the data from 2 flat files into 2 z tables(ZRB_HDR,ZRB_ITM).From the 1st flat file only data for few fields have to be uploaded into ztable(ZRB_HRD) .Fromthe 2nd flat file data for all the fields have to me uploaded into ztable(ZRB_ITM). How can I do this?
Regards,
Hemahi,
declare two internal table with structur of your tables.
your flat files should be .txt files.
now make use of GUI_UPLOAD function module to upload your flatfile into internal tables.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'c:\file1.txt'
has_field_separator = 'X'
TABLES
data_tab = itab1
EXCEPTIONS
OTHERS = 1.
use this function twice for two tables.
then loop them individually and make use of insert command. -
Uploading Data from a Flat File
Hi
I am trying to Upload data from a Flat File to the MDS. I have a few questions on the Process.
a) XI would be the Interface, and one end would be a file adapter with the Flat File format. On the other end, which Interface should I use - ABA Business Partner In or MDM Business Partner In. I do not understand the differences between them and where should which one be used?
B) At the moment,I want to map the data to standard Object type, Business Partner BUS1006. This also has a staging area already defined in the System. Can I view the data which is imported into the Staging area ? How so ?
C) The struture (or data) that I wish to upload has few fields, and does not map to the BP structure easily. In such a scenario does it make sense to
Create a new Object type
(ii) Create a new Business Partner type with the appropriate fields only ..
What I need to know is if either of these options is feasible and what are the pros & cons of doing this, in terms of effort, skillset & interaction with SAP Development ?
Kindly do reply if you have any answers to these questions.
Regards,
GauravHi Markus,
Thanks for your inputs.
I have tried uploading some dats from a Flat file to the Business Partner Onject type, BUS1006. I initially got some ABAP Parsing errors on the MDM side, but after correcting that, I find my message triggers a short dump - with the Method SET_OBJECTKEYS, not finding any keys in the BP structure that has been created.
Q1 - How do I get around this problem ? Is it necessary for me to specify Keys in the PartyID node of the Interface ABABusinessPartnerIn. or is it something else ?
Q2 - How is this general process supposed to work? I would assume that for staging, I would get incomplete Master data or data from flat files, which need not neccesarily contain keys. The aim is to use the matching strategies in the CI to identify duplicates and consolidate them.
Thanks in advance for your reply.
Regards,
Gaurav -
BAPI to upload data from a flat file to VA01
Hi guys,
I have a requirement wherein i need to upload data from a flat file to VA01.Please tell me how do i go about this.
Thanks and regards,
Frank.Hi
previously i posted code also
Include YCL_CREATE_SALES_DOCU *
Form salesdocu
This Subroutine is used to create Sales Order
-->P_HEADER Document Header Data
-->P_HEADERX Checkbox for Header Data
-->P_ITEM Item Data
-->P_ITEMX Item Data Checkboxes
-->P_LT_SCHEDULES_IN Schedule Line Data
-->P_LT_SCHEDULES_INX Checkbox Schedule Line Data
-->P_PARTNER text Document Partner
<--P_w_vbeln text Sales Document Number
DATA:
lfs_return like line of t_return.
FORM create_sales_document changing P_HEADER like fs_header
P_HEADERX like fs_headerx
Pt_ITEM like t_item[]
Pt_ITEMX like t_itemx[]
P_LT_SCHEDULES_IN like t_schedules_in[]
P_LT_SCHEDULES_INX like t_schedules_inx[]
Pt_PARTNER like t_partner[]
P_w_vbeln like w_vbeln.
This Perform is used to fill required data for Sales order creation
perform sales_fill_data changing p_header
p_headerx
pt_item
pt_itemx
p_lt_schedules_in
p_lt_schedules_inx
pt_partner.
Function Module to Create Sales and Distribution Document
perform sales_order_creation using p_header
p_headerx
pt_item
pt_itemx
p_lt_schedules_in
p_lt_schedules_inx
pt_partner.
perform return_check using p_w_vbeln .
ENDFORM. " salesdocu
Form commit_work
To execute external commit *
FORM commit_work .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = c_x
ENDFORM. " Commit_work
Include ycl_sales_order_header " To Fill Header data and Item data
Include ycl_sales_order_header.
Form return_check
To validate the sales order creation
FORM return_check using pr_vbeln type vbeln.
if pr_vbeln is initial.
LOOP AT t_return into lfs_return .
WRITE / lfs_return-message.
clear lfs_return.
ENDLOOP. " Loop at return
else.
perform commit_work. " External Commit
Refresh t_return.
fs_disp-text = text-003.
fs_disp-number = pr_vbeln.
append fs_disp to it_disp.
if p_del eq c_x or p_torder eq c_x or
p_pgi eq c_x or p_bill eq c_x.
perform delivery_creation. " Delivery order creation
endif. " If p_del eq 'X'......
endif. " If p_w_vbeln is initial
ENDFORM. " Return_check
*& Form sales_order_creation
text
-->P_P_HEADER text
-->P_P_HEADERX text
-->P_PT_ITEM text
-->P_PT_ITEMX text
-->P_P_LT_SCHEDULES_IN text
-->P_P_LT_SCHEDULES_INX text
-->P_PT_PARTNER text
FORM sales_order_creation USING P_P_HEADER like fs_header
P_P_HEADERX like fs_headerx
P_PT_ITEM like t_item[]
P_PT_ITEMX like t_itemx[]
P_P_LT_SCHEDULES_IN like t_schedules_in[]
P_P_LT_SCHEDULES_INX like t_schedules_inx[]
P_PT_PARTNER like t_partner[].
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = p_p_header
sales_header_inx = p_p_headerx
IMPORTING
salesdocument_ex = w_vbeln
TABLES
return = t_return
sales_items_in = p_pt_item
sales_items_inx = p_pt_itemx
sales_schedules_in = p_p_lt_schedules_in
sales_schedules_inx = p_p_lt_schedules_inx
sales_partners = p_pt_partner.
ENDFORM. " sales_order_creation
plzz reward if i am usefull plzz -
Error while uploading data from a flat file to the hierarchy
Hi guys,
after i upload data from a flat file to the hierarchy, i get a error message "Please select a valid info object" am loading data using PSA, having activated all external chars still get the problem..some help on this please..
regards
Srithere is o relation of infoobject name in flat file and infoobjet name at BW side.
please check with the object in the BW and their lengths and type of the object and check your flat file weather u have the same type there,
now check the sequence of the objects in the transfer rules and activate them.
there u go. -
Read data from Excel and write into oracle database
Hi
I want to know how can i read data from excel and write into oracle database using java.Kindly help me out to find a solution.
Thanks and Regards
NeetaHai,
I am suggesting the solution.
I will try out and let u know soon.
Make a coma separated file from your excel file.
Assuming that your requirement allows to make a csv file.
This file may be passed as an file object to be read by java.Using JDBC you must be able to populate the data base.You can also use String Tokenizer if needed.
You do not want to go via sql Loader?
For reading the excel file itself do you want java? -
Error while uploading data from a flat file
Hi All,
I am trying to load data from a flat file to an ODS. The flat file contains a field, say FLAT01, of numerical type(Type Decimal, Length 18, Decimals 2). I have created an infoobject, say ZIO10, with type CURR and currency field, 0CURRENCY. In the transfer rules, I have assigned a constant for 0CURRENCY as the flat file doesn't have any currecy field.
The problem is the flat file doesn't have any value in that field, FLAT01, for some records, infact most of the records. When I try to load it to BW,from applicatin server, it is throwing an error "Contents from field ZIO10 cannot be converted in type CURR ->longtext".
I have debugged the transfer rules and find that the empty value is being represented as '#' and when it is trying to copy it into the CURR type field, it is throwing the error.
Can someone please let me know how to solve it? why is it taking '#' for enpty value? Can't we change that?
Any help would be highly appreciated.
Best Regards,
James.
Message was edited by:
James HelsinkiHi SS,
I am sorry that I was not clear with my explanation. I have created ZIO10 as a keyfigure with type AMOUNT and the currency as 0CURRENCY.
There is no currency coming in from the flat file so I used a constant in transfer rules to fill 0CURRENCY.
The field which is coming as '#' is FLAT01 which is assigned to ZIO10.
Best Regards,
James. -
Uploading data from a xlsx file into an Oracle table
Hi All,
I want to know what would be the best approach and tool to upload the data from an xlsx (excel) sheet into an Oracle table.
Can I use 'sqlldr'?
~ParagParag Kalra wrote:
What if the excel sheet is exported from some other third party database and not explicitly generated on Windows? I know if we can export it to excel why can't we also export it to csv but what if that option is also not available.
Also what things do I need to take into account when I export a xlsx file to csv file. I mean I hope in no circumstances there would be a data loss.How about instead of of these "what ifs" and "I hopes" you tell us exactly what you have to work with and describe the real business problem. If you ask the wrong questions, you get the wrong answers.
You "hope" that there would be no data loss? Do you really think Excel would survive as a product, much less be the overwhelming dominant product of its type, if it screwed up something that fundamental? The only thing that will be lost is the formatting meta-data. -
Loading data from two flat files into one table
Hi All,
I want to load few fields from one file and few fields from another file and load the data into one table in the database.
For Ex: I have two flat files file1.csv and file2.csv and file1.csv containes 25 columns and file2.csv containes 12 columns, i want to load 20 columns from file1.csv and 7 columns from file2.csv into the table
how to combine the columns from both the files and load them into one table at a time?
Any help is appriciated
Thanks
R.GUse external tables.
If using Oracle9 or higher connect both your csv with database as separate external tables and load the requited fields in new/requited table. -
I posted a query on Importing data from Microsoft Excel to Oracle Database (Multiple Data Tables). I got some answer and reference from the forum.
I presented to my Oracle consultant and representative from Oracle Malaysia. They said impossible. I do not believe what they said. I do believe can be done.
Can someone help or direct me to an expert that can help me on thise90f478a-c529-4c48-b189-51eebeaed477 wrote:
I posted a query on Importing data from Microsoft Excel to Oracle Database (Multiple Data Tables). I got some answer and reference from the forum.
I presented to my Oracle consultant and representative from Oracle Malaysia. They said impossible. I do not believe what they said. I do believe can be done.
Can someone help or direct me to an expert that can help me on this
We don't know the "query on Importing data from Microsoft Excel to Oracle Database (Multiple Data Tables). "
We don't know where you posted said query.
We don't know what "some answer and reference" you received "from the forum."
We don't know what it was that your "Oracle consultant and representative from Oracle Malaysia" said was "impossible".
So on what basis are we supposed to "help or direct" to "to an expert that can help "? -
What is the best way to load and convert data from a flat file?
Hi,
I want to load data from a flat file, convert dates, numbers and some fields with custom logic (e.g. 0,1 into N,Y) to the correct format.
The rows where all to_number, to_date and custom conversions succeed should go into table STG_OK. If some conversion fails (due to an illegal format in the flat file), those rows (where the conversion raises some exception) should go into table STG_ERR.
What is the best and easiest way to archive this?
Thanks,
Carsten.Hi,
thanks for your answers so far!
I gave them a thought and came up with two different alternatives:
Alternative 1
I load the data from the flat file into a staging table using sqlldr. I convert the data to the target format using sqlldr expressions.
The columns of the staging table have the target format (date, number).
The rows that cannot be loaded go into a bad file. I manually load the data from the bad file (without any conversion) into the error table.
Alternative 2
The columns of the staging table are all of type varchar2 regardless of the target format.
I define data rules for all columns that require a later conversion.
I load the data from the flat file into the staging table using external table or sqlldr without any data conversion.
The rows that cannot be loaded go automatically into the error table.
When I read the data from the staging table, I can safely convert it since it is already checked by the rules.
What I dislike in alternative 1 is that I manually have to create a second file and a second mapping (ok, I can automate this using OMB*Plus).
Further, I would prefer using expressions in the mapping for converting the data.
What I dislike in alternative 2 is that I have to create a data rule and a conversion expression and then keep the data rule and the conversion expression in sync (in case of changes of the file format).
I also would prefer to have the data in the staging table in the target format. Well, I might load it into a second staging table with columns having the target format. But that's another mapping and a lot of i/o.
As far as I know I need the data quality option for using data rules, is that true?
Is there another alternative without any of these drawbacks?
Otherwise I think I will go for alternative 1.
Thanks,
Carsten. -
Load XML data from UNIX Server Directly into Relational Database Tables
Is there a way I can load data from an XML File into Oracle Tables , without having the Input XML file in some Oracle Server Directory. My XML File resides on UNIX Application server. And I need to directly load the data into Database tables. Without loading them into the Database Directory.
Also I am looking for a solution that would not load my Database much and effect other running processes. Can it be done using SQL Loader ?
Oracle Database Version is : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionThanks for your reply ,
Please would you quote an Example about : 'Load the file into that table using SQL*Loader' (From UNIX Server) Or instance of some existing thread that relates to my situation.
The Size of the File would be about 3 GB. For a similar requirement one of my peers Code which used XMLTABLE and XPATH Approach consumed a lot of resources while running and caused the other Database Applications to slow down. Thus those guys have come up with an approach to :
Parse XML using a C Code using some STRING Functions => For a CSV or Fixed width .dat file and then use SQL Loader to just load the file into Tables.
This approach is efficient in terms of Resources and Time(Takes 5 mins). But I am not confident about parsing XML based on String based C Functions.
Please comment about this approach . Also if possible Suggest the best efficient way of doing this. -
Problem in the BDC program to upload the data from a flat file.
Hi,
I am required to write a BDC program to upload the data from a flat file. The conditions are as mentioned below:-
1) Selection Screen will be prompted to user and user needs to provide:- File Path on presentation server (with F4 help for this obligatory parameter) and File Separator e.g. @,#,$,%,... etc(fields in the file will be separated by using this special character) or fields may be separated by tab(tab delimited).
2) Finally after the data is uploaded, following messages need to be displayed:-
a) Total Number of records successfully uploaded.
b) Session Name
c) Number of Sessions created.
Problem is when each record is fetched from flat file, the record needs to be split into individual fields separated by delimiter or in case tab separated, then proceeding in usual manner.
It would be great if you provide me either the logic, pseudocode, or sample code for this BDC program.
Thanks,Here is an example program, if you require the delimitor to be a TAB, then enter TAB on the selection screen, if you require the delimitor to be a comma, slash, pipe, whatever, then simply enter that value. This example is simply the uploading of the file, not the BDC, I assume that you know what to do once you have the data into the internal table.
REPORT zrich_0001.
TYPES: BEGIN OF ttab,
rec TYPE string,
END OF ttab.
TYPES: BEGIN OF tdat,
fld1(10) TYPE c,
fld2(10) TYPE c,
fld3(10) TYPE c,
fld4(10) TYPE c,
END OF tdat.
DATA: itab TYPE TABLE OF ttab.
data: xtab like line of itab.
DATA: idat TYPE TABLE OF tdat.
data: xdat like line of idat.
DATA: file_str TYPE string.
DATA: delimitor TYPE string.
PARAMETERS: p_file TYPE localfile.
PARAMETERS: p_del(5) TYPE c.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
DATA: ifiletab TYPE filetable.
DATA: xfiletab LIKE LINE OF ifiletab.
DATA: rc TYPE i.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = ifiletab
rc = rc.
READ TABLE ifiletab INTO xfiletab INDEX 1.
IF sy-subrc = 0.
p_file = xfiletab-filename.
ENDIF.
START-OF-SELECTION.
TRANSLATE p_del TO UPPER CASE.
CASE p_del.
WHEN 'TAB'.
delimitor = cl_abap_char_utilities=>horizontal_tab.
WHEN others.
delimitor = p_del.
ENDCASE.
file_str = p_file.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = file_str
CHANGING
data_tab = itab.
LOOP AT itab into xtab.
CLEAR xdat.
SPLIT xtab-rec AT delimitor INTO xdat-fld1
xdat-fld2
xdat-fld3
xdat-fld4.
APPEND xdat to idat.
ENDLOOP.
LOOP AT idat into xdat.
WRITE:/ xdat-fld1, xdat-fld2, xdat-fld3, xdat-fld4.
ENDLOOP.
Regards,
Rich Heilman
Maybe you are looking for
-
Add search help to standard field in shopping cart
Hi Experts, We are on a SRM 5.0 implementation for classic scenario. In the item basic details we have a field tracking number. (BE_TRACKING_NO). We have a requirement to add a search help (drop down with fixed values) to this field. Is this possible
-
I'm trying to build a update statement with different operator which setup from a table and passed. Not sure how to build it. Please help PROCEDURE my_update p_id IN NUMBER, p_var1 IN NUMBER, my_value IN VARCHAR2, m
-
How to stream JPG Images?
Hello, I am looking to stream jpg images from a program my friend made. The format he sends is 4 bytes header then the jpg image, and I would prefer not to change this if I don't have to. I have created some code to do this, but I am unable to get to
-
[SOLVED] systemd: What does "status=226/NAMESPACE" mean?
/var/log is on tmpfs here, and Apache refuses to start without /var/log/httpd already being created, so I am trying to create that folder from http.service. I added the line: ExecStartPre=/usr/bin/mkdir -p /var/log/httpd Now I am getting a "status=2
-
New Hiphop/Rap/R&B Playlist ! Looking for feedback/followers
Just created my first public playlist! Added it on to my website (www.questionnoir.com/pressplay) Would love to hear what the spotify community has to say about it! Any feedback is greatly appreciated!Any suggestions to add on some more music? Hows