on 11-12-2007 6:52 PM
I have a requiurement where i have to poll a certain directory and based on the file type move it to a different location.....i was planning on using 2 comm channels and using exclude file a in cc1 and file 2 in cc2...
Is there any other way..?
Venkat
>>file type move it to a different location
you will need only 1 communication channel on sender side,on the receiver side you would need 2 communication channel and route the files based upon the file type using conditional receiver determination.
you would need to get the filename in message mapping so that you can route it to correct receiver in conditional receiver determination,use ASMA for that
Thanx
Aamir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>>as i am not doing any mapping
see to send the file to two separate systems u would need conditional receiver determination,which is done based upon field(s) in payload,now if you are already getting the filename in the payload,then you can simply use that but in case you are not getting the filename in payload then you would need a UDF to get the filename and map it to a field on receiver side and then use this field in conditional receiver determination
Thanx
Aamir
ohh,i meant a UDF just to get the filename,not to route the file,definitely you can use If-Else condition in UDF ,then map the directory name to the node field(or any other field on receiver side) and use this while creating the receiver communication channel(ASMA),in that case he needs only 1 sender and 1 receiver CC.
these are just two different ways to achieve the same thing:)
by two different locations i thought two different machines,and in that case two separate receiver CC's are required.
Thanx
Aamir
Message was edited by:
Aamir Suhail
now u have given the complete requirement.
earlier you said different locations which can mean different folder or different physical system.
anyways for your requirement,you need to write a UDF wherein you would get the filename type,once u get the filetype you need to have If-else condition wherein you would assign different folder based upon the filetype,now you need to map this to a field on receiver side(map it to node if u dont want to show this field on the receiver side XML).
then dynamically assign the directory name on the receiver communication channel using this field.
Thanx
Aamir
see the thing is you can't branch off your file without knowing the filetype,right?
now to know the filetype you need to implement a UDF so that you can map it to the some tag on the receiver side and then send it to its correct destination.
if you dont have mapping,then u need to create a simple 1-1 mapping and also have this UDF in it
Thanx
Aamir
>>You got it toyota....
lolz,i don't need Toyota,i need a Ferrari;)
anyways,so in your scenario you will configure one sender file adapter and give the name of that one directory you want to pick files from,then give file name as ..
this will pick up all the files(irrespective of their extension).also check the Adapter specific message atributes checkbox on the sender side,now in message mapping write a UDF where in you would get the filename(along with its type),store this filename in some variable,then you need to assign the directory path based upon the filetype and then map this to the root node on the receiver side,
have a look at the below code to see how the directory can be assigned dynamically.
your code won't exactly be the same but will use the same concept
Thanx
Aamir
Use the DynamicConfigurationBean or write a Adapter Module to set the filename if you do not want to use any mapping.
Or, write a Java Mapping. All this Java Mapping will do is read the source filename and set the target filename. The inputstream ( input to the Java Mapping) be pushed out as the output Stream ( Output of Java Mapping).
Regards
Bhavesh
Bhavesh,
Thank you..Can you elaborate, on the dynamic configuration bean...?
I found this in the help.sap.com
Advanced Selection for Source File
If you want to set an exclusion mask for the File Name specified above, or if you want to specify multiple directories using a file name mask and exclusion mask, set the Advanced Selection for Source File indicator.
○ Specify an Exclusion Mask for the file name specified above.
Example
You want to process all files that have the extension '.txt', but want to exclude all files that begin with the letter 'a'. To do this, enter .txt for File Name, and a for Exclusion Mask.
○ You can enter additional specifications for source directories, file names, and exclusion masks in the table. This data is processed in addition to the details specified above.
I tried polling the location....specified .xml so as to process all xml files and then for the exclusion specified abc....in the same folder i also have def.xml..that should have been processed....that wasnt....nothing was processed...........what is not right...
Venkat
This blog describes what DynamicConfiguration Bean can do..
/people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean
What does File Exclusion Mask have to do with your Dynamic File Directory? I am confused and as I can see , all the posters to this thread are also confused on what you are trying to achieve. Address one problem at a time
Regards
Bhavesh
Bhavesh,
It does...Since i need to move ONLY fileA to locationA and ONLY fileB to locationB and ONLY fileC to location C.
I have to exclude the files that dont need to be moved...that was an attempt...
also the DynamicConfigurationBean doesent let us specifiy specific filenames and based on the fileName`s make a if then decision as to the location of the reciever....
What are my options now..?
Venkat
Venkat,
Can u explain your scenario from end to end perspective, it's little bit confusing.
raj.
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.