Refreshing the data in a flat file
Hi
I am working on data integration.
I need to fetch data from Oracle data base and then write it to a flat file.
It is working fine now,but for the next fetch I don't need the old data to remain there in the file.The data should get refreshed and only the newly fetched data should be present.
After the data is written to the flat file can i rename the file?
I need the format of the file to be 'File_yyyyMMDDHHmmss.txt'.
My final question is how should I FTP this to the target?
Please help me on this as soon as possible since this is needed in an urgent part of the delivery.
All you ask is achievable:
1) The IKM SQL to file has a TRUNCATE option, which will if set to YES, will start from a clean file.
2) You could rename the file after writing it, but why not just write it with that name? If you set the resource name to be a variable, (e.g. #MyProj.MyFilename), and be sure to set the variable in the package before executing your interface, you should be able to get the file you want. Otherwise, you can use the OdiFileMove tool in your package to rename the file.
To set the name of the variable you can use a query on the database (if you are using Oracle, something like SELECT 'File_'||TOCHAR(SYSDATE) from DUAL.)
3) ODI has ftp classes built in- you can find the doc under doc\webhelp\en\ref_jython\jyt_ex_ftp.htm
Hope this helps
Message was edited by:
CTS
Similar Messages
-
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. -
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 -
Steps to load the data by using flat file for hierarchies in BI 7.0
Hi Gurus,
steps to load the data by using flat file for hierarchies in BI 7.0hi ,
u will get the steps int he following blog by Prakash Bagali
Hierarchy Upload from Flat files
regards,
Rathy -
Rejecting the Data to a flat file
Hi,
I want to reject the bad data to a flat file. For example, for primary key violation, the bad data should be loaded to a flat file, instead of giving the error and stopping my mapping job (after the error limit of 50).
Can I do this? Please do help me.
Thanks,
HarshaHi,
what is your actual requirement?
If you do not want the mapping to fail after raising the 50 errors, then configure your mapping and increase the value for Maximum number of errors tab under runtime parameters.
If you actually want to capture all the PK violations into a flat file, there is no direct way of doing this.
Either you have to query RT repository views (write your own sql) to produce a file OR
While in Mapping Configure window
expand Sources and Targets
expand constraint management
set Enable constraints to FALSE
set Exceptions Table Name <your own exceptions table>.
Have a look in Oracle Documentation for constraint management. That should give you an idea how to create your own exceptions table etc.
HTH
mahesh -
Updating Table using the data from a flat file
Hi,
I have a table called emp;
Name,
empno,
accountno,
amount.
This table is filled with values of name and empno.
The columns accountno and amount are empty.
I have a flat file created in some folder.
Contents of the flat file can be like this:
mani | 23 | 123 | 1000
spr | 22 | 342 | 2133
asjf | 54 | 432 | 2345
I need to access the file in the specified location, read all the records one after the other in the flat file and update the table "emp" with the values in the flat file.
Row after row all the records in the file should be updated to the table.
I found out some way to do this - its sqlloader - But it loads the data from a file to the table - i dont need that - i need to update the table.
Let me know how this can be solved ?????????
Thanks in advance.......Just to clarify Andrew's point, you can use external tables as the source table for an UPDATE statement. You cannot use them as a target for an UPDATE statement (i.e. you can't update the text file from an Oracle table).
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Extracting the date from a flat file name in OWB
Hi,
I have a particular scenario, where I need to retrieve the date value from the name of the flat file and load it into a table, as a field in the target table. Is it possible to do this directly in owb. Your help would be appreciated.
regards,
varsha-- Product : Oracle Warehouse Builder
-- Generator Version : 10.1.2.3.63
-- Created Date : Mon May 15 20:07:54 IST 2006
-- Modified Date : Mon May 15 20:07:54 IST 2006
-- Created By : owbbeta4
-- Modified By : owbbeta4
-- Generated Object Type : EXTERNAL TABLE
-- Generated Object Name : CUSTEXTERNALTABLE
-- Comments :
-- Copyright © 2000, 2006, Oracle. All rights reserved.
WHENEVER SQLERROR EXIT FAILURE;
CREATE TABLE "CUSTEXTERNALTABLE"
"C1" VARCHAR2(255),
"C2" VARCHAR2(255),
"C3" DATE,
"C4" VARCHAR2(255),
"C5" VARCHAR2(255),
"C6" INTEGER
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY NCDEX_STG_LOCATION_TO_HOURLY
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
CHARACTERSET WE8MSWIN1252
STRING SIZES ARE IN BYTES
NOBADFILE
NODISCARDFILE
NOLOGFILE
FIELDS
TERMINATED BY ','
NOTRIM
"C1" ,
"C2" ,
"C3" CHAR DATE_FORMAT DATE MASK "DD/MM/YYYY",
"C4" ,
"C5" ,
"C6"
LOCATION (
'bp20042005.csv'
REJECT LIMIT UNLIMITED
NOPARALLEL
; -
Error occurred in the data uploading from Flat File in BPC NW
Hi,
I am doing Migration project from BPC MS to NW.
In this i am loading data from flat file to BPC NW. One error occured in this process that is Record Duplication.
Total 17000 records in that 7000 recards rejected by the reason of duplication.
The Information about Package Log
/CPMB/MODIFY completed in 0 seconds
/CPMB/CONVERT completed in 2 seconds
/CPMB/LOAD completed in 7 seconds
/CPMB/CLEAR completed in 0 seconds
[Selection]
FILE= DATAMANAGER\DATAFILES\Aprilmayjun_2011_Budget_V1.CSV
TRANSFORMATION= DATAMANAGER\TRANSFORMATIONFILES\ZAPRMAYJUN_2011BUDGET.xls
CLEARDATA= No
RUNLOGIC= Yes
CHECKLCK= No
[Messages]
Task name CONVERT:
No 1 Round:
Record count: 17064
Accept count: 17064
Reject count: 0
Skip count: 0
Task name LOAD:
Reject count: 7230
Submit count: 9834
Application: CorpBudget Package status: WARNING
Could you help me in this at the earliest.
Thanks and Regards
KrishnaHi,
You cannot send the duplicated with the standard import package. You need to create or add a new package and link to /CPMB/APPEND process chain and do the import. This would consider the duplicate entries also. It looks like you need somehow load all the records including the duplicate ones.
So on excel go to Manage Data -> Maintain Data management -> organize package list and add a new package and link to the standard BPC process chain /CPMB/APPEND.
Thanks,
Sreeni -
Transfer the data to a flat file
hi
i need to transfer the table in EBAN table in a user exit to a local text file. I am trying to use gui_download method of the class CL_GUI_FRONTEND_SERVICES. I am stuck at using the data_tab table. how do i define this. my data from the table eban has different formats. so how do i do this
thanksHi,
do this,
data DATA_TAB Type STANDARD TABLE of EBAN.
hope this solves the problem.
regards,
Advait -
Sqlplus – spool data to a flat file
Hi,
Does any oracle expert here know why the sqlplus command could not spool all the data into a flat file at one time.
I have tried below command. It seems like every time I will get different file size :(
a) sqlplus -s $dbUser/$dbPass@$dbName <<EOF|gzip -c > ${TEMP_FILE_PATH}/${extract_file_prefix}.dat.Z
b) sqlplus -s $dbUser/$dbPass@$dbName <<EOF>> spool.log
set feedback off
set trims on
set trim on
set feedback off
set linesize 4000
set pagesize 0
whenever sqlerror exit 173;
spool ${extract_file_prefix}.datFor me, this is working. What exactly are you getting and what exactly are you expecting?
(t352104@svlipari[GEN]:/lem) $ cat test.ksh
#!/bin/ksh
TEMP_FILE_PATH=`pwd`
extract_file_prefix=emp
dbUser=t352104
dbPass=t352104
dbName=gen_dev
dataFile=${TEMP_FILE_PATH}/${extract_file_prefix}.dat
sqlplus -s $dbUser/$dbPass@$dbName <<EOF > $dataFile
set trims on
set trim on
set tab off
set linesize 7000
SET HEAD off AUTOTRACE OFF FEEDBACK off VERIFY off ECHO off SERVEROUTPUT off term off;
whenever sqlerror exit 173;
SELECT *
FROM emp ;
exit
EOF
(t352104@svlipari[GEN]:/lem) $ ./test.ksh
(t352104@svlipari[GEN]:/lem) $ echo $?
0
(t352104@svlipari[GEN]:/lem) $ cat emp.dat
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
(t352104@svlipari[GEN]:/lem) $ -
Unload CLOB data to a flat file
Hi,
does anybody knows how to unload CLOB data to a flat file. Can u pl give a example. Is there any ulity in Oracle to unload data to a flat file. Whether we have to use the concatation operator for unloading the data to a flat file.
help??????
regards,
gopuI don't know if there's an easy way, but you might want to try using the packages UTL_FILE and DBMS_LOB.
Hope that helps. -
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. -
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. -
How to load data from a flat file which is there in the application server
HI All,
how to load data from a flat file which is there in the application server..Hi,
Firstly you will need to place the file(s) in the AL11 path. Then in your infopackage in "Extraction" tab you need to select "Application Server" option. Then you need to specify the path as well as the exact file you want to load by using the browsing button.
If your file name keeps changing on a daily basis i.e. name_ddmmyyyy.csv, then in the Extraction tab you have the option to write an ABAP routine that generates the file name. Here you will need to append sy-datum to "name" and then append ".csv" to generate complete filename.
Please let me know if this is helpful or if you need any more inputs.
Thanks & Regards,
Nishant Tatkar. -
Error while uploading master data attributes thru flat file
while uploading master data attributes thru flat file i am facing the below errow. can nyone let me know plz.
Error 8 when compiling the upload program: row 227, message: Data type /BIC/CCDEIO_MAT5_ATTR was found in a newThis just means that you changed the transfer rules/transfer structure and have not refreshed the workbench yet. The infopackage data hasn't been updated ... this is similar to a datasource update, where you need to replicate to make sure BW knows the latest version.
The best way to correct this error is to reload RSA1. Every time I make a change to the tr/ts, I always run /nrsa1 to refresh the workbench.
Brian
Maybe you are looking for
-
Flat-file and the pass-through pipeline
Hi there, I have a technical questions about the inner workings of BizTalk. The MSDN says that BizTalk is XML-centric and enything that is going through it and is posted to the MsgBox is converted to XML format. The question: Is this also true in
-
hello guys, I have a small question to ask, but first I must apologize for my English, I have the powerpc g5, dual processor 2.3GHz, with 16 gb ram, 1 samsung solid state drive with 250 GB, and other samsung sata with 500 gb, it's good but i like mor
-
Hi, I'm new to DVI monitors and cables. I just got my Mac pro with the ATI Radeon x1900xt, and just found out that my LCD monitors (LG 20inch) do not share the same DVI connectors as the graphic card. My flat panels' DVI connectors don't have the fou
-
Hello, I have been using Safari for some time, and have not had problems before now. Every time I try to use a website running Java I get the error message: "+Java is unavailable.+ +The page attempted to load Java content, but Java is unavailable or
-
hello how can i get the jre version & location from applet? is there any way for this? thanks bashar