cancel
Showing results for 
Search instead for 
Did you mean: 

File recr Adapter : How to set target directory based on sender interface ?

Former Member
0 Kudos

Hi All,

We have a requirement wherein the target directory in a file receiver adapter has be to determined based on the Sender Interface

Say for example,

1) If sender Interface is SI_PLANT_MASTER

Then target directory should be : <file_system_path_prefix>/temp/PLANT_DATA

2) But if the sender Interface is SI_MATERIAL_MASTER

Then target directory should be : <file_system_path_prefix>/temp/MATERIAL_DATA

I tried using variable substitution, but that does not give me a solution as the target directory path is not available in the payload.

I need a way to determine the target directory dynamically, other than from the payload.

Any help will be appreciated.

Regards,

Sandeep

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Sandeep,

Could you please detail me one point ?

For your interface "SI_PLANT_MASTER", where do you have to create the file ?

- in a static folder like : xxx/temp/PLANT_DATA always in a directory called "PLANT_DATA"

or (what I think)

- in a dynamic folder name which changes with the Plant Nbr (e.g P001, P002, P003, etc...), and so have folders like :

xxx/temp/P001

xxx/temp/P002

xxx/temp/P003

etc...

If it's 1st solution (static), then you have to create different CC.

Else if it's the 2nd solution (Dynamic), you have to use Adapter-Specific Messages Attributes with a UdF, as detailed above by Francis, but by using Technical parameter "Directory", instead of "FileName"... if you want to manage dynamically the directory name:

See SAP help: http://help.sap.com/saphelp_nw70/helpdata/EN/bc/bb79d6061007419a081e58cbeaaf28/content.htm

I hope this you.

reagards

Mickael

Edited by: Mickael Huchet on Oct 7, 2010 2:03 PM

Edited by: Mickael Huchet on Oct 7, 2010 2:13 PM

Former Member
0 Kudos

Hi Sandeep,

You may create the same number of Sender and Receiver agreements as the number of Sender interfaces. And for each receiver agreement, you can specify the name of the channel (with pre-configured file parameter settings like file name/target directory etc.) that will process the message if a message comes from a particular sender interface.

In this way, you don't need any dynamic configuration or any variable substitution.

Regards, Gaurav.

Shabarish_Nair
Active Contributor
0 Kudos

why use dynamic configuration or variable substitution here?

when you have different sender interfaces, you configuration will be different and hence you can use seperate adapters for the different directories

Former Member
0 Kudos

Hi,

can you try with dynamic configuration using adapter specific message attributes?

you have to write a small UDF like this

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create(

u201Chttp://sap.com/xi/XI/System/Fileu201D,

u201CFileNameu201D);

String valueOld = conf.get(key);

if (valueOld != null) {

String valueNew = valueOld.replaceAll(u201Cinputu201D,u201Doutputu201D);

conf.put(key, valueNew);

}

check this blog

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

regards,

francis

Former Member
0 Kudos

Hi,

Sender interface name is available at design time.

So no need to set the target directory name dynamically, you can configure it directly in ID.

-Supriya.