[b]Generating text file[/b]
Hi,
I have a report that contains several pl-sql-functions and several queries.
This is a report that have a certain number of spaces etc (ie a lot of long strings), and shall be used to read into an external database.
I want to generate the report to an txt-file, and want it to look exactly like the pdf-file. The pdf-file shows the spaces correct, and i just want to save the result in textfile format (ie save as *.txt).
When i try to generate to file, and choose Text, the output shows a lot of printer setup stuff.
Does anyone have a clue?
Thanks!
Regards,
Merethe
Hi Senthil!
Thanks a lot for your answer!!
I'm using Report Builder 9.0.2.0.3.
Imagine the report layout is like this:
<Header>
<Header1>
<Header2>
<Query>
<Header3>
<Header4>
<Pl/sql funskjon>
etc..
All these are long textstrings, consisting lots of space, returns etc. This due to the specification of the report.
This file shall be used to send to an public department on a very stright format.
This means that I can't delimit the report on an general basic.
First I thought that I could use delimited, with return. This works ok until I have a query that returns more than one row. Then the "layout" in the txt-file look like this:
<Header>
<Header1>
<Header2>
<Query>
<Header3>
<Header4>
<Pl/sql funskjon>
<Header>
<Header1>
<Header2>
<Query>
<Header3>
<Header4>
<Pl/sql funskjon>
Reports then generates every <xx> * number of rows in the query. If I could manage to overrule this, then I think I can make it work.
Got any clue of this?
Again, thanks a lot!
Regards,
Merethe
Similar Messages
-
Generate text file from a group above report
i have problem in generating report in developer 6 report builder my report is master -detail(group above report)
when i generate text file or csv file then my report is not in group above,master records are repeated along with every detail record.
is there any solution that i generate group above report in text or csv file
instead of pdf,rtf,html
please mail me
[email protected]Can you try adding this in your URL delimited_hdr=NO
I am not sure it works.
Just give a try -
Convert file format into UTF-8 while generating text file on FTP server
Hi Expert,
I have the requirement to generate text file store it in FTP server and file format should be in UTF-8.
ABAP Development is completed but text file format generate in ANSI which not acceptable by client.For generating text file and store it on FTP server by using standard function module FTP_R3_TO_SERVER ,but in this function module there is no any parameter option like CODEPAGE for file format conversion. Is there any method or any function module to convert file format to UTF-8 and directly transfer or store it on FTP server.
<<removed_by_moderator>>
Thanks ,
Edited by: Vijay Babu Dudla on Jan 28, 2009 12:48 AMI have come across the same issue. Try calling the FTP_COMMAND function module to make it go into ASCII mode before your FTP the file, like this:
data: result type table of text with header line.
call function 'FTP_COMMAND'
exporting
handle = hdl
command = 'ascii'
tables
data = result
exceptions
tcpip_error = 1
command_error = 2
data_error = 3.
call function 'FTP_R3_TO_SERVER'
exporting
handle = hdl
fname = docid
character_mode = 'X'
tables
text = gt_your_table . -
Generate Text File from Goods Receipt (MIGO)
Hi Expert,
Please help me ....................
My company outsource W/H but when I 'm goods receipt or goods issue (MIGO)
I send slip GR/IR by Fax to W/H but I want generate text file from system to W/H.
How can I do?
Thanks.Keerthi Hiremath,
Please .............
Can you more explain what is medium of 8 (special function) and other ?
Thanks. -
Generating text file using PL/SQL
can any body send sample program how to generate text file using PL/SQL program.I want to store table data into that text file.
Hi,
try this.
Thanks
CREATE OR REPLACE procedure write_index (TABLE_NAME_ACCEPT VARCHAR2) IS
id UTL_FILE.FILE_TYPE;
name VARCHAR2(20) := 'e:\db_coca\input';
err VARCHAR2(100);
ColNameLength Integer;
NumberoFColumns Integer;
num NUMBER;
i integer;
loc_query VARCHAR2(2000);
cursor_name INTEGER;
ret INTEGER;
l_const_name VARCHAR2(30);
CURSOR c_columns(i_Constraint_name VARCHAR2) IS
SELECT *
FROM all_cons_columns
WHERE CONSTRAINT_NAME = i_Constraint_name
order by table_name;
BEGIN
DBMS_OUTPUT.PUT_LINE('BEFORe OPEN');
--id := UTL_FILE.FOPEN('e:\db_coca\input',name,'w');
--IF UTL_FILE.IS_OPEN(id) THEN
-- DBMS_OUTPUT.PUT_LINE('Opened');
--ELSE
-- DBMS_OUTPUT.PUT_LINE('Still Closed');
--END IF;
DBMS_OUTPUT.PUT_LINE('AFTER OPEN');
--The table generation script
loc_query := 'Select CONSTRAINT_NAME from user_constraints ';
loc_query := loc_query || ' where owner = ' || '''CPS''';
loc_query := loc_query || ' AND CONSTRAINT_TYPE = ' || '''P''';
dbms_output.put_line('TABLE_NAME_ACCEPT = ' || TABLE_NAME_ACCEPT);
IF NOT (TABLE_NAME_ACCEPT IS NULL ) THEN
loc_query := loc_query || ' AND TABLE_NAME like ''';
loc_query := loc_query || TABLE_NAME_ACCEPT ;
loc_query := loc_query || '''';
END IF;
cursor_name := DBMS_SQL.OPEN_CURSOR;
dbms_output.put_line('Query = ' || loc_query);
DBMS_SQL.PARSE(cursor_name, loc_query, DBMS_SQL.v7);
dbms_output.put_line('After parse');
dbms_sql.DEFINE_COLUMN(cursor_name, 1,l_const_name, 30);
ret := DBMS_SQL.EXECUTE(cursor_name);
-- IF ret > 0 THEN
LOOP
dbms_output.put_line('return = ' || ret);
IF DBMS_SQL.FETCH_ROWS(cursor_name) > 0 THEN
dbms_sql.COLUMN_VALUE(cursor_name, 1,l_const_name);
-- dbms_sql.BIND_VARIABLE(cursor_name,
l_const_name,CONSTRAINT_NAME);
-- FOR C10 in Table_Loop Loop --The cursor
for the table name
Select COunt(*) INTO NumberoFColumns from
all_cons_columns
Where CONSTRAINT_NAME = l_const_name;
-- FOR C11 IN c_columns(l_const_name) LOOP
-- End loop;
-- UTL_FILE.PUT(id, ');');
ELSE EXIT;
END if; --THe 1 st cursor if is closed
End Loop; --The table loop ends here
DBMS_SQL.CLOSE_CURSOR(cursor_name);
-- END IF;
-- UTL_FILE.PUT_LINE(id,name);
-- UTL_FILE.PUT(id,'It worked and wrote to this file');
UTL_FILE.FCLOSE(id);
DBMS_OUTPUT.PUT_LINE('Successful write to file');
EXCEPTION
WHEN OTHERS THEN
err := SQLERRM;
num := SQLCODE;
DBMS_OUTPUT.PUT_LINE(err);
DBMS_OUTPUT.PUT_LINE(num);
DBMS_OUTPUT.PUT_LINE('Error in writing to file');
END write_index; -
Generating Text files from PL/SQL
To generate Text files from PL/SQL on SERVER, i can use UTL_FILE
package, but how do i create text files on client ( i.e., on the
C: drive ) by executing anonymous PL/SQL blocks.
Thanks in advance.You can use DBMS_OUTPUT to display stuff to the screen and the
SQL*Plus SPOOL command to write screen output to a file on your
local drive.
magic!
APC -
Generating Text file from table using Shell script
I am using KSH for generating and FTPing a text file from a table.
While generating Text file I am not getting my Column names in orderly manner.
q2="select COLUMN1||' '||COLUMN2||' '||COLUMN3 from table1;"
set pagesize 0
set head off
set trimspool on
set trimout on
set colsep ' '
set linesize 1500
set trimspool on
spool /ss/app11/oastss/reports/$file2
select 'COLUMN1'||' '||'COLUMN2'||' '||'COLUMN3' from dual;
$q2
spool off;
EOF
I am getting the result some what like below in text file
COLUMN1 COLUMN2 COLUMN3
MALLIK_ACCT 17-SEP-11 908030482
MALLIK_ACCT 17-SEP-11 908266967
MALLIK_ACCT 17-SEP-11 909570766
I want the format like below
COLUMN1........ COLUMN2 .... COLUMN3
MALLIK_ACCT ...17-SEP-11 .... 908030482
MALLIK_ACCT ...17-SEP-11 .... 908266967
MALLIK_ACCT ...17-SEP-11 .... 909570766
I put dots(.) for illustration purpose.
column data length may icrease some times . it shoudl automatically adjust column and data so that they are in alignment. thanks in advance.Mallik wrote:
Hi my question is to format the headers so that they will be in alignment with column data and readable.So you want to output a query as a fixed width format data file? How about this (rather than using scripts)...
As 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
CASE rec_tab(j).col_type
WHEN 1 THEN v_finaltxt := v_finaltxt||rpad(lower(rec_tab(j).col_name),rec_tab(j).col_max_len,' ');
WHEN 2 THEN v_finaltxt := v_finaltxt||rpad(lower(rec_tab(j).col_name),rec_tab(j).col_max_len,' ');
WHEN 12 THEN v_finaltxt := v_finaltxt||rpad(lower(rec_tab(j).col_name),greatest(19,length(rec_tab(j).col_name)),' ');
END CASE;
END LOOP;
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 := v_finaltxt||rpad(nvl(v_v_val,' '),rec_tab(j).col_max_len,' ');
WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
v_finaltxt := v_finaltxt||rpad(nvl(to_char(v_n_val,'fm99999999999999999999999999999999999999'),' '),rec_tab(j).col_max_len,' ');
WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
v_finaltxt := v_finaltxt||rpad(nvl(to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),' '),greatest(19,length(rec_tab(j).col_name)),' ');
END CASE;
END LOOP;
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.csv file contains:
empno ename job mgr hiredate sal comm deptno
7369 SMITH CLERK 7902 17/12/1980 00:00:00800 20
7499 ALLEN SALESMAN 7698 20/02/1981 00:00:001600 300 30
7521 WARD SALESMAN 7698 22/02/1981 00:00:001250 500 30
7566 JONES MANAGER 7839 02/04/1981 00:00:002975 20
7654 MARTIN SALESMAN 7698 28/09/1981 00:00:001250 1400 30
7698 BLAKE MANAGER 7839 01/05/1981 00:00:002850 30
7782 CLARK MANAGER 7839 09/06/1981 00:00:002450 10
7788 SCOTT ANALYST 7566 19/04/1987 00:00:003000 20
7839 KING PRESIDENT 17/11/1981 00:00:005000 10
7844 TURNER SALESMAN 7698 08/09/1981 00:00:001500 0 30
7876 ADAMS CLERK 7788 23/05/1987 00:00:001100 20
7900 JAMES CLERK 7698 03/12/1981 00:00:00950 30
7902 FORD ANALYST 7566 03/12/1981 00:00:003000 20
7934 MILLER CLERK 7782 23/01/1982 00:00:001300 10
The 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 (this is currently coded for VARCHAR2, NUMBER and DATE) -
Generating Text Files from reports
Hi all,
Could anyone help me to generate reports to text files using command line. I could do this using the menus but I need to do it by command line.
I tried to use the DESFORMAT parameter but the values for this parameter do not include a value for a text file. I could find PDF, HTML, RTF and.....
Thanks in advanceHi,
Try using DESFORMAT=DELIMITED eg.
rwrun60.exe REPORT="XXXXX.RDF" USERID=userid/passwordf@databaseid DESTYPE=FILE DESFORMAT=DELIMITED DELIMITER=TAB DESNAME="XXX.TXT" BATCH=YES
I think the default delimiter is TAB but you can specify your own delimiter. There is a list of command line options and delimiter options on the Reports Runtime Help.
I hope this helps !
regards
Warren -
How to generate text file on a condition
I want to generate a text file if following count is > 1 on a Stored procedure. Your help is much appreicated.
select count(p.policy_no)
from policy p,
risk r
where upper(trim(p.policy_no)) not like 'Q%'IF COUNTER > 1
THEN
UTL_FILE
END IF -
How to fetch dynamically generated text file
Caveat: I'm actually using CSP, not JSP, but the scripting methods are very similar. A JSP answer will probably apply to CSP as well.
Currently, I have a dynamic content page that which I fetch on a submit action using response->getRedirectURL("xxx") where xxx is the URL of the dynamic page. The page displays fine in the browser, but what I would like to have it do is cause a file save dialog to appear so that the user can save the page as a text file.Set the MIME/ content type to "text/plain"
You then need to tell the browser to not try and render the contents but to treat it as an attachment.
Set the header "Content-Disposition" with the value "attachment; filename="yourFilenameHere".
And you do realize, posting about CSP here might get you flamed :) -
How to generate text file using spool command
How can I use a SPOOL command with DBMS_OUTPUT.PUT_LINE with PL/SQL to produce text file on oracle client machine.
You could try using a REF CURSOR as an alternative. Bare bones example listed below:
--- SQL Script
SET FEEDBACK OFF
COLUMN first_name FORMAT A25
COLUMN last_name FORMAT A25
VARIABLE example_data REFCURSOR
BEGIN
example.get_data(:example_data);
END;
SPOOL example_data.txt
PRINT example_data
SPOOL OFF
-----Output in example_data.txt
FIRST_NAME LAST_NAME
First Name 1 Last Name 1
First Name 2 Last Name 2
First Name 3 Last Name 3
First Name 4 Last Name 4
First Name 5 Last Name 5
First Name 6 Last Name 6
First Name 7 Last Name 7
First Name 8 Last Name 8
First Name 9 Last Name 9
First Name 10 Last Name 10
-----Example package used in SQL Script
CREATE OR REPLACE PACKAGE example
IS
TYPE result_set IS REF CURSOR;
PROCEDURE get_data
p_result_set OUT result_set
END;
SHOW ERRORS
CREATE OR REPLACE PACKAGE BODY example
IS
PROCEDURE get_data
p_result_set OUT result_set
IS
BEGIN
-- replace this with your query
OPEN p_result_set FOR
WITH fake_data AS (
SELECT
'First Name ' || level first_name,
'Last Name ' || level last_name
FROM DUAL
CONNECT BY LEVEL <= 10
SELECT *
FROM fake_data
END;
END;
SHOW ERRORS
SPOOL OFF -
Generate text file, downloadable from frontend
Hi,
I am looking for APIs of EP6 SP2 that can be used to write content to a file and then send it to the frontend browser so it can be saved/opened locally.
This is all from a JSP DynPage Java iView.
Any suggestions?
Thanks,
FaBHi FaB,
see Export Portal data to Excel for generating response content different than HTML. It doesn't matter if you have the content on file system before or not.
Hope it helps
Detlev -
How to generate a Text file from a Report
Hi Friends,
I need to generate a Text file foramat from my Report.My client is having a text file in a standard format.I need to Generate this Text file according to that text format.
My requirement is For one production order there will be so many line items and for each line item based on its Quantity i need to generate serial numbers.
For Ex for Production order 100 there r 3 line items.If 1st line item is of Quantity 20.I need to Generate 20 serial numbers for the 1st line item and the same for the remaining line items also.
How can i proceed.I need to do dis based on the production order Number.
In d selection screen i need to put the fields Production order Number and From:----
To:----
and u button Generate Text file.If I click on Generate Text file Text file should be generated.
Thanks & Regards,
Chitty.
Edited by: chitty d on Mar 12, 2009 5:44 AMHi,
As far as i understand from your requirements, it like you need all the data item leve into a text file.
You can fetch all the relevant data from variuos tables and then use GUI_Download into a text file. -
Generating Postscript file using (psl132.prt) and Text file in one go
Actually my requirement is to have soft copy , postscript files in a single shot for character mode report because the report fetches data from the table then deletes the data.
- I am able to generate softcopy, and postscript files same using distribution file for Bitmap report as shown below :-
[RWRUN REPORT=C:\Report\R_TEST.RDF userid = test / test @ test DISTRIBUTE=YES DESTINATION=C:\Report\bRep.dst ERRFILE=C:\Report\Final\report.err
The brep.dst file for bitmap report is as follows:-
DEST1: DESNAME=C:\Report\tpdf.pdf DESTYPE=File DESFORMAT=PDF COPIES=1 LEVEL=Report
DEST2: DESNAME=C:\Report\test.prn DESTYPE=File DESFORMAT=BITMAP COPIES=1 LEVEL=Report
But in case of Char mode report i am able to generate text file but i am unable to generate postscript file for using printer definition file. The commands used are as follows :-
RWRUN REPORT=C:\Report\R_TEST.RDF userid = test / test @ test DISTRIBUTE=YES MODE=CHARACTER DESTINATION=C:\Reports\cRep.dst ERRFILE=C:\Report\Final\report.err
The crep.dst file for char report is as follows :-
DEST1: DESNAME=C:\Report\tpdf.text DESTYPE=File DESFORMAT=ASCII COPIES=1 LEVEL=Report
DEST2: DESNAME=C:\Report\test.prn DESTYPE=File DESFORMAT=prt132.prn COPIES=1 LEVEL=Report (This option does not work is there any work around to make it work) ]
I am getting an error. it there any work around for this or there is any other solution.
Is there any other way i convert my text file to postscript file or viceversa...thanksHi,
Peter Gjelstrup wrote:
Next thing is how to use it:
declare
k_file constant varchar2(30) := 'YourFile.xls'
begin
create_file(k_file);
-- Call other procedures
close_file;
end;
Don't forget: these procedures are all part of the gen_xl_xml package.
To call them from outside the package, you have to prefix each procedure name with the package name, like this:
declare
k_file constant varchar2(30) := 'YourFile.xls'
begin
gen_xl_xml.create_file(k_file);
-- Call other procedures
gen_xl_xml.close_file;
end; -
How i can enforce to generate a UNICODE text file
Hi,
Every body
I am trying to generate text files in UNICODE formate with the following code.
Writer out = new OutputStreamWriter(new FileOutputStream(filePath1),"UTF-8");
I am fetching the contents of text file from the postgres database(8.1) and pushing it into text file.Databe is also created in UNICODE formate.
But problem is that if a database field have conents except english(english also) then its generating in UNICODE formate.But if database field dont have contents other than english then its creating the text file in ASCII formate.I wants to create text files in UNICODE formate whatever data is in the database
Help me plzzzzzzzzzz
azizMutliple post
http://forum.java.sun.com/thread.jspa?threadID=767882&tstart=0
Maybe you are looking for
-
Re install Adobe Flash 10.3 ?
Could someone tell me how to get Adobe Flash 10.3 back working? I did something wrong, trying to remove it for the 11.3 version for this program I've been using. I did not remove it by Uninstaller, this keeps aborting and reinstalling 10.3 keeps fail
-
Forgotten seucurtiy password for laptop
I am unable to send any emails or make updates as I have forgotten my security password or it was changed without me knowing. My hint does not help Any ideas how to fix this. Thanks
-
Text Variable With Customer Exit Logic/ABAP Code
Hi Experts, Could you please help me with the Logic/Code that i need to use in Calculacting The TEXT Variable Using CUSTOMER EXIT I had a rolling report in which there are 14 Calculacted Keyfigures (Not Restricted KF),Which are M-1,M-2,M-3,M-4,M-5..
-
Hi, i got an Hp officejet 7000 wide format model E809a I have to print on a thick black paper size A3 I tried doing it and what i got was only some darker sqaures on the paper where the images and text should be. anyone can help me with this problem?
-
Itunes 7 freezes when trying to update 5G Video Ipod 30G
Ever since I've upgraded to Itunes 7, every time I plug in my 5G 30gig ipod, Itunes will crash, and not update at all. I have tried absolutely everything, and cannot seem to make it work, so my ipod has been essentially not updateable for 2 months. I