DOWNLOAD CHEQUE FORMAT INTO A FLAT FILE
hi,
i have a requirement to download cheque format into a flat file.
as shown below. can any one guide me in this.
Check No. Date Payment Amt
1200175681 16/05/07 229.26 CAD
Pay TWO HUNDRED TWENTY NINE & 26/100*************************** CANADIAN D
To The MINISTER OF FINANCE
Order BARRIE SMALL CLAIMS COURT
Of 114 WORSLEY STREET
BARRIE ON L4M 1M1 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
BARRIESMCC 1200175681 16/05/07
Payee
MINISTER OF FINANCE
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
14/05/07 BARRIESMCC02MAY 0.00 CAD 229.26
Check No. Date Payment Amt
1200175682 16/05/07 149.96 CAD
Pay ONE HUNDRED FORTY NINE & 96/100**************************** CANADIAN D
To The BELLEVILLE ONTARIO HRDC
Order REMITTANCES
Of PO BOX 6767
MATANE QC G4W 4T1 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
BELLEVONHR 1200175682 16/05/07
Payee
BELLEVILLE ONTARIO HRDC
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
14/05/07 HRDCQC09MAY07 0.00 CAD 149.96
Check No. Date Payment Amt
1200175683 16/05/07 1,590.00 CAD
Pay ONE THOUSAND FIVE HUNDRED NINETY & 00/100****************** CANADIAN D
To The CANADIAN ENERGY EFFICIENCY
Order ALLIANCE
Of 2800 SKYMARK AVENUE
MISSISSAUGA ON L4W 5A6 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
CANENERGEF 02 1200175683 16/05/07
Payee
CANADIAN ENERGY EFFICIENCY
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
11/05/07 2117 0.00 CAD 1,590.00
Check No. Date Payment Amt
1200175684 16/05/07 8,701.83 CAD
Pay EIGHT THOUSAND SEVEN HUNDRED ONE & 83/100****************** CANADIAN D
To The CITY OF HAMILTON
Order ACCOUNTS RECEIVABLE
Of 120 KING ST WEST
SUITE 900, STANDARD LIFE BLDG ______________________________
HAMILTON ON L8P 4V2
Authorized Signature
Vendor ID Personnel ID Check No. Date
CITYHAMIL 01 1200175684 16/05/07
Payee
CITY OF HAMILTON
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
12/04/07 112949 0.00 CAD 8,701.83
Check No. Date Payment Amt
1200175685 16/05/07 23,104.38 CAD
Pay TWENTY THREE THOUSAND ONE HUNDRED FOUR & 38/100************ CANADIAN D
To The MINISTRY OF COMMUNITY AND
Order SOCIAL SERVICES, DIRECTOR
Of FAMILY RESPONSIBILITY OFFICE
PO BOX 2204 STATION P ______________________________
TORONTO ON M5S 3E9
Authorized Signature
Vendor ID Personnel ID Check No. Date
FAMILYREOF 1200175685 16/05/07
Payee
MINISTRY OF COMMUNITY AND
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
14/05/07 FRO02MAY07 0.00 CAD 23,104.38
Check No. Date Payment Amt
1200175686 16/05/07 553.85 CAD
Pay FIVE HUNDRED FIFTY THREE & 85/100************************** CANADIAN D
To The HAROLD MCQUAKER ENTERPRISES
Order LTD
Of BOX 538
EMO ON P0W 1E0 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
HAROLDMCEN 1200175686 16/05/07
Payee
HAROLD MCQUAKER ENTERPRISES
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
17/03/07 121 0.00 CAD 553.85
Check No. Date Payment Amt
1200175687 16/05/07 428,684.44 CAD
Pay **********428,684.44************************************* CANADIAN D
To The MERIDIAN CREDIT UNION
Order STE 160 S
Of 483 BAY ST
TORONTO ON M5G 2E1 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
HEPCOEDRUN 12 1200175687 16/05/07
Payee
MERIDIAN CREDIT UNION
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
14/05/07 MERIDIEN02MAY07 0.00 CAD 428,684.44
Check No. Date Payment Amt
1200175688 16/05/07 7,319.15 CAD
Pay SEVEN THOUSAND THREE HUNDRED NINETEEN & 15/100************* CANADIAN D
To The HYDRO ONE EMPLOYEES AND
Order PENSIONERS CHARITY TRUST
Of 483 BAY STREET 14TH FL
NORTH TOWER ______________________________
TORONTO ON M5G 2P5
Authorized Signature
Vendor ID Personnel ID Check No. Date
HYDROONEEP 1200175688 16/05/07
Payee
HYDRO ONE EMPLOYEES AND
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
14/05/07 CHARITY02MAY07 0.00 CAD 7,319.15
Check No. Date Payment Amt
1200175689 16/05/07 357.97 CAD
Pay THREE HUNDRED FIFTY SEVEN & 97/100************************* CANADIAN D
To The MINISTER OF FINANCE
Order KENORA SMALL CLAIMS COURT
Of 216 WATER STREET
KENORA ON P9N 1S4 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
KENORASMCC 1200175689 16/05/07
Payee
MINISTER OF FINANCE
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
14/05/07 KENORASMCC09MAY 0.00 CAD 357.97
Check No. Date Payment Amt
1200175690 16/05/07 692.41 CAD
Pay SIX HUNDRED NINETY TWO & 41/100**************************** CANADIAN D
To The MURRAY, WALTER
Order .
Of 1721 CEDAR LANE
BRACEBRIDGE ON P1L 1W9 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
MURRAYWALT 1200175690 16/05/07
Payee
MURRAY, WALTER
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
09/05/07 EXS2007710 0.00 CAD 692.41
Check No. Date Payment Amt
1200175691 16/05/07 2,437.44 CAD
Pay TWO THOUSAND FOUR HUNDRED THIRTY SEVEN & 44/100************ CANADIAN D
To The PACE, ROBERT
Order .
Of 5121 SACKVILLE ST, 7TH FLOOR
HALIFAX NS B3J 1K1 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
PACEROBERT 1200175691 16/05/07
Payee
PACE, ROBERT
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
09/05/07 EXS200711 0.00 CAD 2,437.44
Check No. Date Payment Amt
1200175692 16/05/07 2,718.35 CAD
Pay TWO THOUSAND SEVEN HUNDRED EIGHTEEN & 35/100*************** CANADIAN D
To The RECEIVER GENERAL FOR CANADA
Order CANADA CUSTOMS REVENUE AGENCY
Of 875 HERON RD
OTTAWA ON K1A 1B1 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
RECEIVEGEN 1200175692 16/05/07
Payee
RECEIVER GENERAL FOR CANADA
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
14/05/07 CRABNW02MAY07 0.00 CAD 2,718.35
Check No. Date Payment Amt
1200175693 16/05/07 7,688.00 CAD
Pay SEVEN THOUSAND SIX HUNDRED EIGHTY EIGHT & 00/100*********** CANADIAN D
To The RECEIVER GENERAL FOR CANADA
Order INDIAN & NORTHERN AFFAIRS
Of 100 ANEMKI DRIVE
RR #4 ______________________________
THUNDER BAY ON P7J 1A5
Authorized Signature
Vendor ID Personnel ID Check No. Date
RECEIVGECA 77 1200175693 16/05/07
Payee
RECEIVER GENERAL FOR CANADA
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
14/05/07 P2107132007 0.00 CAD 7,688.00
Check No. Date Payment Amt
1200175694 16/05/07 4,155.20 CAD
Pay FOUR THOUSAND ONE HUNDRED FIFTY FIVE & 20/100************** CANADIAN D
To The REUTERS CANADA LIMITED
Order CANADA
Of PO BOX 1519, STATION A
TORONTO ON M5W 3N9 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
REUTERINSV 1200175694 16/05/07
Payee
REUTERS CANADA LIMITED
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
01/04/07 ICA807040667 0.00 CAD 4,155.20
Check No. Date Payment Amt
1200175695 16/05/07 4,155.20 CAD
Pay FOUR THOUSAND ONE HUNDRED FIFTY FIVE & 20/100************** CANADIAN D
To The REUTERS CANADA LIMITED
Order CANADA
Of PO BOX 1519, STATION A
TORONTO ON M5W 3N9 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
REUTERINSV 1200175695 16/05/07
Payee
REUTERS CANADA LIMITED
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
01/05/07 ICA807050645 0.00 CAD 4,155.20
Check No. Date Payment Amt
1200175696 16/05/07 10,000.00 CAD
Pay TEN THOUSAND & 00/100************************************** CANADIAN D
To The WATERLOO REGIONAL CHILDRENS
Order MUSEUM
Of 10 KING ST W
KITCHENER ON N2G 1A3 ______________________________
Authorized Signature
Vendor ID Personnel ID Check No. Date
WATERLRECM 1200175696 16/05/07
Payee
WATERLOO REGIONAL CHILDRENS
Date Invoice No. PO/Cntrct Rel Discount/Wthld Cur Payment Amount
29/11/06 2006050034 0.00 CAD 10,000.00
Raj:
You could create a 'Before Header' page process to create this 'flat file'. The code for the page process will be something similar to declare
v_file_name VARCHAR2 (2000) := 'fixedFieldsFile.txt';
--- Client Record Format
f1 char(20);
f2 char(20);
f3 char(20);
---- End format
begin
OWA_UTIL.mime_header ('application/txt', FALSE);
htp.p('Content-Disposition:attachment;filename="'|| v_file_name|| '"');
OWA_UTIL.http_header_close;
for c1 in (select * from emp) loop ----- The report query
f1:= c1.empno;f2:=c1.ename;f3:=c1.sal;
htp.p(f1||f2||f3);
end loop;
apex_application.g_unrecoverable_error:=true;
exception when others then
null;
end; Varad
Similar Messages
-
Download report into a flat file format
Hi Friends,
I would like to know your thoughts on what is the best practice most of you using to download a report into a flat file(NOT csv).
In my application business users want a report to be downloaded into their local desktop (just like a .csv) but into a flat file and they have their byte specific format.
My concerns :
1) Is there any straight method to download a report into a flatfile (like it is now for CSV) from Apex 3.1.2 ?
2) If I write my own code using UTL_FILE, can I let the user to save them to their desired directory on their desktop ?
Your thoughts would definitely help me in delivering a right solution to the users in this regard.
Thanks a lot.
Raj.Raj:
You could create a 'Before Header' page process to create this 'flat file'. The code for the page process will be something similar to declare
v_file_name VARCHAR2 (2000) := 'fixedFieldsFile.txt';
--- Client Record Format
f1 char(20);
f2 char(20);
f3 char(20);
---- End format
begin
OWA_UTIL.mime_header ('application/txt', FALSE);
htp.p('Content-Disposition:attachment;filename="'|| v_file_name|| '"');
OWA_UTIL.http_header_close;
for c1 in (select * from emp) loop ----- The report query
f1:= c1.empno;f2:=c1.ename;f3:=c1.sal;
htp.p(f1||f2||f3);
end loop;
apex_application.g_unrecoverable_error:=true;
exception when others then
null;
end; Varad -
TCODE TO DOWNLOAD IDOC INTO A FLAT FILE
Hi All,
Please let me know if there is any tcode to download IDOC into a flat file..
Regards,
Kaveritry with we60 where you should have links to download the idoc type.
Please check this:
1. How to Download a Hierarchy to a Flat File
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb
2. How To Convert an IDoc-XML structure to a flat file and vice versa in XI 3.0 Version 1.10
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
run the report RSEOUT00 with the idoc number, flat xml file will be generated at the location user/sap/XI/SYS/global/idoc_file
Please rewrds if found help ful -
XML data (Output) into a flat file
I need to convert XML data into a flat file, which is having "|" as delimiter and ftp the same to a server. The XML data is an output of BPEL activity. The XML data is employee records. Each employee records should come as one line in the flat file.
Is it possible to do this? if so, what will be the steps
ThanksHi,
You need to use file adapter to write your XML payload as a flat file.
Following are the steps to write XML payload into a flat file:
1. Create a sample flat file and add few rows in which fields should be delimited with pipe symbol. See the record sample given below:
Name|Age|Address|City|State|Zip
Sam|32|2788 Viking Dr|Green Bay|WI|54304
Here first row is the header row, you can remove the header row if it is not required.
2. Create a file adapter service using adapter configuration wizard. Give file name and folder location where you want to write flat file. On step 5 of the adapter configuration wizard you have to define or select message schema. Click on Define Schema for Native Format button, then Native Format Builder Wizard will be opened, here you can define message schema for your flat file.
2.1 Here you need to select Delimited for file type.
2.2 Give details about your flat file, select your sample flat file here, which you have created in step 1 above.
2.3 Click Next button twice and go to step 4, here give namespace and element names you want and click on Next.
2.4 In step 5 you need to specify delimiters. Wizard doesn’t shows *|* as a delimiter so you need to enter *|* in the Delimited By combo box and click on Next button.
2.5 Complete remaining steps and click on Finish in the wizard.
3. Finish "Adapter Creation Wizard". Add BPEL activities (assign, invoke) to pass XML payload to file adapter and file adapter will generate *|* delimited flat file and write it to the given folder.
See the following article for more details on Native Format Builder Wizard:
http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/nfb.htm#CCHCIGCA
Regards,
Dharmendra
http://soa-howto.blogspot.com -
Hi,
I have a mapping where I extract the data from certain tables into a flat file. This works perfectly.
Now the requirement is to add a row at the end with some other details like number of rows, date, etc. The format is different.
So I tried creating a second file operator and putting it in the same mapping. But OWB wouldn't allow that as I got -
VLD-2359: The following targets have identical file names and locations specified as configuration parameters: ORDER_NUMBER_FILE_1,ORDER_DATE_FILE_1. This will cause errors trying to write to the target file. Configure the mapping to correct this error.
Someone must've done this before. What problems did you encounter?
ThanksHi
As the error suggest, it might just not be possible to do this straight in OWB. I am not saying it isn't possible, but I at least don't know of a way to achieve this. An easy work-around would be to have your second mapping just write to a second file, which would actually be the same file on the OS lever (i.e. use symbolic links in Unix. perhaps a shortcut in Windows works as well). It's not the clean way of doing it all in OWB, but it should work fine.
Another way would be to add a third mapping after these initial two that read in the two target files as simply single field files (one long row) and write the both out in to the final target.
Borkur -
BW 2.1C Download a hierarchy to a flat file
Hello
I copy and paste the BW ABAP source "download a hierarchy to a flat file" in a BW 2.1C system.
When I check programm a error occurs " The type RSSH_S_HTAB" is unknown.
Can you help me ?Hi,
DATA : BEGIN OF I_DISPLAY OCCURS 0,
REC(400),
END OF I_DISPLAY.
based on date
select StudentNo S_Course from Course Record
into i_Course Record
****if parameter
where date eq p_Date_join
****if select-options.
where date in s_Date_join.
select StudentNo S_Course from Student Details
into i_Student Details
****if parameter
where date eq p_Date_join
****if select-options.
where date in s_Date_join.
select StudentNo S_Mark S_Subject
from Student_results
into i_Student_results
****if parameter
where date eq p_Date_join
****if select-options.
where date in s_Date_join.
DATA : FNAME(255) TYPE C VALUE '/data/sapdata/eu_ums/astdetails'.
CONSTANTS : C_COMMA TYPE C VALUE ','.
********Fields to insert
I_FINAL-StudentNo = 'StudentNo.
I_FINAL-S_Course = 'S_Course'.
INSERT I_FINAL INDEX 1.
CLEAR I_FINAL.
LOOP AT I_FINAL.
CONCATENATE
I_FINAL-DOCNUM
I_FINAL-STATXT
into I_DISPLAY-REC SEPARATED BY C_COMMA.
APPEND I_DISPLAY.
CLEAR I_DISPLAY.
ENDLOOP.
OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE.
LOOP AT I_DISPLAY.
TRANSFER I_DISPLAY TO FNAME.
ENDLOOP.
CLOSE DATASET FNAME.
Do this for all tables.
Don't forget to reward if useful -
Error Loading Data into a flat file
I am recieving the following error when loading data into a flat file from a flat file. SQL 2005 is my back end DB. If I cut the file iin half approx 500K rows my ODI interface works fine. Not sure what to look at.. I rebuit the interface which before was just dying giving no error and now I am getting this.
Thanks
java.lang.Exception
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source)Figured it out, found similar post that stated changing the HEAP size
Increase the page size in odiparams.bat in the bin folder and restart Designer.
For eg:
set ODI_INIT_HEAP=128m
set ODI_MAX_HEAP=1024m -
Different formats of the flat file for the same target
In our deployment, we use plugin code to extract the csv files in the required format. The customers are on same version of datamart, but they are on different versions of source database - from 3.x to 4.5 depending on which version of application they are using. In 4.0, we introduced a new column email in the user table in the source database. Accordingly, plugin will add the field in the csv file. But not all the customers will get the upgraded version of plugin at the same time. So ETL code needs to decide which data flow to process depending on the format of the csv file to load data to the same target table. I made the email field in the target table nullable but it still expects the same format of the csv file with delimiter for null value.
Need help to achieve this. Can I read the structure of the flat file in DS or get the count of delimiters so that I can use a conditional to use different data flow based on the format of the flat files.
Can I make the email column in the flat file optional?
Thanks much in advance.You can add an email column that maps to null in a query transform for the source that does not contain this column.
Or else you can define two different file formats that map to the same file. One with the column and one without -
What is the best way to export the data out of BW into a flat file on the S
Hi All,
We are BW 7.01 (EHP 1, Service Pack Level 7).
As part of our BW project scope for our current release, we will be developing certain reports in BW, and for certain reports, the existing legacy reporting system based out of MS Access and the old version of Business Objects Release 2 would be used, with the needed data supplied from the BW system.
What is the best way to export the data out of BW into a flat file on the Server on regular intervals using a process chain?
Thanks in advance,
- ShashiHello Shashi,
some comments:
1) An "open hub license" is required for all processes that extract data from BW to a non-SAP system (including APD). Please check with your SAP Account Executive for details.
2) The limitation of 16 key fields is only valid when using open hub for extracting to a DB table. There's no such limitation when writing files.
3) Open hub is the recommended solution since it's the easiest to implement, no programming is required, and you don't have to worry much about scaling with higher data volumes (APD and CRM BAPI are quite different in all of these aspects).
For completeness, here's the most recent documentation which also lists other options:
http://help.sap.com/saphelp_nw73/helpdata/en/0a/0212b4335542a5ae2ecf9a51fbfc96/frameset.htm
Regards,
Marc
SAP Customer Solution Adoption (CSA) -
Problem while downloading Chinese chatracters into an excel file
Hi All ,
While downloading Chinese characters into an excel file , using GUI_DOWNLOAD function module , im getting JUNK Characters instead of chinese characters.
But if im downloading the same chinese data into an text file or unix file , there is no such problem.
Thanks in advance and points will be rewarded for helpful answer.
Regards,
K.S.RHi, I have the same problem. Anyone has solution now?
Wu Hao
2008/08/21 -
Export records into a flat file
Hi...
I have to export some tables into a flat file. The output must be like this:
insert into table (col1, col2.....) value (one, two......)
insert into table (col1, col2.....) value (one, two......)
insert into table (col1, col2.....) value (one, two......)
how can I do that.......with PLSQL code?
Thanks
Message was edited by:
marckcosI got this package : and I got the follwing error:
4:35:19 PM Execution failed: ORA-20011: GENERATE_STMT Error in populating file. Message: ORA-00904: "CHANGE_DATATYPE": invalid identifier
What can I do?
CREATE OR REPLACE PACKAGE BODY UTILITY
IS
-- VARIABLES USED by PROCEDURE generate_stmt
-- File Related PACKAGE Variable
cmn_file_handle UTL_FILE.file_type;
PROCEDURE close_file
IS
BEGIN
UTL_FILE.FCLOSE (cmn_file_handle);
EXCEPTION
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
RAISE_APPLICATION_ERROR(-20003, 'File handle was invalid');
WHEN UTL_FILE.INVALID_PATH THEN
RAISE_APPLICATION_ERROR(-20004, 'Invalid path for file');
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20005, 'CLOSE_FILE Error in creating file. Message: ' || SQLERRM);
END close_file;
PROCEDURE open_file (
prm_output_folder IN VARCHAR2,
prm_output_file IN VARCHAR2)
IS
BEGIN
cmn_file_handle := UTL_FILE.FOPEN (prm_output_folder, prm_output_file, 'a', 32767);
EXCEPTION
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
close_file;
RAISE_APPLICATION_ERROR(-20000, 'File handle was invalid');
WHEN UTL_FILE.INVALID_PATH THEN
close_file;
RAISE_APPLICATION_ERROR(-20001, 'Invalid path for file');
WHEN OTHERS THEN
close_file;
RAISE_APPLICATION_ERROR(-20002, 'OPEN_FILE Error in creating file. Message: ' || SQLERRM);
END open_file;
FUNCTION change_datatype (
prm_value IN VARCHAR2,
prm_data_type IN VARCHAR2)
RETURN VARCHAR2
IS
BEGIN
IF prm_value IS NULL THEN
RETURN ('NULL');
END IF;
IF prm_data_type = 'C' THEN
IF INSTR(prm_value, CHR(10)) > 0 THEN
RETURN ('REPLACE(' || '''' || REPLACE (prm_value, CHR(10), CHR(977)) || '''' || ', CHR(977), CHR(10))');
END IF;
ELSIF prm_data_type = 'D' THEN
RETURN ('TO_DATE(' || '''' || prm_value || '''' || ', ' || '''' || 'DD-MON-YYYY HH24:MI:SS' || '''' || ')');
ELSIF prm_data_type = 'N' THEN
RETURN (prm_value);
END IF;
RETURN ('''' || prm_value || '''');
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20002, 'CHANGE_DATATYPE Error in Converting DataType. Message: ' || SQLERRM);
END change_datatype;
PROCEDURE generate_stmt (
prm_table_name IN VARCHAR2,
prm_where_clause IN VARCHAR2,
prm_output_folder IN VARCHAR2,
prm_output_file IN VARCHAR2)
IS
TYPE ref_cols IS REF CURSOR;
mmy_ref_cols ref_cols;
mmy_column_name VARCHAR2(100);
mmy_column_data_type VARCHAR2(1);
mmy_col_string VARCHAR2(32767);
mmy_query_col_string VARCHAR2(32767);
BEGIN
IF prm_table_name IS NULL OR
prm_output_folder IS NULL OR
prm_output_file IS NULL THEN
RAISE_APPLICATION_ERROR(-20012, 'Invalid Argument Passed');
END IF;
OPEN mmy_ref_cols
FOR SELECT LOWER(column_name) column_name,
DECODE (data_type, 'VARCHAR2', 'C', 'CHAR', 'C', 'LONG', 'C', 'NUMBER', 'N', 'DATE', 'D') data_type
FROM user_tab_columns
WHERE table_name = UPPER(prm_table_name)
ORDER BY column_id;
LOOP
FETCH mmy_ref_cols INTO mmy_column_name, mmy_column_data_type;
EXIT WHEN mmy_ref_cols%NOTFOUND;
mmy_col_string := mmy_col_string || mmy_column_name || ', ';
IF mmy_column_data_type = 'D' THEN
mmy_query_col_string := mmy_query_col_string || 'change_datatype(' || 'TO_CHAR(' || mmy_column_name || ', ' || '''' || 'DD-MON-YYYY HH24:MI:SS' || '''' || ')' || ', ' || '''' || mmy_column_data_type || '''' || ') || ' || '''' || ', ' || '''' || ' || ';
ELSIF mmy_column_data_type IN ('N', 'C') THEN
mmy_query_col_string := mmy_query_col_string || 'change_datatype(' || mmy_column_name || ', ' || '''' || mmy_column_data_type || '''' || ') || ' || '''' || ', ' || '''' || ' || ';
END IF;
END LOOP;
CLOSE mmy_ref_cols;
IF mmy_col_string IS NOT NULL AND
mmy_query_col_string IS NOT NULL THEN
IF NOT UTL_FILE.IS_OPEN(cmn_file_handle) THEN
open_file(prm_output_folder, prm_output_file);
END IF;
mmy_col_string := 'INSERT INTO ' || LOWER(prm_table_name) || ' (' || CHR(10) || CHR(9) || CHR(9) || mmy_col_string;
mmy_col_string := RTRIM (mmy_col_string, ', ');
mmy_col_string := mmy_col_string || ')' || CHR(10) || 'VALUES ( ' || CHR(9);
mmy_query_col_string := RTRIM (mmy_query_col_string, ' || ' ||'''' || ',' || '''' || ' || ') || ' one_pare';
OPEN mmy_ref_cols
FOR ' SELECT ' || mmy_query_col_string ||
' FROM ' || prm_table_name ||
' ' || prm_where_clause;
LOOP
FETCH mmy_ref_cols INTO mmy_query_col_string;
EXIT WHEN mmy_ref_cols%NOTFOUND;
mmy_query_col_string := mmy_query_col_string || ');';
UTL_FILE.put (cmn_file_handle, mmy_col_string);
UTL_FILE.put_line (cmn_file_handle, mmy_query_col_string);
END LOOP;
CLOSE mmy_ref_cols;
If UTL_FILE.IS_OPEN(cmn_file_handle) THEN
close_file;
END IF;
END IF;
EXCEPTION
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
IF mmy_ref_cols%ISOPEN THEN
CLOSE mmy_ref_cols;
END IF;
close_file;
RAISE_APPLICATION_ERROR(-20009, 'File handle was invalid');
WHEN UTL_FILE.INVALID_PATH THEN
IF mmy_ref_cols%ISOPEN THEN
CLOSE mmy_ref_cols;
END IF;
close_file;
RAISE_APPLICATION_ERROR(-20010, 'Invalid path for file');
WHEN OTHERS THEN
IF mmy_ref_cols%ISOPEN THEN
CLOSE mmy_ref_cols;
END IF;
close_file;
RAISE_APPLICATION_ERROR(-20011, 'GENERATE_STMT Error in populating file. Message: ' || SQLERRM);
END generate_stmt;
END utility;
############################################################ -
How to split column wise into separate flat files in ssis
IN SSIS...
1.---->I have a sales table country wise regions like (india, usa, srilanka) ....
india usa
srilanka
a b
c
d e
f
so i want output like in
flat file1.txt has india flat file2.txt has usa flat file3.txt has srilanka
a b
c
d e
f
2.----->i dont know how many regions in my table....dynamically split into separate flat files ....
pls help me.....thank uI think what you can do is this
1. Do a query based on UNPIVOT to get the data as rows instead of columns
For that you can use a query like this
IF OBJECT_ID('temp') IS NOT NULL DROP TABLE temp
CREATE TABLE temp
Country varchar(100),
Val decimal(25,5)
DECLARE @CountryList varchar(3000),@SQL varchar(max)
SELECT @CountryList = STUFF((SELECT ',[' + Column_Name + ']' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '<SalesTableNameHere>' FOR XML PATH('')),1,1,'')
SET @SQL= 'SELECT * FROM <SalesTableNameHere> t UNPIVOT (Val FOR Country IN (' + @CountryList + '))p'
INSERT temp
EXEC (@SQL)
Once this is done you'll get data unpivoted to table
Then you can use a execute sql task with query like above
SELECT DISTINCT Country FROM Temp
Use resultset option as full resultset and store the result to an object variable
Then add a ForEach loop container with ADO enumerator and map to the object variable created above. Have variables inside loop to get inidvidual country values out.
Inside loop place a data flow task. Use a variable to store source query , make EvaluateAsExpression true for it and set Expression as below
"SELECT Val FROM Temp WHERE Country = " + @[User::LoopVariable]
Where LoopVariable is variable created inside loop for getting iterated values
Inside data flow task place a oledb source, choose option as SQL command from variable and map to the above query variable.
Link this to flat file destination create a flat file connection manager. Set a dynamic flat file connection using expression builder. Make it based on a variable and set variable to increment based on loop iteration
The core logic looks similar to this
http://visakhm.blogspot.ae/2013/09/exporting-sqlserver-data-to-multiple.html
dynamic file naming can be seen here
http://jahaines.blogspot.ae/2009/07/ssis-dynamically-naming-destination.html
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
How to Download a Hierarchie to a Flat File
Hallo Experts,
sorry i just have a second question. We make the solution
"How to Download a Hierarchy to a flat file"
Program works
transport green
Upload ok,
but the Text Node keys are there, but not the text
e.g.
description text note short: 00000000000000000000
description text note long: empty
The rest is alright ????? Has someone a idea?
Thanks
SantraHi,
You may be interested in this official SAP How-To-Guide document:
"How to Download a Hierarchy to a Flat File"
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb -
Export multiple tables into one flat file
I have data in multiple tables on a processing database that I need to move up to a production database. I want to export the data into a flat file, ftp it to the production server and have another job pick up the file and process it. I am looking for
design suggestions on how to get multiple tables into one flat file using SSIS?
Thank You.Hey,
Without a bit more detail, as per Russels response, its difficult to give an exact recommendation.
Essentially, you would first add a data flow task to your control flow. Create a source per table, then direct the output of each into an union all task. The output from the union all task would then be directed to a flat file destination.
Within the union all task you can map the various input columns into the appropriate outputs.
If the sources are different, it would probably be easiest to add a derived column task in-between the source and the union all, adding columns as appropriate and setting a default value that can be easily identified later (again depending on your requirements).
Hope that helps,
Jamie -
How can I download from R/3 to flat file?
Hi
My requirement is to download Material and Supplier data from R/3 to flat file...
These are the fields I have to bring it from SAP R/3 but I don not want to DOWNLOAD FM. I want to Concatenate from Internal Table and put it on application server.
There are my following fields...
Material and Supplier
1. Selection criteria
- Based on plant
- Hubs and FSL/Hubs
- Hubs can pull both Repair and NewBuy vendor
- FSL/Hubs pull only Repair vendor
2. Material EORD-MATNR
3. Region Determined by 9* plants
4. Site
1. plant-(W) and plant-(C) for FSL/Hubs
2. plant-(S) for DCs
5. Supplier
1. Menlo/Repair for DC
2. Repair only for hub/fsl
6. Supplier-type PURCHASE or REPAIR
7. Leadtime - (The number of days between placing an order and receiving an order)
8. Order Horizon 2
9. Minimum OQ 3
10. Order cost 50
11. Supplier part number EORD-MATNR
Waiting for some help and (or) sample code for this...
Thanks in advance.Here is an example program showing how to write a tab-delimited file to the application server. All you need to do is get all your data into an internal table, then loop at it, concatenate all fields into a string and then transfer that string.
report zrich_0001.
parameters: d1 type localfile default '/usr/sap/TST/SYS/Test.txt'.
data: begin of itab occurs 0,
field1(20) type c,
field2(20) type c,
field3(20) type c,
end of itab.
data: str type string.
constants: con_tab type x value '09'.
* if you have a newer version, then you can use this instead.
*constants:
* con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
start-of-selection.
itab-field1 = 'ABC'.
itab-field2 = 'DEF'.
itab-field3 = 'GHI'.
append itab.
itab-field1 = '123'.
itab-field2 = '456'.
itab-field3 = '789'.
append itab.
open dataset d1 for output in text mode.
loop at itab.
concatenate itab-field1 itab-field2 itab-field2 into str
separated by con_tab.
transfer str to d1.
endloop.
close dataset d1.
Regards,
Rich Heilman
Maybe you are looking for
-
Table for Valuation Price from USER EXIT - Cost Estimation
Hi All, Can you let us know from where the system picks the price for VALUATION PRICE from USER EXIT when we have following setting in valuation variant 1.Valuation Price from USER EXIT 2.Price from Purchasing Info Records 3. Planned Price 1 Sub Stra
-
PAGEID from item_id or caid
I would like to get default pageid(ca_page) for displaying content area from item_id (or folder_id or caid. I need it to display any item between other elements of content area page. Anybody knows where to find the connection between pageid and conte
-
Release strategy E-mail Aleart
HI All I need to set the Release Strategy E- mail alert to Temporary assign Release Code..... Case: Chairman release Code 01 MD release Code 02 When Chairman is on leave, we are assign the chairman 's user roll to the MD for particul
-
PlsqlNLSLanguage WE8ISO8859P1 vs AL32UTF8
Hi, I upgraded to 3.0.1 and I am having some issues with apostrophe when I switch the PlsqlNLSLanguage from WE8ISO8859P1 to AL32UTF8. I did run the OWAINST script to upgrade Web Toolkit. So my pages displays correctly except for those apostrophe that
-
Siri: Eintrag in Erinnerungsliste
Hallo, ich habe in der Erinnerungsapp mehrere Listen erstellt. Beispielsweise "Zu Hause". Kann aber über Siri nichts eintragen, weil Siri das nicht erkennt. Kann mir jemand sagen, wie ich Siri anweisen kann einen neuen Eintrag durchzuführen? Danke!