Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2010 at 11:00 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2010 at 11:09 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 07, 2010 at 12:00 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2010 at 01:39 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2010 at 02:03 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.