cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Target File name

Former Member
0 Kudos

Hi Everyone,

I want the Target File name to be as Update_Order_%y%y%y%y%M%M%d%d%H%H%m%m%s%s.A04.

How do i proceed to create such files.

Any help would be appreciated.

Thanks & Regards,

Varun

Accepted Solutions (1)

Accepted Solutions (1)

varun_k
Contributor
0 Kudos

HI Everyone,

Thanks for your replies. Though I define a UDF, to which field do I need to Map. I dont have such field to map to get the filename.

Thanks & Regards,

Varun

former_member200962
Active Contributor
0 Kudos

map it to any field...it does not make any difference as you have no return statement in the UDF :)....also i dont think that you need any Parameter/ Argument for your UDF so no need of any input...

Edited by: abhishek salvi on Jun 3, 2009 3:45 PM

Shabarish_Nair
Active Contributor
0 Kudos

in your case you dont have to use any input so it will be a generating UDF without input argument and regarding to which field you want to map it, ideally you can map it to the highest node of the target XML

varun_k
Contributor
0 Kudos

HI Shabarish,

Thanks for your reply.

Actually I need to generate the target file as

Update_Order_%y%y%y%y%M%M%d%d%H%H%m%m%s%s.A04 (For Update Files)

Delete_Order_%y%y%y%y%M%M%d%d%H%H%m%m%s%s.A05

based on the Message Category. So as you said i can map the UDF to the highest node of the target XML.

Thanks & Regards,

Varun

Shabarish_Nair
Active Contributor
0 Kudos

yeah. regarding mapping it to the target you can always use the highest level node of the target for that.

As mentioned in my blog also include a try catch block.

Answers (3)

Answers (3)

Shabarish_Nair
Active Contributor
0 Kudos

the best would be to use the dynamic configuration - /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

sunilchandra007
Active Contributor
0 Kudos

>

> Hi Everyone,

>

> I want the Target File name to be as Update_Order_%y%y%y%y%M%M%d%d%H%H%m%m%s%s.A04.

> How do i proceed to create such files.

> Any help would be appreciated.

>

> Thanks & Regards,

> Varun

Hi,

1. In the Sender File Communication Channel, check the option Set Adapter-Specific Message Attribute and Filename.

2. Assuming Update_Order is a constant string, Use this UDF. If Update_Order is a element at your source structure, pass it as a parameter to the UDF.

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" );
dateformat.format( new java.util.Date() );

String tagetfilename="Update_Order_" + dateformat;
conf.put(key, newfilename);

Regards,

Chandra

Former Member
0 Kudos

Hey

You can make use of "adapter specific message attributes" property of file adapter to give name to file.

in your message mapping,write a UDF to store the name in FILENAME parameter of ASMA and then refer to that in your receiver file adapter.

UDF code is given here

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

Thanks

Aamir

Edited by: Aamir Suhail on Jun 2, 2009 9:05 AM