Skip to Content

Receiver File adapter: dynamic folder name based on file name

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 21, 2011 at 04:28 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 21, 2011 at 08:28 PM

    Hi Igor Kozak,

    It is possible. Please check my reponse here [Link1|read-image-file-from-jms]

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

    Regards,

    Raghu_Vamsee

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 21, 2011 at 11:44 PM

    >> 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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Igor Kozak

      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.