cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic File name in Receiver File adapter

Former Member
0 Kudos

Hi,

My Scenario is Proxy to File.

I must create filename dynamically in the receiver file adapter by taking the sales order number and divison from the source.

How can i create a dynamic filename? i searched the forum, but i could not get the correct answer,

Please help me out.

Regards

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

former_member182004
Contributor
0 Kudos

Hi Srinivas,

Refer to this blog,

/people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean

Regards,

Juan

Former Member
0 Kudos

Hi,

Thanks for all the answers

For the target filename i need to concatenate the SO Number_Divison.xml

I had an issue here

SO Number exists in the target

so in the variable substution i had written as

var1 -


payload:Transaction,1,Receipts,1,Receipt,1,OrderID,1 -


and it is working

but the division does not exists in the target,

then my question is how can i get the division in the filename.

Thanks for your help

Srinivas

Former Member
0 Kudos

Hi Srinivas,

If you want SO Number and Divison in the file name create two variables var1 and var2. Let var1 be for SO Number and you create one more for Division as var2 and in filename give %var1%_%var2%

Here if division is not there then it will fail. So you should always have a division in your target payload. If you dont have division how does the filename to be. Do you want only SOnumber as filename. If yes then in mapping you can put a space for division using an if else. So if division exists it will send else a space will send. I think it will fail now also, but give a try.

So when using variable substituion, the variables should always present is a highly recommended approach.

Regards,

---Satish

Former Member
0 Kudos

Hi Satish,

Thanks for your reply,

The division field is not in the target payload,how can i get it from the source and make it as part of filename.

I must write any UDF to achieve this?

Thanks

Srinivas

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi,

If division value coming from Source message then its very easy buddy,pass division as argument,and append it.

public String targetFileName(String Sono, String Div, 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 MyFileName = sono + div + "<filename>"+".xml";

conf.put(key, MyFileName);

return MyFileName;

}

above code should work.

Regards,

Raj

Answers (4)

Answers (4)

Former Member
0 Kudos

Thnaks for your answers

Former Member
0 Kudos

Hi Srinivas,

I have the same requirement as Proxy to File scenario, can you provide a detailed step on how you have overcome this? Have you used Dynamic configuration and create a UDF?

Thanks

Former Member
0 Kudos

Hi Srinivas,

> My Scenario is Proxy to File.

> I must create filename dynamically in the receiver file adapter by taking the sales order number and divison from the source.

public String targetFileName(String Sono, String Div, 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 MyFileName = sono + div + "<filename>"+".xml";

conf.put(key, MyFileName);

return MyFileName;

}

File name you can format according to your requirement.

And one more thing for this you have to specify the ASMA properties. For this check the below link step-1 and step-2.

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

Regards

Ramesh

Former Member
0 Kudos

Hi Srinivas,

How can i create a dynamic filename?

Use Dynamic Configuration in the mapping and ASMA settings in the CC. Refer to the blog provided by Juan.

i searched the forum, but i could not get the correct answer,

There are tons of blogs / forum postings on this topic

regards,

Neetesh

Edited by: Neetesh Raj on Sep 17, 2009 9:25 AM

Former Member
0 Kudos

Hi Srinivas,

You can use the concept of variable substitution. Please check the blogs mentioned in this thread:

If you can give your target xml payload after message mapping then somebody can suggest what to put for filename in your file receiver communication channel.

Regards,

---Satish