on 01-28-2008 7:15 AM
Hi All,
I have to move source file name into one of the fields in source structure.this is FILE-FILE scenario , where source file is coming from FTP .
How to get the source file name in one of the fields in source structure?
Thanks.
Hem chand,
Please follow thebelow logic,which I've given in the other thread,
UDF1 -http://www.flickr.com/photo_zoom.gne?id=2180181503&size=o
UDF2- http://www.flickr.com/photo_zoom.gne?id=2180181569&size=o
Mapping -http://www.flickr.com/photo_zoom.gne?id=2180181573&size=o
Results -http://www.flickr.com/photo_zoom.gne?id=2180181575&size=o
Just modify the above as per ur reqmts.
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Once the Message is arrived in XI, then only you can get the Source File Name, so it is not possible to embedd your Source file name in the Source Structure.
Options :
1) Either use the provided UDF code to get the Source file name dirctly and use in the Target strcuture(if used in target structre)
2) Or Create a Intermediate Mapping which will be used in Intergface Mapping like below:
MM1 : Source Sttructure -
> Intermediate Structure (with File Name field)
MM2: Intermediate Structure (with File Name field) -
> Target Structure
In Interface Mapping: Use these 2 Message Mappings.
Hope this helps:-)
Regards.
Jeet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If ur taking the intermediate structure then the intermediate will become target for first mapping and in next mapping the intermediate will become the sender.
source - intermediate
intermediate - target
Inthis case check the UDF which i have provided for you,use that UDF u will get the file name in intermediate payload and fron that i will go to target side.
Regards,
Phani
Reward points if Helpful
Hi,
Were u need to get the file name at source side or target side.
If u need to get the file name at target side write this UDF and map it to target field.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key =
DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
Regards,
Phani
Reward points if Helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think, you want to provide a name for you Source File/FTP adapter file name. you can give anything and at the FTP side your file name shud match the name provided by you at the time of file/ftp sender CC configuration.
Hope this wil;l clarify you. Above code was dynamic file name generation (Target side).
Regards
Aashish Sinha
PS : reward points if helpful
Hi,
The explanation given by Aashish Sinha will work if in case you have the constant file name at all time.
But there may be possibility to get the file name at runtime. (May be timestamp or counter is used)
The sender file name will successfully get with below code.
Use the below code in UDf to get the file name from sender,
try {
obj = inputModuleData.getPrincipalData();
msg = (Message) obj;
// Get the Supplemental data which is available as hash table
Hashtable mp = (Hashtable)
inputModuleData.getSupplementalData
("module.parameters");
// Get the file name which is being processed
if (mp != null) fileName = (String) mp.get("FileName");
}
Thanks
Swarup.
Edited by: Swarup Sawant on Jan 28, 2008 9:55 AM
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.