Skip to Content
avatar image
Former Member

file to idoc how to get file name at runtime

Hi Experts,

In my file to idoc scenario,

the requiremnt is like in mapping i have to give condition like if file name is name1 then one target filed is 40 and if file name is name2 then that target field is 60.

how can we achieve this ?

Regards,

rohit

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    May 21, 2008 at 10:17 AM

    Hi,

    Follow this links

    /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i

    /people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12

    /people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii

    or

    In the receiver determination we mention the condition according to our requirement.

    Follow this link

    http://www.saptechnical.com/Tutorials/XI/FileToIDoc/FiletoIDocScenario.htm

    Edited by: Venkataramesh Boppana on May 21, 2008 3:52 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 21, 2008 at 10:23 AM

    Hi rohit,

    Chk dis link...

    http://www.saptechnical.com/Tutorials/XI/Variable/substitution.htm

    reward points if helpful....

    PrashaNt

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Rohit,

      R u talking about massage mapping?

      Then u can try usingstandard FixValues function from Conversions category

      Provided u knw source & target values at the time of development & it will not change afterward.

      Thanks,

      mahi

  • avatar image
    Former Member
    May 21, 2008 at 10:52 AM

    Follow this blog to get filename in mapping

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

    you can write UDF as

    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);

    //here check if ourSourceFileName = name1 then return 40 else return 60

    map it to corresponding target field

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      can we check output here in message mapping test ? because when i am testing i am getting runtime exception ?

      -


      >

      you can test it runtime only as it is a dynamic configuration. Test the scenario end to end

      Also you have to select adapter specific message attributes in sender file adapter as mentioned in the blog.

  • avatar image
    Former Member
    May 21, 2008 at 11:08 AM

    Hi Rohit

    mughdha is right but you can do it through graphical mapping easily

    give condition in fix value under category conversion like this

    1) source-> FIX VALUE ->if value is true then map FIX value

    else nothing

    double click on first FIX VALUE function and assign your input values for file (for ex 40 or 60,......) in the key field and in the value field assign TRUE

    if this condition will be true the it willl map second FIX VALUE

    else assign a constant with empty value

    in second fix value assign values (for ex 40 or 60,......) which you have checked in first FIX VALUE function in key field and assign corresponding name which you required in the value field

    hope this will solve your problem

    Thanks

    sandeep

    if helpful reward points

    Add comment
    10|10000 characters needed characters exceeded