LSMW With multiple files
Hi All,
I am trying to see if it is possible to use two files in one LSMW session.
I have a file with two columns:
Legacy code and Amount
I have another fie which is a lookup table and have two columns
Legacy code and SAp wage type
Is there way so that I can use these two files to upload the SAP wage type and deduction amount to PA0014 in one step.
Basically is there a way that first file will do a look up for the SAP WAGE Type from the second file?
I hope this is not confusing
Thanks,
~Mark
Hi,
When you get there double click on the line which says..
Coding: * __GLOBAL_DATA__
Then you will get a editor..
You can write code to declare the internal table..
DATA: BEGIN OF ITAB OCCURS 0,
Your file structure...
END OF ITAB.
In the
__BEGIN_OF_PROCESSING__
Use the function module GUI_UPLOAD to load the file and move it to an internal table ITAB..
Thanks,
Naren
Similar Messages
-
Working with Multiple Files in Workspace Layout
If I was working with multiple files in the workspace layout, they each used to be available for selection from a tab. Now I can either cascade the files horizontally or vertically - but not have them appear in a tab across the top of the workspace layout.
Does anyone know how to set the workspace to present multiple files in tabs? I have CS3.Tanya,
This may not help, but the times when that happens to me is when I go too fast and some operations haven't finished. I then try to select a file that hasn't completed and the file I select is in the process of having the data updated. The worst is when it is trying to render as I am doing something.
I hope this helps some.
Mel -
Problem Creating PDF with Multiple Files in Pro. 7
I'm using Adobe Acrobat Professional 7 on a computer with Windows XP.
The problem is that when I try to create a PDF with multiple files everything just suddenly stops. There are 75 files involved and when it gets to around 41 or so (don't know the exact number because I turned away from my computer for just a moment), it just stops. There are no error messages; nothing. Just a blank Acrobat screen.
Last week I had a different problem which was resolved by an uninstall/reinstall and I was able to create the PDF with those exact same 75 files, but after the PDF was created I realised that some changes needed to be made. I dumped the PDF, made the appropriate changes and left it for the weekend. Today I the new problem has arisen.
Any ideas what the problem might be?I've read many discussions about Acrobat and problems with server files, with the general solution being what you are doing... copy the files to a local hard drive
-
Create folder with multiple files (was: folders)
Can you create a folder with multiple files and direct the page to go to the folder and then the reader can select the file they wish to choose? Example Council Mintes Folder with a file for each set of minutes. The hyperlink would open the folder and then the reader would select whch set of minutes they'd like to see.
You may not have access to it depending on your hosting company and plan, but if you did have the ability to change it you'd normally do it in the admin area of your hosting account which would update the proper files on your server.
You may also be able to do it manually, but the "how to" depends on the server type you are running.
EDIT: I'd still suggest using a server script (like the PHP I linked to) because the look of a directory with browsing turned on is pretty ugly and can't be changes since it's not a page on your site. With the PHP I linked to, you could have an actual page for your links, complete with your site's design, that simply lists the files from the specified directory. It's very simple to set up if you have PHP on your server. -
How to send the mail with multiple file attachments ?
Sending mails with multiple files as attachments.
You need to start from the app, assuming that it has an email function, that contains the files that you want to send as attachments. The Photos app allows you to send up to 5 photos on the same email, but if you want to send multiple file types then you need an app that supports all those file types. I use the GoodReader app which supports quite a few document/file types (e.g. PDF, Excel, Word, pictures), and from that I can select multiple files (including different types) and attach them to the same email.
-
"Place into Photoshop" with multiple files
I'd love to see this feature in Bridge
Import multiple files into an existing photoshop file (with a predetermined size ) as smart object layers in photoshop.
The options that Bridge currently offers falls short in 2 area
Load Files into Photoshop Layers-- does not import smart objects and creates a new photoshop file that ends up being as large as the largest imported file
Place into Photoshop--only lets you do one at a time
I need "Place into Photoshop" with multiple files
Is there a way to do this?
Thanks!!I agree, placing multiple files into your PSD as smart objects all at once like InDesign would be a great (and logical) feature for Photoshop to have. The only "workaround" I have is to create a shortcut using Ctrt+Alt+Shift+D (which is not used by anything), so you can place pictures/graphics more quickly, rather than using the menu each time.
-
Generate Proxy from WSDL with multiple Files
I need to load a WSDL (to generate a web service consumer proxy). However, that WSDL is build from multiple files, both .wsdl and .xsd, not a single one. It seems the SAP wizard to generate the proxy does expect one single WSDL file however.
Is there a way in SAP to load a WSDL with multiple files, or do I need to (manually) flatten all these files into one single file?I am not sure why it fails in WebSphere. Please try posting
this question to a WebSphere newsgroup.
Regards,
-manoj
http://manojc.com
"viswanath" <[email protected]> wrote in message
news:40aee7fa$1@mktnews1...
>
thanks manoj for your reply.
I'm using IBM WebSphere SDK for Web Services v5.1
for generation of java client.
I'm able to generate the client but the problem is
the WSDl2Java command ignored the SOAPHeaders while
generating the proxy. Since I'm using SOAP headers for
authentication the code fails.
Thanks,
Viswanath
"manoj cheenath" <[email protected]> wrote:
I am not sure which tool you are using
to generate web service clent. To generate
a WLS web service client you have to use clientgen.
Details here:
http://e-docs.bea.com/wls/docs81/webserv/anttasks.html
Regards,
-manoj
http://manojc.com
"viswanath" <[email protected]> wrote in message
news:40ad8a07$[email protected]..
HI,
I have a web service (implemented in .NET) which extends soap headersfor
doing
Authentication. WSDL is generated out of this web service. But wheni use
wsdl2java
(J2EE) to generate a proxy class, there is no interface generated forsoap
headers.
Without extending SOAP headers the web service works fine.
Basically, I'm looking for a way to generate java interfaces (ie.
proxies)
for
SOAP headers out of the WSDL file.
PFA the WSDL file and the proxy
Any help on this is appreciated. -
Pull a zip file with multiple files unzip it, and finally load one of the f
Hi Aill,
I have following query.
Could we do the following with XI: pull a zip file with multiple files from a vendor which resides outside of XI server network, unzip it, and finally load one of the files to SAP?
Regards
Rohan SHi Varadharajan,
I have 10 text files in some ZIP file on one server which is out side of network. We can reach that file through Proxy only to read ZIP file.
I need to extract the file and on the bases of some condition one of the file i need to upload data to SAP.
Is it possible. If possible then How?
Regards -
LSMW with multiple transaction n multiple files
Hi experts,
is it possible to do data transfer using LSMW(recording) with multiple transaction and multiple files .
Like 3 transaction and 3 files.
I want 1st transaction and 1st file to upload first then
2nd transaction and 2nd file
3rd transaction and 3rd fileHi,
i think you mean that you want to process first the 1st record of file1 with transaction 1 than 1st record of file 2 with transaction 2
This is possible using recordings(as you asked for).
First Maintain Object Attributes then mark batch input recordings and maintain recordings name.
On the right side are two buttons one for overviewing recordings and one for maintaining more recordings.
Here enter your additional recordings.
Now specify for each recording a own Source Structure and
maintain the Structure Relations and so on...
If you just want to do 1st transaction with all records of file1 than 2nd transaction use three different LSMWs.
You can automize the process by using Data Transfer Workbench(SXDA).
Regards,
Sebastian -
Find and replace with multiple files and with a watch folder
I am trying to create a watch folder that uses red_menace script to:
1. Have a folder that receives multiple xml files that run the script one by one.
2. then move the files to an output folder.
I tried modifying the set TheFIle to choose file -- the original text file to:
with multiple selections allowed
But that doesn't seem to work. I know i'm missing a step. Any help is much appreciated!
Thanks!
The way i'd like to setup things is having an input folder on the desktop (or just have the application on the desktop and I can drag the files onto it), and let it do it's thing. Once it's done have it export the xml files into an output folder.
Here's what i got so far:
on open
set TheFIle to choose file -- the original text file
set TheFolder to ("Macintosh HD:Users:user1:Desktop:out") -- the folder for the output file
set TheName to (GetUniqueName for TheFIle from TheFolder) -- the name for the output file
set TheText to read TheFIle -- get the text to edit
set Originals to {"KPCALDATE", "KPCALEVENT", "KPCALDAY", "KPCALBODY", "obituaries name", "" & return & "</cstyle></pstyle>" & return & "<pstyle name=\"obituaries text\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\" font=\"ADV AGBook-Medium 2\">", "<pstyle name=\"Recipe Ingredients\"><cstyle>", " .com", " .net", " .org", " .edu", "www .", "www. ", "Ho- nolulu", "<pstyle name=\"kicker 12\"><cstyle allcaps=\"1\">fashion news</cstyle><cstyle allcaps=\"1\">" & return & "</cstyle></pstyle>" & return & "", "<component name=\"Headline 1\" type=\"Headline\">" & return & "<header>" & return & "<field name=\"Component name\" type=\"string\" value=\"Headline 1\"/>" & return & "<field name=\"Component type\" type=\"popup\" value=\"Headline\"/>" & return & "</header>" & return & "<body>" & return & "<pstyle name=\"hed STANDARD 36\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle allcaps=\"1\">", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\">", "<pstyle name=\"tagline\"><cstyle>-", "-", "
Per serving:", "<pstyle name=\"Titlebar - mini, red\"><cstyle allcaps=\"1\">NATION & World </cstyle><cstyle allcaps=\"1\">Report</cstyle><cstyle allcaps=\"1\">" & return & "</cstyle></pstyle>" & return & "", "</cstyle></pstyle>"} -- the terms that can be replaced
set Replacements to {"subhed", "subhed", "subhed", "Normal", "obituaries text", ", ", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\" font=\"ADV AGBook-Medium 2\">", "<pstyle name=\"Recipe Ingredients\"><cstyle>
", ".com", ".net", ".org", ".edu", "www.", "www.", "Honolulu", "", "<component name=\"Headline1\" type=\"Headline\">" & return & "<header>" & return & "<field name=\"Component name\" type=\"string\" value=\"Headline1\"/>" & return & "<field name=\"Component type\" type=\"popup\" value=\"Headline\"/>" & return & "</header>" & return & "<body>" & return & "<pstyle name=\"hed STANDARD 27\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle allcaps=\"1\">", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\">", "<pstyle name=\"tagline\"><cstyle>", " ", "
Per serving:", "","" & return & "</cstyle></pstyle>"} -- the replacement terms
repeat with AnItem from 1 to count Originals
set TheText to (replaceText of TheText from (item AnItem of Originals) to (item AnItem of Replacements))
end repeat
try -- write a new output file
tell application "Finder" to make new file at TheFolder with properties {name:TheName}
set OpenFile to open for access (result as alias) with write permission
write TheText to OpenFile starting at eof
close access OpenFile
on error errmess
try
log errmess
close access OpenFile
end try
end try
end open
to GetUniqueName for SomeFile from SomeFolder
check if SomeFile exists in SomeFolder, creating a new unique name if needed
parameters - SomeFile [mixed]: a source file path
SomeFolder [mixed]: a folder to check
returns [text]: a unique file name and extension
set {Counter, Divider} to {"00", "_"}
-- get the name and extension
set {name:TheName, name extension:TheExtension} to info for file (SomeFile as text)
if TheExtension is missing value then set TheExtension to ""
set TheName to text 1 thru -((count TheExtension) + 2) of TheName
set NewName to TheName & "." & TheExtension
tell application "System Events" to tell (get name of files of folder (SomeFolder as text))
repeat while it contains NewName
set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
set NewName to TheName & Divider & Counter & "." & TheExtension
end repeat
end tell
return NewName
end GetUniqueName
to EditItems of SomeItems given Title:TheTitle, Prompt:ThePrompt
displays a dialog for multiple item edit (note that a return is used between each edit item)
for each of the items in SomeItems, a line containing it's text is placed in the edit box
the number of items returned are padded or truncated to match the number of items in SomeItems
parameters - SomeItems [list]: a list of text items to edit
TheTitle [boolean/text]: use a default or the given dialog title
ThePrompt [boolean/text]: use a default or the given prompt text
returns [list]: a list of the edited items, or {} if error
set {TheItems, TheInput, TheCount} to {{}, {}, (count SomeItems)}
if TheCount is less than 1 then return {} -- error
if ThePrompt is in {true, false} then -- "with" or "without" Prompt
if ThePrompt then
set ThePrompt to "Edit the following items:" & return -- default
else
set ThePrompt to ""
end if
else -- fix up the given prompt a little
set ThePrompt to ThePrompt & return
end if
if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" Title
set TheTitle to "Multiple Edit Dialog" -- default
else
set TheTitle to ""
end if
set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set {SomeItems, AppleScript's text item delimiters} to {SomeItems as text, TempTID}
set TheInput to paragraphs of text returned of (display dialog ThePrompt with title TheTitle default answer SomeItems)
repeat with AnItem from 1 to TheCount -- pad/truncate entered items
try
set the end of TheItems to (item AnItem of TheInput)
on error
set the end of TheItems to ""
end try
end repeat
return TheItems
end EditItems
to replaceText of SomeText from OldItem to NewItem
replace all occurances of OldItem with NewItem
parameters - SomeText [text]: the text containing the item(s) to change
OldItem [text]: the item to be replaced
NewItem [text]: the item to replace with
returns [text]: the text with the item(s) replaced
set SomeText to SomeText as Unicode text -- TID's are case insensitive with Unicode text
set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, OldItem}
set {ItemList, AppleScript's text item delimiters} to {text items of SomeText, NewItem}
set {SomeText, AppleScript's text item delimiters} to {ItemList as text, TempTID}
return SomeText
end replaceText
Message was edited by: gamebreakersWhen you use the open or adding folder items to handlers, you need to add the parameters for the file items passed to them.
I'll go ahead and post the applet/droplet version of my original script from the previous topic for reference:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into the Script Editor">
-- search and replace multiple items applet/droplet/folder action
-- the terms to replace - edit as needed
property EditableItems : {¬
"one", ¬
"two", ¬
"three", ¬
"four", ¬
"five", ¬
"six", ¬
"seven", ¬
"eight", ¬
"nine", ¬
"ten", ¬
"eleven", ¬
"twelve", ¬
"thirteen", ¬
"fourteen", ¬
"fifteen", ¬
"sixteen", ¬
"seventeen", ¬
"eighteen", ¬
"nineteen", ¬
"twenty"}
-- the folder for the output file(s) - change as needed
property TheFolder : (path to desktop)
property LastEditItems : EditableItems
on run
the applet/droplet was double-clicked
open (choose file with multiple selections allowed)
end run
on open TheItems
items were dropped onto the applet/droplet
parameters - TheItems [list]: a list of the items (aliases) dropped
returns nothing
repeat with AnItem in TheItems
ReplaceMultipleItems from AnItem
end repeat
end open
on adding folder items to this_folder after receiving these_items
folder action - items were added to a folder
parameters - this_folder [alias]: the folder added to
these_items [list]: a list if items (aliases) added
returns nothing
repeat with AnItem in these_items
ReplaceMultipleItems from AnItem
end repeat
end adding folder items to
to ReplaceMultipleItems from SomeFile
replace multiple text items in SomeFile
parameters - SomeFile [alias]: the file to replace items in
returns nothing
set TheName to (GetUniqueName for SomeFile from TheFolder) -- the name for the output file
set TheText to read SomeFile -- get the text to edit
set Originals to (choose from list EditableItems default items LastEditItems with prompt "Select the terms to replace:" with multiple selections allowed) -- the specific terms to replace
set LastEditItems to Originals
set Replacements to (EditItems of Originals with Title given Prompt:"Edit the following replacement terms:") -- the replacement terms
repeat with AnItem from 1 to count Originals
set TheText to (ReplaceText of TheText from (item AnItem of Originals) to (item AnItem of Replacements))
end repeat
try -- write a new output file
tell application "Finder" to make new file at TheFolder with properties {name:TheName}
set OpenFile to open for access (result as alias) with write permission
write TheText to OpenFile starting at eof
close access OpenFile
on error errmess
try
log errmess
close access OpenFile
end try
end try
end ReplaceMultipleItems
to GetUniqueName for SomeFile from SomeFolder
check if SomeFile exists in SomeFolder, creating a new unique name if needed
parameters - SomeFile [mixed]: a source file path
SomeFolder [mixed]: a folder to check
returns [text]: a unique file name and extension
set {Counter, Divider} to {"00", "_"}
-- get the name and extension
set {name:TheName, name extension:TheExtension} to info for file (SomeFile as text)
if TheExtension is in {missing value, ""} then
set TheExtension to ""
else
set TheExtension to "." & TheExtension
end if
set {NewName, TheExtension} to {TheName, (ChangeCase of TheExtension to "upper")}
set TheName to text 1 thru -((count TheExtension) + 1) of TheName
tell application "System Events" to tell (get name of files of folder (SomeFolder as text))
repeat while it contains NewName
set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
set NewName to TheName & Divider & Counter & TheExtension
end repeat
end tell
return NewName
end GetUniqueName
to EditItems of SomeItems given Title:TheTitle, Prompt:ThePrompt
displays a dialog for multiple item edit (note that a return is used between each edit item)
for each of the items in SomeItems, a line containing it's text is placed in the edit box
the number of items returned are padded or truncated to match the number of items in SomeItems
parameters - SomeItems [list]: a list of text items to edit
TheTitle [boolean/text]: use a default or the given dialog title
ThePrompt [boolean/text]: use a default or the given prompt text
returns [list]: a list of the edited items, or {} if error
set {TheItems, TheInput, TheCount} to {{}, {}, (count SomeItems)}
if TheCount is less than 1 then return {} -- error
if ThePrompt is in {true, false} then -- "with" or "without" Prompt
if ThePrompt then
set ThePrompt to "Edit the following items:" & return -- default
else
set ThePrompt to ""
end if
else -- fix up the given prompt a little
set ThePrompt to ThePrompt & return
end if
if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" Title
set TheTitle to "Multiple Edit Dialog" -- default
else
set TheTitle to ""
end if
set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set {SomeItems, AppleScript's text item delimiters} to {SomeItems as text, TempTID}
set TheInput to paragraphs of text returned of (display dialog ThePrompt with title TheTitle default answer SomeItems)
repeat with AnItem from 1 to TheCount -- pad/truncate entered items
try
set the end of TheItems to (item AnItem of TheInput)
on error
set the end of TheItems to ""
end try
end repeat
return TheItems
end EditItems
to ReplaceText of SomeText from OldItem to NewItem
replace all occurances of OldItem with NewItem
parameters - SomeText [text]: the text containing the item(s) to change
OldItem [text]: the item to be replaced
NewItem [text]: the item to replace with
returns [text]: the text with the item(s) replaced
set SomeText to SomeText as text
if SomeText contains OldItem then
set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, OldItem}
try
set {ItemList, AppleScript's text item delimiters} to {text items of SomeText, NewItem}
set {SomeText, AppleScript's text item delimiters} to {ItemList as text, TempTID}
on error ErrorMessage number ErrorNumber -- oops
set AppleScript's text item delimiters to TempTID
error ErrorMessage number ErrorNumber
end try
end if
return SomeText
end ReplaceText
to ChangeCase of SomeText to CaseType
changes the case or capitalization of SomeText to the specified CaseType using Python
parameters - SomeText [text]: the text to change
CaseType [text]: the type of case desired:
"upper" = all uppercase text
"lower" = all lowercase text
"title" = uppercase character at start of each word, otherwise lowercase
"capitalize" = capitalize the first character of the text, otherwise lowercase
returns [text]: the changed text
set SomeText to SomeText as text
if CaseType is not in {"upper", "lower", "title", "capitalize"} then return SomeText
return (do shell script "/usr/bin/python -c \"import sys; print unicode(sys.argv[1], 'utf8')." & CaseType & "().encode('utf8')\" " & quoted form of SomeText)
end ChangeCase
</pre>
Edit: how does the choose from list dialog handle those big strings? I'm guessing not very well - is that why you avoided using them?
Message was edited by: red_menace -
Problem with multiple file download
Good day.
I have a code that downloads multiple files from the database and then saves it to a specified directory. I work fine but when I check the contents of the file, some of them are not complete. Lets, say I have downloaded 16 files and only file # 4,5,6,7 have the correct contents as compared to the original.
Why is that so?
my code snippet:
DiskFileUpload fu = new DiskFileUpload();
fu.setSizeMax(1000000000);
List fileItems = fu.parseRequest(request);
Iterator itr = fileItems.iterator();
while(itr.hasNext())
FileItem fi = (FileItem)itr.next();
if(!fi.isFormField())
String filen = fi.getName();
String fname = filen.substring(filen.lastIndexOf(java.io.File.separator)+1);
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
connection = DriverManager.getConnection(connectionURL, "", "");
statement = connection.createStatement();
String sql = "INSERT INTO tblTestFiles("
+ "strFileName,"
+ "imgFile) "
+ "VALUES(?,?)";
PreparedStatement pstmt = connection.prepareStatement(sql);
//Set the values for strFileName and imgFile
pstmt.setString(1,fname);
// Set the blob
//File file = new File(fnew);
FileInputStream is = new FileInputStream(filen);
pstmt.setBinaryStream(2, is, (int)filen.length());
// Insert the row
pstmt.executeUpdate();I am using eclipse 5.5.23, eclipse 3.2 with myeclipse SDK, MS SQL, Ant.sorry I posted the wrong code. here's the correct one:
statement = connection.createStatement();
rs = statement.executeQuery("SELECT strFileName,imgFile FROM tblTestFiles ORDER BY strFileName");
while (rs.next())
String filename = rs.getString(1);
Blob blob = rs.getBlob(2);
InputStream is = null;
is = blob.getBinaryStream();
int i;
String dir = "C:\\DownloadedFiles";
File path = new File(dir, filename);
FileOutputStream fos = null;
fos = new FileOutputStream(path, true);
PrintWriter pout = null;
pout = new PrintWriter(new FileOutputStream(path,true));
while ((i = is.read()) != -1)
pout.write(i);
fos.close();
pout.close();
}// end of if construct
}// end of try
catch (IOException e)
e.getMessage (); e.printStackTrace();
System.out.println(e);
catch (SQLException e)
e.getMessage (); e.printStackTrace();
System.out.println(e);
}Thanks. -
BPEL Process with multiple file types using one FTP adapter is not working
i created a bpel process which will fetch the files from remote location using FTP adapter.
Now the process works for only one format or file type like *.xls.
How can i use more than one file format in one FTP adapter.
OR
is there any other way to do it.
file type assignation is 5th step in FTP adapter configuration.
i have tried *.xls,*.csv and *.xls;*.csv and *.xls:*.csv by seperating with comman, colon, space... still not working.
i read the documentation *.* will not work.. for one file format it's working fine.
looking forward for reply as soon as possible.Are you positive that it is not working? I'm not sure how you can use one FTP adapter for multiple file types unless the underlying data is exactly the same format or you are processing it as opaque data. Sometimes when a FTP adapter chokes on a file with a bad structure it doesn't create a BPEL instance, it simply moves the bad file to a separate folder.
So I assume you are using opaque as the data type instead of using an XSD element?
That said, I don't think you can put two separate file types in the filter. Is it possible for you to do something like: CommonFileName*.* or do you have similar files with other extensions?
I know the above probably isn't of much help, but I had so many problems with the FTP adapter and its lack of features that I am writing my own. Unfortunately that is a large undertaking and there isn't any good documentation of JCA resource adapter / BPEL PM integration. -
Issue with multiple files merging into 1
I'm trying to write some code that will read the contents of multiple files in a directory then output it into a single file. However when I try to open the files via a for loop it does not recognise the variable I have assigned for the filename:
FileReader fr = new FileReader(fileName);
please see the full program so far, it isn't finished and this currently has me beat, any help would be greately appreciated.
Thanks
Chris
import java.io.*;
public class OutputCCFile
public static void main(String []args)
File absolutePath = new File("C:\\java\\Credit Cards");
String[] ccFiles = absolutePath.list();
try
boolean newFile = false;
CCHeaderLine cch = new CCHeaderLine();
String strDate = cch.getDate();
String headerLine = cch.getHeader();
File file = new File("TUHCC_"+strDate);
FileWriter fw = new FileWriter(file);
fw.write(headerLine);
fw.flush();
fw.close();
}catch(IOException e) {}
for (int i = 0; i<ccFiles.length;i++)
String filename = ccFiles;
filename.toUpperCase();
if (filename.startsWith("C")) //only want to open files beginning with C
FileReader fr = new FileReader(fileName);
/*Exception in thread "main" java.lang.Error: Unresolved compilation problem:
fileName cannot be resolved */
BufferedReader br = new BufferedReader(fr);
String dataLine = br.readLine();String filename = ccFiles;
filename.toUpperCase();
if (filename.startsWith("C")) //only want to open files beginning with C
FileReader fr = new FileReader(fileName);
There are several problems here.
1) Variable names (and many other things) are case sensitive in Java. filename != fileName
2) filename.toUpperCase(); will not change filename, it will just determine its upper case version and discard it -
SQL*Loader with multiple files
Gurus,
I search the documentation and this forum and haven't found a solution to my issue yet...
I am not expert of SQL*Loader. I have used SQL*Loader to copy from one file to a table many times. But I have not copied multiple files into one table especially with different names.
More specifically....
I need to load data from multiple files into a table. But the file names will be different each time. A file will be created every hour. The file name will consist of the root file name appended by a time stamp. For example, a file created on 10/07/2010 at 2:15 P.M. would be filea100720101415.txt while a file created on 10/08/2010 at 8:15 A.M. would be filea100820100815.txt. All the files will be in one directory.How can I load the data from the files using SQL*Loader?
My database: Oracle 10g Release 2
Operating System: Windows 2003 Server
Please assist.
Robertsect55 wrote:
Gurus,
I search the documentation and this forum and haven't found a solution to my issue yet...
I am not expert of SQL*Loader. I have used SQL*Loader to copy from one file to a table many times. But I have not copied multiple files into one table especially with different names.
More specifically....
I need to load data from multiple files into a table. But the file names will be different each time. A file will be created every hour. The file name will consist of the root file name appended by a time stamp. For example, a file created on 10/07/2010 at 2:15 P.M. would be filea100720101415.txt while a file created on 10/08/2010 at 8:15 A.M. would be filea100820100815.txt. All the files will be in one directory.How can I load the data from the files using SQL*Loader?
My database: Oracle 10g Release 2
Operating System: Windows 2003 Server
Please assist.
RobertToo bad this isn't in *nix, where you get a powerful shell scripting capability.
That said, here is the core of the solution .... you will also need a way to identify files that have been processed vs. new ones. Maybe rename them, maybe move them. But with this sample you can see the basics. From there it is really an issue of DOS scripting, which would better be found by googling around a bit.
cd c:\loadfiles
FOR %%datfile IN (*.txt) DO SQLLDR CONTROL=sample.ctl, LOG=sample.log, BAD=baz.bad, DATA=%%datfileTry googling "dos scripting language". You'll find lots of tutorials and ideas on "advanced" (well, as advanced as DOS gets) techniques to solve your problem.
Edited by: EdStevens on Dec 1, 2010 5:03 PM -
T-SQL Code to backup database with multiple files - Syntax error
Hello,
I'm trying to backup a database into multiple files but I'm getting a syntax error.
Here is the code:
declare @DBName varchar(100)
declare @DBFileName varchar(256)
declare @FolderName varchar(256)
declare @Path varchar(100)
set @Path = '\\Backup-Server\Test\'
set @DBName = 'DayNite'
set @DBFileName = 'DayNite-Full' + '-' + (SELECT CONVERT(char(10), GetDate(),110)) + '-' + 'P'
set @FolderName =(SELECT CONVERT(char(10), GetDate(),110))
set @Path = @Path + @FolderName + '\'
EXEC master.dbo.xp_create_subdir @Path
--Calculate broken files for BACKUP DATBASE Function
/*declare @dbsize int
set @dbsize = (SELECT ((size*8)/1024)/1000 as SizeGB FROM sys.database_files WHERE file_id = '1')
set @dbsize = @dbsize / 4
print @dbsize*/
EXEC
BACKUP DATABASE [test] TO
DISK = @Path + @DBFileName + '1.bak',
DISK = @Path + @DBFileName + '2.bak',
DISK = @Path + @DBFileName + '3.bak',
DISK = @Path + @DBFileName + '4.bak',
DISK = @Path + @DBFileName + '5.bak',
DISK = @Path + @DBFileName + '6.bak',
DISK = @Path + @DBFileName + '7.bak',
DISK = @Path + @DBFileName + '8.bak',
DISK = @Path + @DBFileName + '9.bak',
DISK = @Path + @DBFileName + '10.bak',
DISK = @Path + @DBFileName + '11.bak',
DISK = @Path + @DBFileName + '12.bak',
DISK = @Path + @DBFileName + '13.bak'
WITH INIT , NOUNLOAD , NAME = 'DayNite Full Backup', NOSKIP , NOFORMATMade some slight modifications to your script and it should work(worked when tested).. if you wnat more complete solution -- google -OLA Hallengren backups -- you should get some good scripts..
declare @DBName varchar(100)
declare @DBFileName varchar(256)
declare @FolderName varchar(256)
declare @Path varchar(100)
set @Path = '\\Backup-Server\Test\'
set @DBName = 'DayNite'
set @DBFileName = 'DayNite-Full' +''+ '-' +''+ (SELECT CONVERT(char(10), GetDate(),110)) +''+ '-' +''+ 'P'
set @FolderName =(SELECT CONVERT(char(10), GetDate(),110))
set @Path = @Path +''+ @FolderName +''+ '\'
EXEC master.dbo.xp_create_subdir @Path
--Calculate broken files for BACKUP DATBASE Function
/*declare @dbsize int
set @dbsize = (SELECT ((size*8)/1024)/1000 as SizeGB FROM sys.database_files WHERE file_id = '1')
set @dbsize = @dbsize / 4
print @dbsize*/
select @Path,@DbFileName
declare @SQL nvarchar(2000)
Set @SQL ='Backup DATABASE [DAYNITE] TO DISK = '''+@Path +''+ @DBFileName +''+ '1.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '2.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '3.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '4.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '5.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '6.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '7.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '8.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '9.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '10.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '11.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '12.bak'',
DISK = '''+@Path +''+ @DBFileName +''+ '13.bak''
WITH INIT , NOUNLOAD , NAME = ''DayNite Full Backup'', NOSKIP , NOFORMAT '
print @SQL
exec (@SQL)
Hope it Helps!!
Maybe you are looking for
-
How do you remove a pc from icloud?
Can't figure out how to remove a compter from icloud so i can free up space to add a new device. Any help would be appreciated.
-
Hi All, I need to check for certain data changes before saving a business partner using transaction BP in CRM. If there are any unwanted changes I need to throw an error and should not allow to change the business partner using transaction BP. For th
-
VNICs Templates With 2.1(1b)
After upgrading to 2.1(1b) I noticed a new entry when creating your dynamic vNIC's/templates (see attached pic). How is this different from the previous implementation of the firmware? Thanks
-
Change in desltop print quality?
When I had a system with XP,in order to make high quality prints (with photo paper) I needed to set the printer controls to HQ, paper type to "photo" and so on...... I acquired a better system running on W7 64Bit and now if I make the same print all
-
What is the best way to connect my laptop to a sound system?
Hi I use my laptop to run videos and sound tracks for our church. I am all taken care of as far as the video. My problem is with hooking up the sound from my Or any PC to the sound system. I am within 10 feet of the 32 channel sound mixer for the so