Import data form text files
I wish to import multiple text files into one table in SQL Server 2008 but I don't have SSIS
capability. I wish for the format of the file to stay the same (no formatting or modification of data) and I wish for each file to be dumped into its own row under one column heading (e.g. 'Data')
Please use BULK INSERT to bring the text files into a SQL table...but you have to know the layout of the data, and create destination table
(whether it's a "staging" table or the real table) before you do anything else.you also need to know how the file is delimtied...comma delimited , tab delimited, or fixed width, or some custom delimiter. Sample :
BULK INSERT MULTIPLE FILE
-a table to loop thru filenames drop table ALLFILENAMES
CREATE TABLE ALLFILENAMES(WHICHPATH VARCHAR(255),WHICHFILE varchar(255))
--the source table: yours already exists, but needed for this example.
CREATE TABLE BULKACT(RAWDATA VARCHAR (8000))
--some variables
declare @filename varchar(255),
@path varchar(255),
@sql varchar(8000),
@cmd varchar(1000)
--get the list of files to process:
SET @path = 'C:\DB\'
SET @cmd = 'dir ' + @path + '*.txt /b'
INSERT INTO ALLFILENAMES(WHICHFILE)
EXEC Master..xp_cmdShell @cmd
UPDATE ALLFILENAMES SET WHICHPATH = @path where WHICHPATH is null
SET @path = 'C:\DB2\'
SET @cmd = 'dir ' + @path + '*.txt /b'
INSERT INTO ALLFILENAMES(WHICHFILE)
EXEC Master..xp_cmdShell @cmd
UPDATE ALLFILENAMES SET WHICHPATH = @path where WHICHPATH is null
SET @path = 'C:\DB3\'
SET @cmd = 'dir ' + @path + '*.txt /b'
INSERT INTO ALLFILENAMES(WHICHFILE)
EXEC Master..xp_cmdShell @cmd
UPDATE ALLFILENAMES SET WHICHPATH = @path where WHICHPATH is null
SET @path = 'C:\DB4\'
SET @cmd = 'dir ' + @path + '*.txt /b'
INSERT INTO ALLFILENAMES(WHICHFILE)
EXEC Master..xp_cmdShell @cmd
UPDATE ALLFILENAMES SET WHICHPATH = @path where WHICHPATH is null
--cursor loop
declare c1 cursor for SELECT WHICHPATH,WHICHFILE FROM ALLFILENAMES where WHICHFILE like '%.txt%'
open c1
fetch next from c1 into @path,@filename
While @@fetch_status <> -1
begin
--bulk insert won't take a variable name, so make a sql and execute it instead:
set @sql = 'BULK INSERT BULKACT FROM ''' + @path + @filename + ''' '
+ ' WITH (
DATAFILETYPE = ''char'',
FIELDTERMINATOR = ''||||'',
ROWTERMINATOR = ''\n'',
FIRSTROW = 1
print @sql
exec (@sql)
fetch next from c1 into @path,@filename
end
close c1
deallocate c1
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/
Similar Messages
-
We are trying to import data from a text file into fields in a form using the importTextData method for the Doc object. The script we are using looks like this:
var doc = event.target;
var returnCode = doc.importTextData("datafile.txt",0);
The text file "datafile.txt" contains tab separated values in a header row (which corresonds to field names in the form) followed by tab separated datarows - all according to instructions in the API.
The returnCode will result in an integer value, which in our case represent "Error: Invalid Row". It would help us a lot if anyone could give us a hint on what may be wrong or even better post a working solution.
We have also tried using the importTextData method without any parameters (the user is then prompted to select the text file and then the specific row) but the result remains the same. The fields in the form are not populated with data and the message "Error: Invalid Row" is returned.
Annika LindqvistThe problem you're experiencing is that importTextData is an Acrobat API call. As such, it executes on the AcroForm field equivalents to the XFA fields you've placed on the form. What's not indicated in the API for importTextData is that the names in the fields in the header of the text file must be the
full AcroForm SOM expression.
I've created a working sample to explain this.
First, I created a form with a table with one row in it containing 3 columns named FirstName, LastName and Country.
Then I created a data.txt file like this:
FirstName LastName Country
Fred Jones USA
Kyle Francis Canada
Sam Roberts UK
I then placed a button on the form which calls "event.target.importTextData();" and ran the form in Preview.
Of course, when I selected a row for import, nothing happened.
I then used the "Avanced | Forms | Export Data from Form..." menu option in Acrobat after filling-in the fields in the table with some text and looked at the generated text file (note that you have to specify text as the output format). In there, I was able to figure-out what the full AcroFrom SOM expression was for each field I wanted to import data into.
I changed my data file to look like this:
form1[0].#subform[0].Table1[0].Row1[0].FirstName[0] form1[0].#subform[0].Table1[0].Row1[0].LastName[0] form1[0].#subform[0].Table1[0].Row1[0].Country[0]
Fred Jones USA
Kyle Francis Canada
Sam Roberts UK
Afther that, importTextData worked as expected without any errors.
Stefan
Adobe Systems -
Import data from text file to a table using t-sql
Hi,
I am trying to import data from a text file to a table using the below query but it is returning an error.
SELECT *, 2 FROM OPENROWSET(BULK 'W:\file.txt',
FORMATFILE = 'W:\format_file.xml', FIRSTROW = 1, LASTROW = 1) as f
The error is:
Bulk load data conversion error (truncation) for row 1, column 1 (COPYRIGHT_DETAIL_CODE).<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="1" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="1" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="2" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="5" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="3" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="5" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="4" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="10" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="5" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="1" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="6" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="1" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="7" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="10" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="8" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="10" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="9" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="8" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="10" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="8" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="11" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="8" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="12" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="5" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="13" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="8" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="14" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="2" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="15" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="3" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="16" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="4" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="17" xsi:type="CharTerm" TERMINATOR="\r\n" MAX_LENGTH="43" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
</RECORD>
<ROW>
<COLUMN SOURCE="1" NAME="Name1" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="2" NAME="Name2" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="3" NAME="Name3" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="4" NAME="Name4" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="5" NAME="Name5" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="6" NAME="Name6" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="7" NAME="Name7" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="8" NAME="Name8" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="9" NAME="Name9" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="10" NAME="Name10" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="11" NAME="Name11" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="12" NAME="Name12" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="13" NAME="Name13" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="14" NAME="Name14" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="15" NAME="Name15" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="16" NAME="Name16" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="17" NAME="Name17" xsi:type="SQLVARYCHAR"/>
</ROW>
</BCPFORMAT>
The format file that I am using is just like the same one above.
-
Import data from text file to cube
Hi,
I'm trying to load data from a text file to a cube.
Just as an experiment, I exported data from a cube into a file. Then wrote a script to import the same file back into the cube - It works fine.
After this i deleted some time members from the outline and tried loading - but it errored out -
ERROR MESSAGE : Unknown Member [2007-11-06] in Data Load, [22] Records Completed.
I want the valid records to be loaded and the invalid ones rejected but this is not happening.
This is the command i use:
IMPORT 3 "/PATH/Filename.txt" 4 "n" 2 "IMP001.rul" "n" "/PATH/error.txt";
I'm not using a rule file for this as it was not working fine with a rule file(IMP001).
Please let me know how i can proceed with the import by just rejecting the records where members are not found in the outline.
Thanks in advance,
Rags.Yes, the question wasn't intended to recommend it as a solution, but a recurring need for this type of manipulation could point to a more robust answer without making it overly complex.
The "end version" of what I envisioned included a temporary cube that included all members ever loaded, and UDA's assigned to the "current set", for use in an export/import process. The export would be the source for the rebuild of the production cube. This end vision seemed a little on the complex side, but it would be robust and work long term. There are obviously different ways to simplify this approach.
The simplification that my question was aimed for is to eliminate the use of a template outline from a theoretical approach I've used in the past (in a round about way). In essence, if you can leave the members in the production cube and just clear the data, you could use a flag value that is loaded to create a D-C value (say, on scenario) to perform the extract. Loading a "1" would generate output, and a "0" to suppress output (using "scenario" * "flag" for the report value). Deleting the member is thus not needed but done "virtually" with the flag on the output side.
I know, my crazy thinking is not easy to follow, even for me -- but thinking out of the box serves me well most of the time. -
Dear Friends,
I am facing below error at the time of select statement
SQL> select * from ext_test;
ORA-29913: error in executing ODCIEXTTABLEOPEN callout ORA-29400: data cartridge error error opening file c:\mydata\EXT_TEST_1948_3788.log
I have done below work. Please solve above problem i will be very thankful to you.
CREATE OR REPLACE DIRECTORY TEST_DIR AS "c:\mydata";
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser;
As myuser:
SQL> CREATE TABLE ext_test
2 (id NUMBER,
3 empname VARCHAR2(20),
4 rate NUMBER)
5 ORGANIZATION EXTERNAL
6 (TYPE ORACLE_LOADER
7 DEFAULT DIRECTORY TEST_DIR
8 ACCESS PARAMETERS
9 (RECORDS DELIMITED BY NEWLINE
10 FIELDS TERMINATED BY ","
11 OPTIONALLY ENCLOSED BY '"'
12 (id,
13 empname,
14 rate
15 )
16 )
17 LOCATION ('test.txt')
18 );
Table created.
Regards
Kamran>
Hi Kamran,
SQL> select * from ext_test;
ORA-29913: error in executing ODCIEXTTABLEOPEN callout ORA-29400: data cartridge
error error opening file c:\mydata\EXT_TEST_1948_3788.logYou have no "LOGFILE" clause in your CREATE TABLE section - I'm wondering why it's trying to
create one if you haven't asked for it?
It's probably permissions as Jeneesh said. If you have checked that, then look here
http://orafaq.com/node/848
http://www.adp-gmbh.ch/ora/misc/ext_table.html
http://www.oracle-base.com/articles/9i/external-tables-9i.php
[url www.oracle-developer.net/display.php?id=204] <<=== exp. this one!
All four of the above sites are very good for Oracle generally if you're looking for hints, tips &c.
HTH,
Paul...
>
>
>
I have done below work. Please solve above problem i will be very thankful to you.
CREATE OR REPLACE DIRECTORY TEST_DIR AS "c:\mydata";
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser;
As myuser:
SQL> CREATE TABLE ext_test
2 (id NUMBER,
3 empname VARCHAR2(20),
4 rate NUMBER)
5 ORGANIZATION EXTERNAL
6 (TYPE ORACLE_LOADER
7 DEFAULT DIRECTORY TEST_DIR
8 ACCESS PARAMETERS
9 (RECORDS DELIMITED BY NEWLINE
10 FIELDS TERMINATED BY ","
11 OPTIONALLY ENCLOSED BY '"'
12 (id,
13 empname,
14 rate
15 )
16 )
17 LOCATION ('test.txt')
18 );
Table created.
Regards
KamranEdited by: Paulie on 24-Jul-2012 10:12 -
Hello.
Is anybody can help how to import data from excel file to the form created with designer 7.0. Originally there is a script inside the form to populate drop down list and depending from data selected in the ID number drop down list, there will be filled out the description and the prices text fields. But now I have to modify this form with data from excel file, which has more than 30000 lines and put all this data to script is too much.
So, can somebody know how can I after filling the ID number field , populate the description and price text fields with data from excel file corresponding to this ID number ?
This form is used in Adobe reader.
Any comments are welcome.
Regards,
AivarHi
That's what i said in my prev. Post to clear cache... :)
disable your cache from nqsconfig.ini
In cache section of NQSConfig file,
you find
ENABLE = YES;
set to NO
OR
if you are using data ware house as the source for OBIEE,
you know that when ETL is done, so just create iBot to purge cache automatically at that particular intervals,
So that report runs freshly at that time
And what happened to your View Selector question?
Edited by: Kishore Guggilla on Jul 3, 2009 3:52 PM -
How to create the Export Data and Import Data using flat file interface
Hi,
Request to let me know based on the requirement below on how to export and import data using flat file interface.....
Please provide the steps involved for the same.......
BW/BI - Recovery Process for SNP data.
For each SNP InfoProvider,
create:
1) Export Data:
1.a) Create an export data source, InfoPackage, comm structure, etc. necessary to create an ASCII fixed length flat file on the XI
ctnhsappdata\iface\SCPI063\Out folder for each SNP InfoProvider.
1.b) All fields in each InfoProvider should be exported and included in the flat file.
1.c) A process chain should be created for each InfoProvider with a start event.
1.d) If the file exists on the target drive it should be overwritten.
1.e) The exported data file name should include the InfoProvider technical name.
1.f) Include APO Planning Version, Date of Planning Run, APO Location, Calendar Year/Month, Material and BW Plant as selection criteria.
2) Import Data:
2.a) Create a flat file source system InfoPackage, comm structure, etc. necessary to import ASCII fixed length flat files from the XI
ctnhsappdata\iface\SCPI063\Out folder for each SNP InfoProvider.
2.b) All fields for each InfoProvider should be mapped and imported from the flat file.
2.c) A process chain should be created for each InfoProvider with a start event.
2.d) The file should be archived in the
ctnhsappdata\iface\SCPI063\Archive directory. Each file name should have the date appended in YYYYMMDD format. Each file should be deleted from the \Out directory after it is archived.
Thanks in advance.
TysonHere's some info on working with plists:
http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Introduc tion/chapter1_section1.html
They can be edited with any text editor. Xcode provides a graphical editor for them - make sure to use the .plist extension so Xcode will recognize it. -
Is it possible to import a Fixed Text file that does not have a header?
I'm trying to import a Fixed Text file through Import Manager, but the text file I am receiving does not have a header on it (the first row is valid data). When I try importing this, Import Manager uses the first row of data as the headings. Is there any way to turn this off and tell Import Manager there is no header data in the file?
Thanks!Hi Ryan ,ur requirement can be met only when u import the file as ODBC .for this follow the below steps.
1)Go to control panel,in ur settings,select administrative tools
2) In that select DATA SOURCE(ODBC ).
3)Go to SYSTEM DSN tab select tab .
4)Select ur file type MICROSOFT TEST DRIVER (.txt,.csv)
5)Double click on "Import DSN" and in the blank give the name of DATA SOURCE NAME any name u want to give.
6)Uncheck the use current directory box and select the directory ur file is it will automatically show ur source file select it and click ok.
7) Now when u import ur file as ODBC give the name of ur DATA source name which u have given and it will show ur file in the source preview itself .
In this way u can import ur file as ODBC.
Hope this may help u.
Regards
Ankit -
Import a CSV text file into SQL Server using DTS
Hi,
This may be a silly question but im gonna ask it anyway!
What i need to do is execute a DTS package from a CF page to read a text file and import its content to a table. I have 100's of txt files with 10,000's of rows.
The reason i think this is a silly question is because when setting the DTS package in SQL Ent, you have to specify the file name of the file you wish to import data from, therefore, its possible that you cannot change the file name. Ive done lots of research and not found one example that will allow me to do dynamically change the file name making the DTS pick up a different file. The only code ive found is as below, that executes the DTS and imports the data obtained from the file name that was set when the DTS package was created.
<cfobject
type="COM" name="objDTS" class="DTS.Package" action="CREATE">
<CFSET
r = objDTS.LoadfromSQLServer("[SERVERNAME]","[PASSWORD]","",0,"","","","[DTSPACKAGE]","")>
<cfset
p = objDTS.Execute()>
I found the following suggestion in a forum somewhere, but ive not had much luck with it
<cfset
objDTS.GlobalVariables.Item("filename").Value = "[statsFileName]">
I know an alternative to this is to read the file using CFfile or using Java and insert one by one, i dont dont like that method as it could cause performance issues with my server.
Hope someone can help me out.
regards
dQuestions:
1. What version of SQL Server are you using?
2. Are you required to use a specific DTS package or do you simply need to import data from a file to a table? You might also consider using the bcp utility or, if you are using 2005 or newer, integration services.
3. Is the uploading of files and the import of data a manual process or is it automated? Is there a user uploading one file at a time to your server or do you receive files in batches. Can you describe the work flow?
You might try the following if you are required to use DTS:
1. Upload your text file with CFFILE, putting in the directory expected by your DTS package.
2. Rename the file to the name required by your DTS package
3. Use CFEXECUTE to run the DTS package by calling dtsrun at the command line.
dtsrun
http://msdn.microsoft.com/en-us/library/aa224467%28SQL.80%29.aspx
bcp
http://msdn.microsoft.com/en-us/library/aa174646%28SQL.80%29.aspx -
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 -
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 -
Aperture Video Import Problem - from Lumix GH4: Imported clips have their dates changed to the import date. The files show up on the hard drive with import date not created date, but many of these same files are not showing up in Aperture. Sometimes the clips actually show up with the current import but take on the video information from a previously imported file.
It was suggested I move this question to IPhoto or IMovie which I did.
Well moving to a different discussion group did not provide an answer to this question either. But what I finally did was import one batch of photos and videos into IPhoto for a given day at a time. Working with these I could change the date and times in order to get them in the original sequench taken. Then I would create an album with that batch. These would all be on the same day (IMove was closed for this phase). Then I would open IMovie, generate the thumbnails for that album, and select the album I had created. This was necessary because the importing process in IPhoto was using incorrect dates for my video so it was a real struggle finding them in IMove until I developed this approach.
I believe that this whole process was so screwy because I was importing from an external hard drive not a camera. I had these photos on a PC and did not have the original cameras to use to import directly which I am fairly sure would have made this easier!
Maybe you are looking for
-
Have a New MacBook Pro - Trying to get it to work with the mini DisplayPort to VGA cable on a DELL 2100MP Projector. Can not get anything to happen. The DELL Projector works fine with a PC Laptop plugged VGA to VGA and or a PC Desktop plugged VGA to
-
How to add a button to an existing frame?
Hey everyone , this is a GUI question for a project I am doing in school. Basically, I have created a frame that has 3 JPanes, top, center and bottom. Here are the declarations: this.add(northPanel, BorderLayout.NORTH); this.add(SYBoard,
-
What does unsupported paths even mean??
I get an unsupported paths error routinely. What does it indicate to me, the user? The images display correctly. The images are found at the path which is "unsupported." The path was created by Edge Animate itself! Thanks for shedding some light.
-
Formatting for cubes and dimensions
Is it possible to use different formatting on the cubes and dimensions in the subject area in OBIEE? We're on 11.1.1.6.2. Our report writers want to easily be able to differentiate between the 2. Can we make the cubes bold or use a different font or
-
Error during Billing Enhancement
Hi Experts, I am trying to get the Service Organisation Field in Search query of Billing due list,in WEB Ui and also the same thing i need to add in the billing due list header. I got a document mentioned as BILLIGN ENHANCEMENT COOKBOOK, as of tht i