cancel
Showing results for 
Search instead for 
Did you mean: 

File name

Former Member
0 Kudos

Hello All,

I am working on a outbound scenario. As part of the requirement I have to create a file name as below:

Out<2digit month><last 2 digit year>.txt Example: Out0607.txt, taxr0911.txt (this is for September 2011)

And there is no source field has month/year Information. I am using a receiver FTP channel to create file.

Can anyone tell me how can I achieve this

Regards,

Moorthy

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

You should include the month and year in your source message, otherwise, you can only use the date function currentDate in PI and from there substring the month and the year before passing to UDF


                   Constant:Out -> concat: --------------------------> concat: ----------> concat: ---> UDF -> TargetRootNode
currentDate ->  substring: 8,10 -> /  currentDate -> substring: 2,4 -> / constant: .txt -> /

Use this code for Simple UDF: argument is input


DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); 

DynamicConfigurationKey key =DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","FileName"); 
conf.put(key,input); 

return ""; 

Afterwards, in your File Receiver CC, make sure that the adapter specific message identifiers are checked and you select FileName.

Hope this helps

Mark

Edited by: Mark Dihiansan on Nov 1, 2011 3:06 AM

Answers (1)

Answers (1)

monicabhosale
Active Participant
0 Kudos

Hello,

You can create two more temporary variables at target side to store your month and year variable.then using your current date variable and substring store this value into temporary created variable and at the end use this variable in your communication channel file name.

i hope this will work for you.

Thanks

Monica