on 12-18-2012 11:00 AM
Hi,
We have a requirement to implement a logic in message mapping using java functions to pick file from one directory in application server and place it in another directory.
I have seen blog http://scn.sap.com/thread/255042 that deals with Access file in file directory during mapping.
Is it possible using java functions to place file from one directory to another of sap pi application server?
If yes Can you please tell me how we can acheive that using java functions?
Best Regards,
Shilpi Agarwal
Hi,
Why do you want to move the file to another folder using mapping only..?
what is your exact requirement... if you can provide more details some one here can guide you...
Cheers
Rajesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
>>Is it possible using java functions to place file from one directory to another of sap pi application server?
Yes it is possible.
Chk this link (you have to alter the code given in the link):
http://scn.sap.com/thread/1569382
Ur code will be something like this:
String a ="";
File file1 = new File ("/usr/sap/PI/SYS/src/File1");
FileReader fr = new FileReader (file1);
BufferedReader br = new BufferedReader(fr);
File file2 = new File ("/usr/sap/PI/SYS/src/File2");
Writer output = new BufferedWriter(new FileWriter(file2));
boolean resp = file1.delete();
while((a=br.readLine())!=null)
{
output1.write(a);
}
output1.close();
Note: i havent tested this code so please chk for syntax errors and do remember to implement proper error handling.
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shilpi,
Please use the below code:
http://www.mkyong.com/java/how-to-move-file-to-another-directory-in-java/
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.