cancel
Showing results for 
Search instead for 
Did you mean: 

Receiver File adapter: dynamic folder name based on file name

ik69
Participant
0 Kudos

Hi there,

is it possible to set up one communication channel that will use different target folders based on file name?

E.g.

File abcdef will be saved to /root/abcdef/abcdef or /root/abcdef/abcdef.txt

File xyz will go to /root/xyz/xyz or /root/xyz/xyz.txt

I know I could use Sender/Receiver Service, Interface/namespace or data from message for variable substitution but could not find an easier solution for this scenario than to create multiple communication channels.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can determine your target directory in your message mapping, using a java udf, inf function of your filename.

...

String Name2 = var2;

DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");

conf.put(key2, Name2);

return "";

Regards,

Carme

Answers (2)

Answers (2)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>> is it possible to set up one communication channel that will use different target folders based on file name?

Yes. Use dynamic configuration logic in udf or java mapping. This is pretty standard.

ik69
Participant
0 Kudos

Thank you all guys for your answers,

I knew I could do it in the mapping, sorry I was not clear about the requirements.

The scenario does not use any mapping nor other repository object at all as of yet.

The file is taken from one FTP directory and placed on different FTP directory, no mapping involved.

So it seems that this will not work and I have to create at least a dummy mapping, right?

Former Member
0 Kudos

Hi,

Yes, you need to create a dummy mapping and use the field values to do varable substitution or Dynamic configuration.

Thanks

Edited by: Hareenkumar on Jan 24, 2011 8:57 AM

Former Member
0 Kudos

If you haven't a message mapping, then you can create only an interface mapping with an abap mapping.

In your abap mapping:

DATA l_record type mpp_dynamic.

l_record-namespace = 'http://sap.com/xi/XI/System/File'.

l_record-name = 'FileName'.

l_record-value = "your filename"

dynamic_configuration->add_record( l_record ).

l_record-namespace = 'http://sap.com/xi/XI/System/File'.

l_record-name = 'Directory'.

l_record-value = "your directory ".

dynamic_configuration->add_record( l_record ).

Afther that, you must activate Adapter Specific Message Attributes (directory and/or filename) in your target communication channel .

Regards,

Carme.

RaghuVamseedhar
Active Contributor
0 Kudos

Hi Igor Kozak,

It is possible. Please check my reponse here [Link1|]

You might need to change the code according to your business logic.

Regards,

Raghu_Vamsee