on 2011 Jul 12 6:35 AM
Hi Team,
We have a requierment for File receiver to create a file with the name SA2345_date_time.txt.
Could anyone please help me how to define it in receiver file adapter.
Appreciate your quick response.
thanks & regards,
Ranganath.
thanks for the answer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ranganath,
If you need the file name with Fix prefix and date and time stamp, you can use the add time stamp option in receiver comm. channel.
Regards,
Harish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
You can do dynamic configuration to achive this. Or you can select Add timestamp in receiver file adapter.
Please see this.
Define Processing Parameters
7. Select the Processing tab page.
8. Select the File Construction Mode.
u25CB Create
The file is created. The document received last is saved in each case.
If you want the created file to be overwritten, set the Overwrite Existing File indicator. If you do not set the indicator, processing is stopped until the created file is processed.
u25CB Append
The file is written when the inbound documents are appended.
u25CB Add Time Stamp
A new file is created for each document. A time stamp with the format yyyyMMdd-HHmmss-SSS is added to the file name. The time stamp is added as the last part of the name before the extension.
This mode guarantees that no file is overwritten. In this way, files that originate from the same adapter configuration can be sorted.
In Mapping also you can do dynamic configuration.
UDF
public String setFileName(Container container) throws StreamTransformationException{
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String FileName=SA2345+"_"+getDate()+"_"+getTime();
conf.put(key,FileName);
return FileName;
You need to use this UDF in root node mapping.
Dont forget to check Use Adapter specific message attribute in receiver file adapter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ranga,
Creting UDF is Very easy thing.
You can use the same code as i have posted.
If you use addtime stamp then timestamp will be added as prefix of the file name.
Your FileName: SA764_.txt
After ADD time stamp: 20110210-023047-618SA764_.txt
So For your particular filename pattern you need to use UDF.
give it a try .........its damm easy.
Hi Debashish,
the root node for my mapping is pgispr_umc.
so i'll do the mapping as per u r suggestion.
Nextly can you please check the below udf which am going to use in my mapping. let me know if i need to modify anything else.
public String setFileName(String ,Container container){
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://amat.com/ASNOutBound/SAPECC_to_VendorFTP","FileName");
String FileName=SA84149126"_"getDate()"_"getTime();
conf.put(key,FileName);
return FileName;
Thanks a lot for your prompt reply.
thanks & regards,
Ranganath.
Hi Debasish,
I was getting the blow error while using the above udf.
Could you please let me know where did i go wrong.
Source code has syntax error: /usr/sap/D03/DVEBMGS03/j2ee/cluster/server0/./temp/classpath_resolver/Mapdab9a164ac5711e0ab6d00000202eeda/source/com/sap/xi/tf/_MM_SAPECC_DELVRY03_To_AMTPostGoodsSPR_UMC_FILE_.java:332: <identifier> expected public String setFileName$(String ,Container container){ ^ /usr/sap/D03/DVEBMGS03/j2ee/cluster/server0/./temp/classpath_resolver/Mapdab9a164ac5711e0ab6d00000202eeda/source/com/sap/xi/tf/_MM_SAPECC_DELVRY03_To_AMTPostGoodsSPR_UMC_FILE_.java:414: ')' expected } ^ 2 errors
thanks and regards,
Ranganath.
And also
Also in below line you need to use the namespace http://sap.com/xi/XI/System/File instead of your own namespace.
Its a standard namespace which related to the File adapter.
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
HI Debashish,
sorry, below is the issue.
RuntimeException in Message-Mapping transformation: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_SAPECC_DELVRY03_To_AMTPostGoodsSPR_UMC_FILE_ method setFileName$[, com.sap.aii.mappingtool.tf3.rt.Context@3568552d]
while checking the queue on the udf and
RuntimeException in Message-Mapping transformation: Cannot cast 428-L273 to boolean
got the above issue while testing it with test data.
thanks
ranganath.
Hi Ranga,
RuntimeException in Message-Mapping transformation: Exception:http://java.lang.NullPointerException in class com.sap.xi.tf._MM_SAPECC_DELVRY03_To_AMTPostGoodsSPR_UMC_FILE_ method setFileName$, com.sap.aii.mappingtool.tf3.rt.Context@3568552d
You cant test dynamic configuration using Message mapping Queue.
You need to run the scenario end to end
RuntimeException in Message-Mapping transformation: Cannot cast 428-L273 to boolean
It is some mapping error not related to Dynamic configuration.
please check al;l the boolean function(IF-ELSE) used in mapping.
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.