Cl_gui_frontend_services= gui_download, header and data in text file
CALL METHOD cl_gui_frontend_services=>gui_download EXPORTING
filename = c:\abc.txt
filetype = 'ASC'
write_field_separator = space
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = 'ASC'
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
CHANGING
data_tab = t_pch[]
here the file abc.txt get some text as header.
butwhen i want write actual data again witht he same file name the file get over writed
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = c:\abc.txt
filetype = 'ASC'
write_field_separator = space
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = 'ASC'
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
CHANGING
data_tab = t_pc[]
Hi
When second time you call method just add the following
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = v_value
append = 'X' <------- Just add this line
Similar Messages
-
How to add header and fooder in text file
Hi,
i have created simple application for generate report from database into text file.
But i need to add header and fooder in text file. I dont know is there any API for adding these.
Can anyone help me to create header and fooder in text file.
the below text are needs to be print in the header
name of the table :
Recorder type :
file creation time:
the below text are needs to be print in the footer
Recorder Number:
Record Type;
the actual code is
pst = con.prepareStatement("select REQUEST, DOMAIN_NAME, TRUNC(DATE_OF_CONFIGURATION) AS dateofConfig FROM employee where id=300");
rs = pst.executeQuery();
while (rs.next()) {
request = rs.getString("REQUEST");
domain_name = rs.getString("DOMAIN_NAME");
dateofconfig = rs.getString("dateofConfig");
System.out.println(request + " " + domain_name + " " + dateofconfig);
data.add(request + " " + domain_name + " " + dateofconfig);
System.out.println("before calling method");
writeToFile(data, "c:/Employee.txt");
System.out.println("file created successfull");
rs.close();
pst.close();
private static void writeToFile(List list, String path) {
BufferedWriter out = null;
try {
File file = new File(path);
out = new BufferedWriter(new FileWriter(file, true));
for (Object obj : list) {
String s= obj.toString();
out.write(s);
out.newLine();
out.close();
} catch (IOException e) {
}Thanks
Jasmin
Edited by: user13836688 on Mar 21, 2011 4:06 AM
Edited by: user13836688 on Mar 21, 2011 4:07 AM
Edited by: user13836688 on Mar 21, 2011 4:08 AMuser13836688 wrote:
i have created simple application for generate report from database into text file.First off, when posting code, use [code]...[/code]. or '' tags, not '<code>'.
But i need to add header and fooder in text file. I dont know is there any API for adding these.
Can anyone help me to create header and fooder in text file.Well you plainly have the code to write the file contents; and furthermore your report seems to be contained in a List called 'data'. Why not just add the header and footer lines to it? I'd also suggest making 'data' a LinkedList. That way you can add the header afterwards with no performance hit, just in case the information it contains isn't available at the start of your report loop.
Winston -
How to load date and time from text file to oracle table through sqlloader
hi friends
i need you to show me what i miss to load date and time from text file to oracle table through sqlloader
this is my data in this path (c:\external\my_data.txt)
7369,SMITH,17-NOV-81,09:14:04,CLERK,20
7499,ALLEN,01-MAY-81,17:06:08,SALESMAN,30
7521,WARD,09-JUN-81,17:06:30,SALESMAN,30
7566,JONES,02-APR-81,09:24:10,MANAGER,20
7654,MARTIN,28-SEP-81,17:24:10,SALESMAN,30my table in database emp2
create table emp2 (empno number,
ename varchar2(20),
hiredate date,
etime date,
ejob varchar2(20),
deptno number);the control file code in this path (c:\external\ctrl.ctl)
load data
infile 'C:\external\my_data.txt'
into table emp2
fields terminated by ','
(empno, ename, hiredate, etime, ejob, deptno)this is the error :
C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 5
C:\>any help i greatly appreciated
thanks
Edited by: user10947262 on May 31, 2010 9:47 AMload data
infile 'C:\external\my_data.txt'
into table emp2
fields terminated by ','
(empno, ename, hiredate, etime, ejob, deptno)Try
load data
infile 'C:\external\my_data.txt'
into table emp2
fields terminated by ','
(empno, ename, hiredate, etime "to_date(:etime,'hh24:mi:ss')", ejob, deptno)
this is the error :
C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 5
C:\>
That's not an error, you can see errors within log and bad files. -
Download internal table data into excel sheet with column heading and data
Hi,
I am having one internal table with column headings and other table with data.
i want to download the data with these tables into an excel sheet.
It should ask the user for file name to save it on their own name. They should give the file name in runtime and it should be downloaded into an excel sheet.
Can anyone tell what is the right function module for downloading these two internal table data with column heading and data.
what we have to do for storing the file name in runtime.
Can anyone help me on this.
Thanks,
Rose.Hi Camila,
Try this
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = PATH2
FILETYPE = 'XLS'
TABLES
DATA_TAB = IT_DATA
FIELDNAMES = IT_HEADINGS
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22 -
Spool SQl data into text file using dynamic sql
Hi,
I am spooling output data into text file using command
select 'select t.mxname,bo.lxtype,t.mxrev'||chr(10)||'from mx_1234567'||chr(10)||
'where <condition>';
here mxname varchar(128),lxtype(128),mxrev(128) all are of varchar type.I want the output in format
e.g Part|1211121313|A
but due to column width the output,I am getting is with spaces.
"Part then blank spaces |1211121313 then blank spaces |A"
how can I remove these spaces between columns.I used set space 0 but not working.
Thanks in advance.
Your help will be appreciated.Hi Frank,
I have seen your reply for SET LINE SIZE function. But, I could not be able to understand it.
I am facing similar kind of issue in my present project.
I am trying spool more than 50 columns from a table into flat file. Because of more column lengths in few columns, i am getting space. There are so many columns with the same issue. I want to remove that space.so that, data can fit perfectly in one line in .txt file without any wrap text.
Below is my sample query.sql. Please let me know the syntax. My mail id : [email protected]
--Created : Sep 22,2008, Created By : Srinivasa Bojja
--Export all Fulfillments
--Scheduled daily after 1:00am and should complete before 3:30am
WHENEVER SQLERROR EXIT SQL.SQLCODE
SET LINESIZE 800
SET WRAP OFF
SET PAGESIZE 800
SET FEEDBACK OFF
SET HEADING ON
SET ECHO OFF
SET CONCAT OFF
SET COLSEP '|'
SET UNDERLINE OFF
SPOOL C:\Fulfillment.txt;
SELECT SRV.COMM_METHOD_CD AS Method,
SRV.SR_NUM AS "Fulfillment Row_Id",
CON.LAST_NAME AS "Filled By"
SRV.SR_TITLE AS Notes,
SRVXM.ATTRIB_04 AS "Form Description"
FROM SIEBEL.S_SRV_REQ SRV,
SIEBEL.S_SRV_REQ_XM SRVXM,
SIEBEL.S_USER USR,
SIEBEL.S_CONTACT CON
WHERE SRV.ROW_ID = SRVXM.PAR_ROW_ID AND
SRV.OWNER_EMP_ID = USR.ROW_ID AND
CON.ROW_ID= SRV.CST_CON_ID;
SPOOL OFF;
EXIT; -
Loading data from text file into ListBox
I have data in a text file that I want to load into a
listbox... I have fully mastered handling strings and arrays so I'm
going to need some help...
I was wondering how do I get flash to load a text file that
contains the data below.. and display it line for line like I want
it to list down the component
"Launch;7.1.7.6"
"Engine;7.1.7.6"
"OSX;7.0.0.2" (or something close to that)
and I was wondering how do i just get it to take it fromt he
file.. line for line from where it says exeversion in the file and
list it in the listbox...
I'm really thankful to anybody that helps.
Data in text file:
quote:
exeversion=Launch;7.1.7.6;
exeversion=Engine;7.1.7.6;
exeversion=LinuxX86;7.0.0.2;
exeversion=LinuxPPC;7.0.0.2;
exeversion=LinuxMIPS;7.0.0.2;
exeversion=OSX;7.0.0.2;
exeversion=Config;7.1.7.6;
exeversion=UI;7.1.7.7;
exeversion=JAVA;7.0.4.5;nobody cna help me? i really need to know or have a tutorial
or something so i can learn from it... i really appreciate anyone
who helps -
Unable to find file error while loading data from text file to Oracle
Hi,
I am having a interface where i am loading a data of Text file to Oracle.
But when i am trying to do this i am getting following error.
ODI-1227: Task SrcSet0 (Loading) fails on the source FILE connection SAPMM.
Caused By: java.sql.SQLException: File not found: d:/mdb/#General.get_filename
at com.sunopsis.jdbc.driver.file.FileResultSet.<init>(FileResultSet.java:160)
at com.sunopsis.jdbc.driver.file.impl.commands.CommandSelect.execute(CommandSelect.java:57)
at com.sunopsis.jdbc.driver.file.CommandExecutor.executeCommand(CommandExecutor.java:33)
SAPMM is connection name.
I am using get_filename to get the filename and it is fetching correct value as the this variable refreshes in previous step of this interface.
KM used for loading is File to SQL
What would be cause of this error?
Thanks,
MaheshHi,
Did a testing and following are the result
I have
A> created package having steps like
1. Declaration of variable v_filename.
2. Refreshing variable v_filename.
3. Execution of Interface which gets the file name from v_filename and load into target table
Package executes successfully.
B> created package having steps like
1. Declaration of variable v_filename.
2. Refreshing variable v_filename.
3. Scenario of Interface which gets the file name from v_filename and load into target table
Package executes with erre as it is not able to find the file
C> created package having steps like
1. Declaration of variable v_filename.
2. Refreshing variable v_filename.
3. Execution of Interface which gets the file name from v_filename and load into target table
4. Now create a scenario of the package , use the generated scenario in another package say main_package
Execution of main_package is successful.
Thanks,
Sutirtha -
How to generate Header and Trailer for a file
Hi Guru
How can we generate header and Trailer for a file
EX:
i want to generate header with date and trailer with record count from table.
Sample file :
20120120
fwsfs
adfwsfd
adff
afsadf
afdwsg
adgsg
adgsgg
asgdsag
sdgasgdaf
sdfsagfadf
10Hi ,
1.Create an interface to load data from oracle to file and set generate header as false option in IKM .
2.Create variable get_current_date of alphanumeric datatype and implement logic SELECT to_Char(SYSDATE,'yyyymmdd') FROM DUAL under refreshing tab
3.Create variable get_record_count of numeric datatype and implement logic SELECT '<%=odiRef.getPrevStepLog("INSERT_COUNT")%>' FROM DUAL under refreshing tab
4.Create a package
Drag the get_current_date variable ,
Drag odioutfile and paste the below logic OdiOutFile "-FILE=D:\ODI_TEST\emp.txt" "-CHARSET_ENCODING=ISO8859_1" "-XROW_SEP=0D0A" #GET_current_date in command tab
Drag the interface
Drag another variable get_Record_count
Drag the odioutfile and paste the below logic OdiOutFile "-FILE=D:\ODI_TEST\emp.txt" -APPEND "-CHARSET_ENCODING=ISO8859_1" "-XROW_SEP=0D0A"
#GET_RECORD_COUNT in command tab
Link all these in sequence,save and run the package.
OR Modify the IKM SQL to File Append to achieve same functionality.
Thanks,
Anuradha -
Cant get data from text file to print into Jtable
Instead of doing JDBC i am using text file as database. I cant get data from text file to print into JTable when i click find button. Goal is to find a record and print that record only, but for now i am trying to print all the records. Once i get that i will change my code to search desired record and print it. when i click the find button nothing happens. Can you please take a look at my code, dbTest() method. thanks.
void dbTest() {
DataInputStream dis = null;
String dbRecord = null;
String hold;
try {
File f = new File("customer.txt");
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
Vector dataVector = new Vector();
Vector headVector = new Vector(2);
Vector row = new Vector();
// read the record of the text database
while ( (dbRecord = dis.readLine()) != null) {
StringTokenizer st = new StringTokenizer(dbRecord, ",");
while (st.hasMoreTokens()) {
row.addElement(st.nextToken());
System.out.println("Inside nested loop: " + row);
System.out.println("inside loop: " + row);
dataVector.addElement(row);
System.out.println("outside loop: " + row);
headVector.addElement("Title");
headVector.addElement("Type");
dataTable = new JTable(dataVector, headVector);
dataTableScrollPane.setViewportView(dataTable);
} catch (IOException e) {
// catch io errors from FileInputStream or readLine()
System.out.println("Uh oh, got an IOException error!" + e.getMessage());
} finally {
// if the file opened okay, make sure we close it
if (dis != null) {
try {
dis.close();
} catch (IOException ioe) {
} // end if
} // end finally
} // end dbTestHere's a thread that loads a text file into a JTable:
http://forum.java.sun.com/thread.jsp?forum=57&thread=315172
And my reply in this thread shows how you can use a text file as a simple database:
http://forum.java.sun.com/thread.jsp?forum=31&thread=342380 -
How to extract data from text file to database table
Hi ,
I am trying to upload data in text file to database table using GUI_UPLOAD function .what would be the program for that.
thanks in advance.Hi,
I don't think you have a standard sap program to upload data from file to database table...
Instead you can create a custom program like this..
DATA: T_FILEDATA(1000) OCCURS 0 WITH HEADER LINE.
DATA: T_ZTABLE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\TEST.TXT'
tables
data_tab = T_FILEDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT T_FILEDATA.
T_ZTABLE = T_FILEDATA.
APPEND T_ZTABLE.
ENDLOOP.
MODIFY ZTABLE FROM TABLE T_ZTABLE.
COMMIT WORK..
Thanks,
Naren -
How to write data to text file using external tables
can anybody tell how to write data to text file using external tables concept?
Hi,
Using external table u can load the data in your local table in database,
then using your local db table and UTL_FILE pacakge u can wrrite data to text file
external table
~~~~~~~~~~~
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251
UTL_FILE
~~~~~~~~~
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093
Message was edited by:
Nicloei W
Message was edited by:
Nicloei W -
ALE, IDOC - need to send IDOC and create a text file
Hi,
i need to send idoc to some other system and create a text file in that.
I want sent data to Channel Cluster.
what are the settings required for that in transactions
BD54
SCC4
SM59 - which connection is required
WE21 - which type of port
WE20 - which partner
BD64
Is there any other function modules required.
which function module is suitable like MASTER_IDOC_DISTRIBUTE.Hi,
SM59 - Use TCP/IP Connection with connection type 'T'
WE20 - Partner Name can be logical system name, if it is a vendor/customer you can configure it under the respective names.
Thanks
Krithika -
How to export bulk data in text file
Dear,
We have an requirement to get data from GL CONTAINING below tables, but it's taking lot of time, could you share the best way to get data in text file as quick as possiable.
from gl_je_headers_v,gl_je_lines,GL_JE_CATEGORIES
,gl_code_combinations_v
where gl_je_headers_v.je_header_id = gl_je_lines.je_header_id
AND GL_JE_CATEGORIES.je_category_name = gl_je_headers_v.je_category
and gl_code_combinations_v.CODE_COMBINATION_ID =
gl_je_lines.code_combination_id
and gl_code_combinations_v.CHART_OF_ACCOUNTS_ID = 50349
AND gl_je_headers_v.PERIOD_NAME = 'SEP-2012'it's based on formatting data in text file
you can use utl_file but it's row by row process your data
you can try spool
as example
spool c:\tmp\myfile.txt
select *
from emp;
spool off;or try export for example in sql developer -
How to add header and footer to a file through ODI?
hi,
I want to add header and footer to my file..............footer should contain a counter so that page number can be displayed...................
Can anyone please guide me .................
Thanks .............
Ritikawhat is the utility you are using to create file . Interface or OdiSqlUnload ?
and what do you want to have Header and Footer as and how are you concluding the File as page 1 and page 2 etc ... ? -
Remove duplicates while loading data from text file
Hi,
Data in text file (some times has duplicates) is being loaded into Oracle 9i database using Informatica. To improve performance, we would like to remove duplicates at the time of each load using Oracle procedure. Could you please help me with this?
Thanks,
LakshmiNo, our table doesn't have that. Most of the functionality is managed at the informatica level. Is there any other way? Thanks,
Maybe you are looking for
-
I also am having a problem with the songs I purchased using the laptop not showing on the desk top itunes, even though it is authorized to do so. The new songs did show up on the iPad iTunes, however. Have no idea why. I thought this happened auto
-
How can I sync a playlist from my itunes account to my friends iPad?
When I connect the ipad to my macbook and open itunes there is not a 'sync music' option as usual, only 'Itunes match is on' and the option to sync voice memos?
-
How do you install Perforce as daemon on OS X Snow Leopard Server?
I recently purchased a mac mini with Snow Leopard Server, and I am interested in installing Perforce as a daemon. I am familiar on how to do this on a Linux distro, but not so much on Snow Leopard Server. Is there some documentation that explains how
-
Connecting IPhone 5s to Samsung TV
I have the right adappter It works on a similar TV. On this TV it tells me " Mode not Supported".
-
Is it too much to ask from apple, an option for different volumes levels from different apps, including alarm, text, email, basically from every posible app?