on 04-16-2007 5:18 AM
HI,
I have a source file in which the data consists of some file names and their path. Now in file to file scenario, i have to read the source file and pick the file names and their path, and send the data in those files to receiver side.
Please guide me how to proceed for this?
Thanks,
Anil.
Hi,
Pick up data from source file row by row..so you can pick up your file names and their path.
See the blog <u>/people/sravya.talanki2/blog/2005/08/16/configuring-generic-sender-file-cc-adapter
Cheers!
Samarjit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not convinced ,
If I got the requirement correct, the file content do not contain the file name and path, but , the requirement is that the target data needs the file name and path.
This can be handled quite easliy using my technique.
Reading Line by Line-- How is it going to help read the filename and path?
Regards
Bhavesh
HI Bhavesh, Samarjit
Thank you for giving replies.
Let me elaborate on the requirement:
A source file say source.txt is having data like c:\filename1.txt, c:\filename2.txt. Now read the source.txt and validate whether the two files that are mentioned are exisiting in the specified directory, if so, transfer the files to receiver side.
If the files are not existing then raise an exception.
This is the requirement.
Thanks,
anil.
Henrique,
Right on.I failed to read the question perfectly,
<i>A source file say source.txt is having data like c:\filename1.txt, c:\filename2.txt. Now read the source.txt and validate whether the two files that are mentioned are exisiting in the specified directory, if so, transfer the files to receiver side.</i>
I failed to read that the source file will inturn contain the other filenames to be picked up.I hhad thought that the set of filenames were available previously. This would not be possible using a BPM .
Kindly ignore my previous reply. Like pointed by you guess java proxies are the way to go.
Regards
Bhavesh
Hi,
We can do it in two ways ,
one is asexplained by above , we can use BPM.
in BPM
first receive step -- here you will receive the file with file names , the verify the file name is existed or not ,( wehave one bapi to check it also),
next based on the response from bapi , yu can raise the exception ?
by sending this to control step , and raising the alert or cancel the process.
if file is existed then you can continue..
The second method is ,
do it by a ABAP program to check the file is existed ot not and trigger the proxy to do the rest of scenario..
The another approach is maitain a UDF in maping first receive the message in that message you can have the file names , by java code you can test the file is existed or not , Jco, and if existed the continue else , throw the runtime exception
see the below link for another approach
Regards
Chilla
With simple mapping you could even check if files are there, but from requirement, he needs to read the files if they are there and pass them. Message mapping/UDF wouldn't satisfy that.
It'd be possible with java mapping returning a message type with 0...unbounded occurrence (you'll need to use <xi:Messages><xi:Message1>... tags for that). The mapping would parse the source message for filenames and paths, then read the files. If they're not there, raise exception. If they are there, create a DOM document with the <xi:Messages><xi:Message1> tags and add the files (after parsing) to these tags (assuming both files have same message type). No need for BPM.
But as Bhavesh pointed, it is not recommended to have full IO (and not simple lookup) at mapping runtime. Thus, just get the same idea and implement insidade java proxy instead of java mapping.
Regards,
Henrique.
You can, but will you be able to restart from the point where the error occured? No.
What if you have moduifed some data in the file in the mapping using the Java IO and some error occcurs and when you restart the message the mapping gets executed again and the same the data will be updated again which you might not need actually etc.
regards
Bhavesh
You could even restart it, but then you'd have to run the entire scenario until mapping. If you had any prior steps, they'd be redone (maybe generating some error).
As a proxy, if any error occurs, then sender side would guarantee delivery (since the sending process was not completed). Also, you'd restart from the point in the scenario where the error occurred.
Regards,
Henrique.
Hi,
This is a standard requirement.
1. In the sender file adapter , select Adapter Specific Attributs --> FileName and Directory.
2. In the message mapping use this code inside a UDF to read the filename and directory,
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
FileName);
DynamicConfigurationKey key2 = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
"Directory);
String FileName = conf.get(key1);
String Directory = conf.get(key2);
Regards
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.