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

source file name

Hi All,

I have to move source file name into one of the fields in source structure.this is FILE-FILE scenario , where source file is coming from FTP .

How to get the source file name in one of the fields in source structure?

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 07:19 AM

    Hi,

    Were u need to get the file name at source side or target side.

    If u need to get the file name at target side write this UDF and map it to target field.

    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

    DynamicConfigurationKey key =

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

    String ourSourceFileName = conf.get(key);

    return ourSourceFileName;

    Regards,

    Phani

    Reward points if Helpful 😊

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      The explanation given by Aashish Sinha will work if in case you have the constant file name at all time.

      But there may be possibility to get the file name at runtime. (May be timestamp or counter is used)

      The sender file name will successfully get with below code.

      Use the below code in UDf to get the file name from sender,

      try {

      obj = inputModuleData.getPrincipalData();

      msg = (Message) obj;

      // Get the Supplemental data which is available as hash table

      Hashtable mp = (Hashtable)

      inputModuleData.getSupplementalData

      ("module.parameters");

      // Get the file name which is being processed

      if (mp != null) fileName = (String) mp.get("FileName");

      }

      Thanks

      Swarup.

      Edited by: Swarup Sawant on Jan 28, 2008 9:55 AM

  • Posted on Jan 28, 2008 at 08:56 AM

    Once the Message is arrived in XI, then only you can get the Source File Name, so it is not possible to embedd your Source file name in the Source Structure.

    Options :

    1) Either use the provided UDF code to get the Source file name dirctly and use in the Target strcuture(if used in target structre)

    2) Or Create a Intermediate Mapping which will be used in Intergface Mapping like below:

    MM1 : Source Sttructure -


    > Intermediate Structure (with File Name field)

    MM2: Intermediate Structure (with File Name field) -


    > Target Structure

    In Interface Mapping: Use these 2 Message Mappings.

    Hope this helps:-)

    Regards.

    Jeet.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      If ur taking the intermediate structure then the intermediate will become target for first mapping and in next mapping the intermediate will become the sender.

      source - intermediate

      intermediate - target

      Inthis case check the UDF which i have provided for you,use that UDF u will get the file name in intermediate payload and fron that i will go to target side.

      Regards,

      Phani

      Reward points if Helpful 😊

  • Posted on Jan 28, 2008 at 09:01 AM

    Hem chand,

    Please follow thebelow logic,which I've given in the other thread,

    UDF1 -http://www.flickr.com/photo_zoom.gne?id=2180181503&size=o

    UDF2- http://www.flickr.com/photo_zoom.gne?id=2180181569&size=o

    Mapping -http://www.flickr.com/photo_zoom.gne?id=2180181573&size=o

    Results -http://www.flickr.com/photo_zoom.gne?id=2180181575&size=o

    Just modify the above as per ur reqmts.

    raj.

    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.