on 02-01-2011 7:57 PM
Hi,
We have a requirement where we yet dont know the part of directory and remanining part is date stamp.
e.g., /Folder1/Folder2/yyyymmdd, We dont know /Folder1/Folder2 yet, we will know during cut-over or before mocing to Prod.
I want to keep that part as changeble as part of manual configuration before activating adapters in Prod, and fill the date stamp as dynamic.
Does anyone have any idea how to send part of directory as dynamic? I thought of using ASMA, its working fine for full directory path only. I mean if I keep Target Directory as "/Folder1/Folder2/*" and trying to ger date from ASMA. It didn't work.
Thought of Variable Substitution, keep Target Directory as "/Folder1/Folder2/%date%" and get the date from variable substitution. Can we do this? We are in PI 7.11. I mean how to get system date to variable reference table of Variable Substitution.
Regards,
N@v!n
Hi N@v!n Kumar,
This is my opinion.
a. I am not in favour of varable substitution.
_1. You have to change the data structure (inbound and/or outboud), you have to convince sender system and/or target system.
_2. Let's say you are able to add extra field in structure. Then, when you transport channel from Quality to Production, you have to any way edit the channel in prodcution, as all parameter in channels will not be transported.
b. I recommend dynamic configuration.
_1. No need to change any structure (no need to convince any one).
_2. But along editing the channel in production, you have to edit the Message Mapping.
Regards,
Raghu_Vamsee
Edited by: Raghu Vamsee on Feb 4, 2011 10:48 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi N@v!n Kumar,
I understand you want Target folder to be dynamic.
As Target folder is not dependent on any element in payload, we can not use "varaible substition".
We have to use Dynamic configuration [Link1|http://help.sap.com/saphelp_nw04/helpdata/EN/43/03612cdecc6e76e10000000a422035/frameset.htm]
Step 1:- In both sender and receiver channel enable "Adapter-Specific Message Attributes".
Step 2:- In graphical mapping, create a UDF (below code) with no inputs and map it to Target Root element (some thing like this MT_Output). By doing so, this UDF will be executed when ever the graphical mapping is executed.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(u201Chttp://sap.com/xi/XI/System/Fileu201D,u201CFolderu201D);
java.text.SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat("yyyy/MM/DD");
String TargetFolderName = "/Folder1/Folder2/" + simpleDateFormat.format(new java.util.Date());
conf.put(key, TargetFolderName);
Regards,
Raghu_Vamsee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Raghu_Vamsee:
Sometimes dynamic configuration can not be used, let use see:
there are a group of files generated in the target (it is my case), each file need to have its own specific name or directory, how can you use dynamic configuration for all group of files ?
Your concern for the transport can also be easily can handle by using value mapping, you can check your sender system at run time, then you will know which landscape at run time and generate corresponding variable value, no need to modify channel.
Yes, in most cases, dynamic configuration is recommended.
Regards
Liang
Hi Liang Li,
Yes, I agree with you, Dynamic mapping is will not fit for all cases. that is why we have variable substitution.
I am interested to know, how you have achived this scenario?
>
> there are a group of files generated in the target (it is my case), each file need to have its own specific name or directory, how can you use dynamic configuration for all group of files ?
Regards,
Raghu_Vamsee
Hi N@v!n,
>Can we do this?
Yes
>We are in PI 7.11.
perfect
> I mean how to get system date to variable reference table of Variable Substitution.
Map the date into (any) field (function currentDate) and address in the channel. You have to define a variable in the channel (advanced tab) where you can put a kind of X-Path expression to get a payload value into. You refer the variable with %variable%. Just read: [Configuring the Receiver File/FTP Adapter|http://help.sap.com/saphelp_nw2004s/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm]
Regards,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi N@v!n,
>there is no extra field in target structure that we could assign date. Now how do we get the date into variable?
If you want to use variable substituation you need a field. Either you extend the data type with an optional field or you add an XSL mapping to the operation mapping. This can copy all subelements of the root element, create a new date field and store it in a new root tag. Just 10 lines.
As well the alternative given by Raghu_Vamsee is easy and good.
Regards,
Udo
Hi N@v!n Kumar,
->This looks like a simple solution by adding extra field in data structure. How do we ignore the additional field during receiver FCC?
You can simply add an extra segment say FILE in the target data type with a field named say DIRECTORY, map the current date function to this field. In receiver file adapter enable variable substitution and set a variable say varDir and specify the path of the DIRECTORY field. Just give 'Folder1/Folder2/%varDir% in the Directory path. While creating the segments in FCC, recordset structure mention your actual sgements,FILE
then in parameters add the below details.
FILE.fieldFixedLengths ->0
FILE.fixedLengthTooShortHandling ->cut
FILE.endSeparator ->'0'
This will remove the FILE segment in the output XML.
Thanks,
Zameer
Thanks Zameer, Liang and Raghu.
Now we have one solution of adding extra segment-field and trimming it at FCC. I was wondering if we could use approach given in below wiki with setting the directory name to root node (this way dont need to add extra fiels also).
http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot
This works if we set the directory name or file name is set in the payload, I need to check if it works for setting directory value to payload. Will let you if it works.....
Regards,
N@v!n
What about providing the data in value mapping table?
You could read this in mapping and concatenate the folder name. So you can change it anytime.
You could use parametrized mapping also, but then you have to change every mapping related to the variable folders.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.