Two flat files to table
I have an problem with two plat file to table.
here i am sending two flat file inthe sence just some spcified filedslike
MY first file is Like
Name City
Jerry Delhi
Second file is like
CIty Country
Vincent USA
So these two are club and populate on Oracle table(Target Table)
I taken the two datastores and put it into source when i trying to maping showing
error like "Technology cannot be an expression."
So please can any can give sugession for these.
Thanks advance.
for this problem,
follow the steps:-
1.)drag the two data stores(ur two files) onto source area
2.)join the common column between them just by clicking
and make it sure that in properties of this join execute on option is set to
staging area
3.)now drag the target colum to target
4.)map the coresponding fields from two source data stores to target data store
(again make it sure that in properties of each column of target data storeexecute on option is set to
staging area)
now simply excute...
and it will work
Similar Messages
-
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. -
Conversion of Flat file to tables in oracle
hi
i am doing my project in oracle and i have got stuck up at a point where i have to convert flat files to tables in oracle
Please suggest a solution for the above problem
Regards,
MaheshHi,
Sql*Loader, to load data from file to an oracle internal table
or
External table (from 9i and later), to query directly the file like an other internal table
Nicolas. -
Ssis - import data from flat file to table (sql server 2012)
i have create a ssis for importing data from flat file to table in sql server 2012.
but i got the below error for some column in data flow task.
error: cannot processed because than one code page (950 and 1252)
anyone helps~Hi,
The issue occurs because the source flat file uses ANSI/OEM – Tranditional Chinese Big5 encoding. When processing the source file, the flat file connection manager uses code page 950 for the columns. Because SQL Server uses code page to perform conversions
between non-Unicode data and Unicode data, the data in the code page 950 based input columns cannot be loaded to code page 1252 based destination columns. To resolve the issue, you need to load the data into a SQL Server destination table that includes Unicode
columns (nchar or nvarchar), and convert the input columns to Unicode columns via Data Conversion or the Advanced Editor for the Flat File Source at the same time.
Another option that may not be that practical is to create a new database based on the Chinese_Taiwan_Stroke_BIN collation, and load the data to non-Unicode columns directly.
Reference:
http://social.technet.microsoft.com/Forums/windows/en-US/f939e3ba-a47e-43b9-88c3-c94bdfb7da58/forum-faq-how-to-fix-the-error-the-column-xx-cannot-be-processed-because-more-than-one-code-page?forum=sqlintegrationservices
Regards,
Mike Yin
TechNet Community Support -
Loading data from flat file to table
Hi,
I am using OWB 10g R2. I have to develop a map which loads data from flat file to table.
1. I have created a .csv file.
2. Import that into OWB by Module Wizard.
3. I have created one external table, which use the .csv file.
After that what I have to do for successfully loading the data into table.
Regards,
SanjoyHi Sanjoy
You can building a mapping to move the data from somewhere to somewhere else. More specifically;
1. create a mapping
2. add external table to mapping
3. add table to mapping for target (it can be unbound)
4. map from external table ingroup to target table ingroup (all columns will be mapped)
5. if target table was unbound right click on target table and click create and bind
This is a basic mapping you can have for this scenario. There is a post here which does something like this, but it will create a File to Table mapping which will use SQLLoader.
http://blogs.oracle.com/warehousebuilder/2009/01/expert_useful_scripts_from_simple_primitives.html
Cheers
David -
XML to Flat File DB Table So I and Others Can Use SSRS for Reporting
I'm using a program called Orbeon Forms to quickly create and distribute forms on the local network.
The program just recently got updated to Version 4.6 so as to use SQL Server DB as a backend. (I was using MySQL in a lower versions)
The data created when you submit a form into the database is held in xml fomat in one of the columns. (see below).
I am trying to create a separate table, to pull that data from the xml column (for that particular form) and place it in to a seperate table using the xml tags as columns.
I have no idea where to start or how to do this. Please keep in mind I'm a novice when it comes to sql server (but I do know how to do select statements :-)....
Is this very difficult to do? If it is (for me at least) where can I go to get someone to do it for me along with the documentation to do it? I was also thinking of a way to create a trigger on the Orbeon table (this is how it is setup currently in
the MySQL database) to automagically insert any saved form data to the new form data table. Is this also difficult to do? And can I have a trigger for each form I create on the table?
If anyone can help, I'd appreciate it. Thanks.
I would eventually like to add the form data from the old MySQL database table into this new Orbeon table but it appears the upgrade also added two extra columns. I figuring once in the Orbeon table then I will have to run whatever statements to place into
the separate table so I can use the data.
Randy MarreroErland thanks for the reply. Even after reviewing the link you sent I'm still having problems. Guess that is why I'm not a programmer. Anyway I've create a test data form xml I've created and it is copy and pasted below.
Again I'm only really interested seeing if I can get the information out of the xml and create it in its own flat file table. I keep reading that creating a trigger (when the form gets submitted into this database in the xml format, an on insert trigger
would take all the data submitted and inserted into another table with just the data, into separate columns) for this is the best way but I'm not sure how to do this either. I have a copy of what the MySQL trigger would look like but keep running
into errors when I try to run it in SQL Server. Also the issue with how I would create another trigger if / when I create another form. I read somewhere I can only create one on insert trigger per table, still don't know this to be true. Anyway below
is the xml as it is in the xml table in the database.
XML STARTS HERE------------------
<
formxmlns:oxf="http://www.orbeon.com/oxf/processors"xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"xmlns:xh="http://www.w3.org/1999/xhtml"xmlns:xi="http://www.w3.org/2001/XInclude"xmlns:ev="http://www.w3.org/2001/xml-events"xmlns:saxon="http://saxon.sf.net/"xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:odt="http://orbeon.org/oxf/xml/datatypes"xmlns:fb="http://orbeon.org/oxf/xml/form-builder"xmlns:xxf="http://orbeon.org/oxf/xml/xforms"xmlns:xbl="http://www.w3.org/ns/xbl"xmlns:xpl="java:org.orbeon.oxf.pipeline.api.FunctionLibrary"xmlns:sql="http://orbeon.org/oxf/xml/sql"xmlns:p="http://www.orbeon.com/oxf/pipeline"xmlns:fr="http://orbeon.org/oxf/xml/form-runner"xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xf="http://www.w3.org/2002/xforms"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:exf="http://www.exforms.org/exf/1-0">
<
Header>
<
HHIFR_Patch>/fr/service/persistence/crud/bfp/permits/form/738433584d6c0aff25e0ab8ca1bd99bcc7e10b49.bin</HHIFR_Patch>
</
Header>
<
Permit_Number_Hdr>
<
Permit_Number>Test123</Permit_Number>
</
Permit_Number_Hdr>
<
Permit_Info_Hdr>
<
Permit_Date>2014-07-15-05:00</Permit_Date>
<
Permit_Station>HQ</Permit_Station>
<
Permit_Employee_Number>0676</Permit_Employee_Number>
<
Permit_Status>Active</Permit_Status>
<
Employee_Name>Randy
Marrero</Employee_Name>
</
Permit_Info_Hdr>
<
Applicant_Info_Hdr>
<
Applicant_Name>Randy
Marrero</Applicant_Name>
<
Applicant_Phone>8434741099</Applicant_Phone>
<
Applicant_Email>[email protected]</Applicant_Email>
</
Applicant_Info_Hdr>
<
Mailing-Address-Section>
<
Mailing_Address>40
Summit Dr</Mailing_Address>
<
Mailing_Suite/>
<
Mailing_City>Hilton
Head Island</Mailing_City>
<
Mailing_State>SC</Mailing_State>
<
Mailing_Zip>29926</Mailing_Zip>
</
Mailing-Address-Section>
<
Physical_Burn_Hdr>
<
Physical_Address>35
Summit Dr</Physical_Address>
<
Physical_Suite/>
<
Physical_City>Hilton
Head Island</Physical_City>
<
Physical_State>South
Carolina</Physical_State>
<
Physical_Zip>29926</Physical_Zip>
</
form>
XML ENDS HERE ------------
Randy Marrero -
Getting error while loading flat file into table.
I am using ODI 11 and i am trying to load data in oracle database table using source as flat .txt file .
When i execute the interface , i am getting below errors.
ODI-1217: Session INF_FILE2TAB (31022) fails with return code 7000.
ODI-1226: Step INF_FILE2TAB fails after 1 attempt(s).
ODI-1240: Flow INF_FILE2TAB fails while performing a Loading operation. This flow loads target table PARTNER.
Caused By: org.apache.bsf.BSFException: exception from Jython:
Traceback (most recent call last):
File "<string>", line 44, in <module>
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:540)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:202)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1074)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1466)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:2224)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:2168)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:333)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
java.sql.SQLException: java.sql.SQLException: ORA-06564: object DAT_DIR does not exist
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:346)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2458)
at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:48)
at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
at java.lang.Thread.run(Thread.java:662)
Please let me know pointers on this.Yes,after your sugestion i have created ODI agent and tested the file system connection in topology. It was connected successfully.
but when i tried again for file to table load. Again got below error.
org.apache.bsf.BSFException: exception from Jython:
Traceback (most recent call last):
File "<string>", line 44, in <module>
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:540)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:202)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1074)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1466)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:2224)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:2168)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:333)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
java.sql.SQLException: java.sql.SQLException: ORA-06564: object DAT_DIR does not exist
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:346)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2458)
at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:48)
at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
at java.lang.Thread.run(Thread.java:662)
Please suggest. -
Mapping flat file and table to a target table
Hi all
I need to join a db table and a flat file as source and output (target) it to a db table. I know we can do it through external tables, however at this juncture we have to do it through flat files only.
Thanks
PCYou'll have load the Flat File data into a dummy table first. Then, You join this dummy table with the other db table in the same mapping.
Any question, lemme know.
Marcos -
Flat file to table - send mail report on error
Hello,
I've created simple project - loading data from csv flat file to oracle database table, using this tutorial: http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_11g/odi_project_flatfile-to-table/odi_project_flatfile-to-table.htm. Now, I need to add support for sending mail to this project. Mail, with error descritpion should be sent to Administrator via smtp server when error occurs.
Can you provide any step by step description how to add this feature in my case? I know this should be possible via ODISendMail, but I was unable to find any basic, step by step tutorial. Can you help me?960949 wrote:
Ok, so is there any other solution to send mail? I found this post: Send Jython HTML Email Error but link to procedure is inactive: https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=HOWTO&id=424304.1
You need to login to My Oracle Support in order to download the procedure code .
For this you need a valid Oracle CSI -
Flat file to tables (insert/update/delete) using utl file.--urgent
Hi all,
Scenorio s here ...
ex : emp
EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
STATUS -- i/U/d
flat file records willbe like this ....
I^001^name^job^manager^10-dec-2002^90000^900^^
I^001^name^job^manager^10-dec-2002^90000^900^343^
U,002^name^job^manager^10-dec-2002^90000^900^899^900
U,002^name^job^manager^10-dec-2002^90000^900^899^900
The first record indicator show I , so need to insert into the table emp.The second record indicator show U , so need to update the table emp.like this i've 5 tables(different structure and large data ).
How do i upload data into concern tables using procedures using UTL_file.
Needs to generalised the processing (for each table specific)..........
(me right now doing this way...in a pakage with UTL_FILE using pl/sql tables,parsing the record by record ,
storeing the values in a pl/sql table then insert/updates....)
any sugg'n ? idea? sample code ?
Thanx OTN members.Hi Ganesan,
Hope it will help.
Best Regards
CREATE OR REPLACE PROCEDURE TEST_UTL
loc_input_file varchar2(30) ;
loc_input_path varchar2(30) ;
loc_utl_file UTL_FILE.FILE_TYPE;
loc_get_data varchar2(500);
BEGIN
loc_utl_file := UTL_FILE.FOPEN(loc_input_path, loc_input_file, R');
BEGIN
LOOP
UTL_FILE.GET_LINE(loc_utl_file,loc_get_data);
IF SUBSTR(loc_get_data,1,1) = 'I' THEN
INSERT INTO ..........
-- USE SUBSTR function for columng break
ELSIF SUBSTR(loc_get_data,1,1) = 'U' THEN
UPDATE ....................
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
UTL_FILE.FCLOSE(loc_utl_file);
END ;
EXCEPTION
END; -
Create source structure -Need to create flat file or table?
Hi All,
Can any one let me know what needs to be created?? it should be flat file or a table on the data base?
I am going to reecive flat files from the source system??
If it is a flat file then is there any way to create flat file structure in the DS using SQL query statements?
Thanks
Rajeevyou can create table same as file structure and use the table instead, but how are you going to populate the table with the data from flat file ? you will need some application to do that, you can do this is DS by creating a file format and using the source file as input for that file format and create a template table as target for the database datastore to wihch you want to load data from this source file, and use that table as source in other dataflows
you can also create the table with the same structure in the database and import that in Datastore and use that as target for the source file -
How to cretae two flat file with a single program
Hi All,
I am trying to creating to two files on the application server using the open data set and close data.
lets say the first file is file1 and second file is file2. but when i go to the Tcode AL11 and check the file only second file is appears there.
its may be coz i m using two times this open data and close data in my program.
can u tell help me howz these two file is appears on the application server i.e AL11.
its very urgent pls help me.
Thanks!
VipinHi Do one thing,
Start ur program in debugging mode complete first open data set and close data set and then go and chekc whehter the file got created or not and also check the sy-subrc values when u r doing ur open data set.
if the first file is not done then no file will be in AL11 including ur new file name.
In this way you can find whether the file got created or not.
check that u r giving differnet file names fifferently otherwise it will be keep on overwriting the existing one.
Regards,
sasi -
Upload from flat file to table
Hi experts,
i need to upload the following file in a table with the columns names as field names in my database table
weekly_eft_repo 1.0 Page: 1
CDC:00304 / Sat Oct-31-2009 Weekly EFT Sweep for 25/10/09 - 31/10/09 Effective Date 03/11/09 Sat Oct-31-2009 22:06:14
*Bill to*
*Retailer Retailer Name Name on Bank Account Bank ABA Bank Acct On-line Amount Instant Amount Total Amount*
======== ============================== ============================== ========== ==================== =============== =============== ===============
0200101 Triolet Popular Store Triolet Popular Store 111111111 62030100130659 10,868.00 0.00 10,868.00
0200103 Le Cacharel Snack Le Cacharel Snack 111111111 62030100130813 9,728.00 0.00 9,728.00
0200104 Advanced Co-operative Self Ser Advanced Co-operative Self Ser 111111111 111111111 7,334.00 0.00 7,334.00
0200105 Chez Popo Supermarket Chez Popo Supermarket 111111111 61030100044898 30,932.00 0.00 30,932.00
0200106 Vana Supermarket Vana Supermarket 111111111 111111111 17,775.00 0.00 17,775.00
0200107 Mont Choisy Store Mont Choisy Store 111111111 62030100130804 8,840.00 0.00 8,840.00
0200108 Vijay Store Vijay Store 111111111 62030100131229 16,416.00 0.00 16,416.00
0200109 Neptune Confection Neptune Confection 111111111 62030100130931 11,077.00 0.00 11,077.00
0200110 Antoine Store Antoine Store 111111111 111111111 2,470.00 0.00 2,470.00Database table
TABLE weekly_eft_report_temp
Name Null? Type
BILL_TO_RETAILER NOT NULL VARCHAR2(15)
RETAILER_NAME VARCHAR2(100)
NAME_ON_BANK_ACCOUNT VARCHAR2(100)
BANK_ABA VARCHAR2(1)
BANK_ACCT VARCHAR2(1)
ON_LINE_AMOUNT NUMBER
INSTANT_AMOUNT NUMBER
TOTAL_AMOUNT NUMBER I am having lots of difficulty in doing so. Can anyone plz help me. ThanksHi Damorgan,
I am having a little problem with my external table though and dont seem to find the solution. can you help me on this one please.
For my external table
create table weekly_eft_temp
(line varchar2(4000))
ORGANIZATION EXTERNAL (
TYPE oracle_loader
DEFAULT DIRECTORY GTECHFILES
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
CHARACTERSET WE8MSWIN1252
BADFILE 'weekly_eft.bad'
DISCARDFILE 'weekly_eft.dis'
LOGFILE 'weekly_eft.log'
FIELDS TERMINATED BY X'0D' RTRIM
REJECT ROWS WITH ALL NULL FIELDS
line char(4000)
LOCATION ('weekly_eft_report_c00381.rep')
PARALLEL
REJECT LIMIT UNLIMITED ;There is no problem with this. My external table is populated ok.
My problem lies in my sql query. I am not able seperate my field so that they can be inserted into their appropriate fields in my table
INSERT INTO weekly_eft_report_temp
(Bill_to_Retailer ,
Retailer_Name ,
Name_on_Bank_Account ,
Bank_ABA ,
Bank_Acct ,
On_line_Amount ,
Instant_Amount ,
Total_Amount ,
CDC ,
SOURCE ,
INSERTED_DATE ,
UPLOADED
select
case when Bill_to_Retailer is null then lag(RETAILER_NO, decode(PRODUCT, ''Loto'', 1, ''Inst Tk'', 2 )) over (order by line_no) else null end as RETAILER_NO,
Bill_to_Retailer ,
Retailer_Name ,
Name_on_Bank_Account ,
Bank_ABA ,
Bank_Acct ,
On_line_Amount ,
Instant_Amount ,
Total_Amount ,
'00381' ,
'weekly_eft_report_c00381.rep' ,
sysdate ,
'N'
from (
select
Bill_to_Retailer ,
Retailer_Name ,
Name_on_Bank_Account ,
Bank_ABA ,
Bank_Acct ,
On_line_Amount ,
Instant_Amount ,
Total_Amount
from
( select
rownum as line_no,
regexp_substr(line, '[^ ]+', 1, 1) as Bill_to_Retailer ,
regexp_substr(line, '[^ ]+', 1, 2) as Retailer_Name ,
regexp_substr(line, '[^ ]+', 1, 3) as Name_on_Bank_Account ,
regexp_substr(line, '[^ ]+', 1, 4) as Bank_ABA ,
regexp_substr(line, '[^ ]+', 1, 5) as Bank_Acct ,
regexp_substr(line, '[^ ]+', 1, 6) as On_line_Amount ,
regexp_substr(line, '[^ ]+', 1, 7) as Instant_Amount ,
regexp_substr(line, '[^ ]+', 1, 8) as Total_Amount
from weekly_eft_temp )
-- where regexp_like(line, '^( +Bill to Retailer)')
The result of my query is as follows:
weekly_eft_repo 1.0 L o t t o t
CDC:00381 / Sat Jan-16-2010 Weekly EFT Sweep for
Bill to
Retailer Retailer Name Name on Bank Account Bank
======== ============================== ============================== ========== ==================== =============== =============== ===============
0200101 Triolet Popular Store Triolet Popular Store 111111111
0200103 Le Cacharel Snack Le Cacharel Snack 111111111
0200104 Advanced Co-operative Self Ser Advanced Co-operative Self
0200105 Chez Popo Supermarket Chez Popo Supermarket 111111111
0200106 Vana Supermarket Vana Supermarket 111111111 62030100133937 37,636.00
0200107 Mont Choisy Store Mont Choisy Store 111111111
0200108 Vijay Store Vijay Store 111111111 62030100131229 30,948.00
0200109 Neptune Confection Neptune Confection 111111111 62030100130931 23,769.00
0200110 Antoine Store Antoine Store 111111111 62030100134575 35,048.00
0200111 P.S.C Cold Storage P.S.C Cold Storage 111111111
0200113 Mini Prix Boutique Mini Prix Boutique 111111111
0200114 Hotel Cassim Hotel Cassim 111111111 62030100133914 171,802.00
0200116 Aman Snack Aman Snack 111111111 62030100129481 32,224.00
0200117 Best For Less Company Ltd Best For
0200118 Central Way Central Way 111111111 111111111 34,956.00
0200119 Amba Veerapen Amba Veerapen 111111111 62030100129436 35,817.00
0200121 Tang Way Tang Way 111111111 111111111 117,542.00
0200122 Football Pools Collector Football Pools Collector 111111111
0200123 Kim Lee Kim Lee 111111111 62030100129422 19,782.00
0200126 Chez Andrex Chez Andrex 111111111 11111111 141,732.00
0200127 Sungkoora Pools & Lottery Hous Sungkoora PoolsThe problem is that is that i want to take data only after the ====== and also it is seperating the names which is right. Can you please help me. Many thanks -
Uploading data from flat file to table control
HI All,
I want to upload data to OVKK tcode using BDC. For this I wrote Z program as shown below:
REPORT ZSD_BDC_OVKK_UPLOAD
NO STANDARD PAGE HEADING LINE-SIZE 255.
*INCLUDE bdcrecx1.
DATA : BEGIN OF T_DUMMY OCCURS 0,
VAR(100) TYPE C,
END OF T_DUMMY.
DATA: BEGIN OF ITAB OCCURS 0,
KALSM(10) TYPE C,
* KARTV(10) TYPE C,
VKORG(4) TYPE C,
VTWEG(2) TYPE C,
SPART(2) TYPE C,
KALVG(1) TYPE C,
KALKS(1) TYPE C,
KALSM(6) TYPE C,
KARTV(4) TYPE C,
END OF ITAB.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : v_filename TYPE string.
PARAMETER : filename LIKE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
field_name = filename
CHANGING
file_name = filename.
START-OF-SELECTION.
v_filename = filename.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = T_DUMMY.
LOOP AT T_DUMMY.
ITAB-VKORG = T_DUMMY-VAR+0(4).
ITAB-VTWEG = T_DUMMY-VAR+5(2).
ITAB-SPART = T_DUMMY-VAR+8(2).
ITAB-KALVG = T_DUMMY-VAR+11(1).
ITAB-KALKS = T_DUMMY-VAR+13(1).
ITAB-KALSM = T_DUMMY-VAR+15(6).
ITAB-KARTV = T_DUMMY-VAR+22(4).
APPEND ITAB.
ENDLOOP.
DATA: FNAM(20) TYPE C,
IDX TYPE C.
MOVE 1 TO IDX.
LOOP AT ITAB.
REFRESH IT_BDCDATA.
PERFORM bdc_dynpro USING 'SAPML080Z' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_T683V-KALSM(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=NEWL'.
PERFORM bdc_dynpro USING 'SAPML080Z' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_T683V-VKORG(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
CONCATENATE 'V_T683V-KALSM(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-kalsm.
CONCATENATE 'V_T683V-KARTV(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-kartv.
CONCATENATE 'V_T683V-VKORG(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-vkorg.
CONCATENATE 'V_T683V-VTWEG(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-vtweg.
CONCATENATE 'V_T683V-SPART(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-spart.
CONCATENATE 'V_T683V-KALVG(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-kalvg.
CONCATENATE 'V_T683V-KALKS(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-kalks.
PERFORM bdc_dynpro USING 'SAPLSTRD' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KO008-TRKORR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=LOCK'.
PERFORM bdc_field USING 'KO008-TRKORR'
'D47K919377'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_T683V-VKORG(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_T683V-VKORG(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
CALL TRANSACTION 'OVKK' USING IT_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
IDX = IDX + 1 .
endloop.
FORM BDC_DYNPRO USING PROG SCR.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROG.
IT_BDCDATA-DYNPRO = SCR.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM.
I checked in debugging mode and found that data is passed to internal table but its not uploading data to OVKK, there no data is displayed.
Please tell me solution for this.....
regards,
ravindra.Hi,
Look at the following link you will find some good example of Table control.
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
Here you need to take care to which line of table control you are populating the data.
Make sure to take care of page down in table control.
*********Try Call Transaction in MODE 'N'.
Check your OK_CODE once again.
Try to give BACk also after saving.
The Table control is mainly used to update no.of line items at one shot. No need to come BACK for each and every record.
Try to do recording in SHDB once again and see the changes closely.
Thanks.
If this helps you reward with points.
Message was edited by: KDeepak
Message was edited by: KDeepak -
Exporting tables to flat files
Hi,
Can I export tables to flat files(csv) using pl/sql. I mean suppose I have 2 tables 'student' and 'subject' and I want to create two flat files student.csv and subject.csv Please let me know, if I can do it using pl/sql for both the tables in one go.
Even if I can do it for one table, than I can write a script to automate for all the tables. Please let me know with your suggestions. Appreciate your help.
ThanksAs sys user:
CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
/As myuser:
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
,p_dir IN VARCHAR2
,p_header_file IN VARCHAR2
,p_data_file IN VARCHAR2 := NULL) IS
v_finaltxt VARCHAR2(4000);
v_v_val VARCHAR2(4000);
v_n_val NUMBER;
v_d_val DATE;
v_ret NUMBER;
c NUMBER;
d NUMBER;
col_cnt INTEGER;
f BOOLEAN;
rec_tab DBMS_SQL.DESC_TAB;
col_num NUMBER;
v_fh UTL_FILE.FILE_TYPE;
v_samefile BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
BEGIN
c := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
d := DBMS_SQL.EXECUTE(c);
DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
ELSE
DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
END CASE;
END LOOP;
-- This part outputs the HEADER
v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
FOR j in 1..col_cnt
LOOP
v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
END LOOP;
-- DBMS_OUTPUT.PUT_LINE(v_finaltxt);
UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
IF NOT v_samefile THEN
UTL_FILE.FCLOSE(v_fh);
END IF;
-- This part outputs the DATA
IF NOT v_samefile THEN
v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
END IF;
LOOP
v_ret := DBMS_SQL.FETCH_ROWS(c);
EXIT WHEN v_ret = 0;
v_finaltxt := NULL;
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
ELSE
v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
END CASE;
END LOOP;
-- DBMS_OUTPUT.PUT_LINE(v_finaltxt);
UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
END LOOP;
UTL_FILE.FCLOSE(v_fh);
DBMS_SQL.CLOSE_CURSOR(c);
END;This allows for the header row and the data to be written to seperate files if required.
e.g.
SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
PL/SQL procedure successfully completed.Output.txt file contains:
empno,ename,job,mgr,hiredate,sal,comm,deptno
7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
Adapt to output different datatypes and styles are required.
Maybe you are looking for
-
Cannot display the data from a varaible in front end
hi, i not able to display the data in the table from the variable. steps how the module should work. In OEO: 1. data to be accepted from user, values to be passed to the program in database according to the data accepted. In Oracle Express: 2. values
-
Can update to 10.4.7 or later
Can you think of any reasons that I can not successfully install any systems updates past 10.4.6? This summer I tried installing 4.7, it crashed my system. Just the other day I tried 4.8 and the same thing happens. I can get them to install fine howe
-
Unable to run OpenScript Functional Scripts from OTM
Hi, I am unable to run OpenScript Functional Scripts from OTM, but the same script is running successfully on OpenScript. I have a script which has all my functions (say Script A) and I am calling these functions from a different script (Script B) an
-
Getting an application to start up automatically on start up
Is there a way or an option to get an application to start up when I switch my mac on? Any help? Thanks Paul Emac Mac OS X (10.3.9)
-
Can't open or run downloaded files
I can't open or run any files that I have downloaded through Firefox. I reset the profile, I uninstalled/reinstalled Firefox, I created a new profile, I changed the download location, I made a new downloads folder, etc. I think it is somehow being bl