Variable substitution or dynamic configuration

Hi,
   I am doing Proxy sender to File receiver scenario. I have message payload like,
MTtest1..... 0..1
date.... 0..1
item....0...unbound
I want to create a text file  with the name SAP<date>.
I am using a variable substitution method, date: payload: MTtest1, 1, date, 1
Target directory: SAP%date%
I am getting the filename correctly, But this creates a blank line in the top of the file. Please suggest me how to overcome this issue.
If a send the date at the end, how the it must be written in variable substitution method.
If I need to use dynamic configuration, please tell me how to do that, i saw few blogs, but i am not able to get it.
Thanks and Regards,
Sri

Dear Arunsri,
Better to use Dynamic Confi method becs its recommended by SAP also.
Please Follow the below steps.
(1)Create the UDF and pass Filename as an Input parameter as shown here.
public String Set_Output_File_Name(String var_Filename, String var_Directory, Container container) throws StreamTransformationException{
DynamicConfiguration conf = (DynamicConfiguration) container
    .getTransformationParameters()
    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
conf.put(key, var_Filename);
return  "TRUE";
(2)In File receiver adapter configuration, select the Adapter Specific message attributes and in that select the Filename Option.
Regards
jagesh

Similar Messages

  • What is the difference btwn Variable Substitution and Dynami Configuration

    Hi Gurus
    Could you please explain the difference between the Variable Substituion and Dynamic Configuration.
    whn shall we use them and in what scenarios?
    thanx in advance

    Please go through this blog
    /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name
    Also this
    /people/madanmohan.agrawal/blog/2009/05/20/combining-three-different-aspects-of-pi-asma-af-module-and-variable-substitution-in-one-shot
    Edited by: Baskar Gopal on Mar 31, 2011 9:04 AM

  • Variable Substitution and Dynamic Configuration

    Hi All,
    In Variable Substitution , the name that should be given the the receiver payload should be part of the Source Payload unlike the Dynamic Configuration wherein the file name can be generated dynamically during mapping.
    I have the following questions
    1.Dont we need to write the UDF for the Variable substitution?
    2.Cant we do the Dynamic configuration without writing UDF?If so then how?
    3.In Dynamic Configuration the file name is generated dynamically.But where does the file name come from if it is not the part of the source payload?
    Thanks in advance

    Hi Shwetha,
    1.Dont we need to write the UDF for the Variable substitution?
    No. Here we are accessing the contents of the payload to the target. So no UDF required.
    2.Cant we do the Dynamic configuration without writing UDF?If so then how?
    Yes and No.
    Because we can set only few Dynamic configuration  values without UDF.
    If both source and target are File, then check ASMA on both sender and receiver. Then u can get the source directory name and source file name for target also without any UDF.Also some other parameters.
    3.In Dynamic Configuration the file name is generated dynamically.But where does the file name come from if it is not the part of the source payload?
    The file name comes along with the source in the payload as a attribute in header. U can view this in SXMB_MONI, and Dynamic Configuration.
    In Dynamic Configuration the file name is generated dynamically.
    No the file name is taken as it is from the source, if u want to change dynamically that u have to do in a UDF.
    I hope this will clear all doubts,
    If nt pl post
    Babu

  • Variable substitution for Dynamic filename

    Hi All,
    my Scenario is Proxy to file. and the receiver file should be a zip file of extension .dat.gz.
    In mapping I tried as below. In signature I used one sender and two receiver messages.
    SENDER:                         RECEIVER:(2messages)
    MT_Product                       MT_Product
    -----Row                              ---------Row
    ---------field1                         -----------field1
    ---------field2                         -----------field2
    ---------field3                         -----------field3
                                             MT_Poduct_1
                                               --------field5  
    for field5 I mapped current date and I am trying to use it in Reciver file communication channel. will that be correct to use?
    In receiver communication channel the file name is Product_%field5%.zip I used
    and I used Module Configuration for content conversion and Zipping the file.
    In variable substitution I used field5 for dynamic date.
    field5-----------
    payload:Messages,1,Message2,1,MT_Product_1,1,field5,1
    Module Confuguration:
    Guys! am on right path????? will this be possible????

    Hello,
    Why you are using multimapping? Just for defining target file name using var substitution - BTW, that too is incorrect. You cannot use Messages/Message 1 nodes in variable substitution.
    Secondly, if I am not wrong the approach of defining dynamic zip file name using variable substitution won’t work because variable substitution will be executed once all the modules before standard call sap adapter gets executed. So during runtime, at var substitution step, ur file will actually be a text file instead of XML as a result u will get an exception.
    So, if there is no specific objective of using multimapping then simply use DC.
    Thanks
    Amit Srivastava

  • Variable substitution for csv file

    Hi Guys,
    I am using Multimapping to generate 2 target messages and finally creating these 2 messges as csv files. But i need to use variable substitution (because dynamic configuration doesnt work in multimapping) to create the target files and i need to omit this node from content.  i know if it is fixed length file we can use variable substitution and finally we can cut the variable in content conversion by using below method
    fixedLengthToodShortHandling   cut
    Note:- I am using PI7.1
    thanks,
    madhu

    You must separate variable filename from the other fields in several nodes.
    Please, analyze if you can change your scenario, with next stucture:
    <ns0:MT_MadhuMulti xmlns:ns0="http://rr.unilever.com/bconepi13">
    <Strutcture>
    <Name>Syam</Name>
    <***>FEMALE</***>
    <ID>123</ID>
    </Strutcture>
    </Strutcture>
    <Strutcture>
    <Name>Syam1</Name>
    <***>Male</***>
    <ID>789</ID>
    </Strutcture>
    <nothing>
    <Filename>EmpDetails</EmpDetails>
    </nothing>
    </ns0:MT_MadhuMulti>
    And then in your CC:
    Recordset strucutre --> Structure,nothing
    Structure.fieldSeparator --> ;
    nothing.fieldFixedLengths --> 0
    nothing.fixedLengthTooShortHandling --> Cut
    nothing.endSeparator --> '0'
    Regards,
    Carme.

  • Variable Substitution for Source Directory

    Hello,
    I have seen several threads about using a UDF and variable substitution for dynamically determining the Target Directory.
    Is anyone familiar with (or had to implement) a solution where the Source Directory is dynamically determined.
    My challenge is to connect to a different Source Directory name (sy-datum format, ex:  20070920 ) each day on an ftp site and download all the files in the folder to a know target directory.  I am doing a simple file-to-file transfer, so no mapping is involved.
    Your comments, suggestions and feedback is greatly welcomed.
    Thanks,
    Ralph

    Hello Carme,
    I have not found a solution for this type of event.
    I was attempting this because the FTP site I was connecting to would DELETE a file the moment XI touched it.  So when XI (using FTP Transfer protocol) configured with a DELETE or ARCHIVE (Processing Mode), it would error off because the file was no longer on the FTP site.  I contacted the site but they refused to deactivate their script to auto-delete files.  Using TEST processing mode is not recommended per SAP in a server pool environment.  You would think SAP XI would provide a fourth option in which a DELETE command is not issued back to the FTP site.
    The FTP site did have sub-directories in which copies of the original files were stored, but I could not figure out how to dynamically change the XI Source Directory as the current date changed. 
    I settled on using File NFS (Transfer Protocol) and running the FTP commands from a .bat (batch file).  I put the command I run down at the bottom of the XI page with a 60 second timeout.
    I still do not change to each folder dynamically because the standard FTP  (GET and MGET) commands do not attempt a Delete after file retrieval.
    Perhaps using a batch file is an option you may want to consider using.
    Cheers,
    Ralph

  • Variable Substitution field shouldnot be written to the file

    Hello,
    I am doing a proxy to file scenario.
    Below is my datatype structure:
    MT_IN
    ---Line     1..unbounded
    ---FileName 1..1
    From the R/3 side, I send the entire file in the "line" element and the name of that file in the "FileName" element.
    Now I want to use this "FileName" element in my variable substitution to dynamically generate my filename schema but I dont want to write this into the file which is written to the filesystem.
    I only want to write the contents of "Line" element to the file and not the "FileName".
    What all options are available to do this? Please detail out.
    Thanks

    Hi Laxmi
    I think you need to reframe the message
    Do like this
    MT_OUT
                Header
                   FileName
                Items
                   Line
    Now you get Record Structure  Header, Items
    and apply FCC parameter. This will resolve. Your structure is not getting supported correctly by FCC. Try it
    Thanks
    Gaurav

  • Variable Substitution does not work

    I am trying to use Variable Substitution to dynamically generate the filename but it doesnot work.
    Below is the info on my communication channel
    Adapter type: File
    Transport protocol: NFS
    Target directory: /usr/test
    File Name Schema: %var1%.txt
    Enabled the Variable Substitution:
    var1     payload:MT_MLS_IN,1,line,1
    Here is my payload:
    <nr1:MT_MLS_IN xmlns:nr1="http://mls-clientproxies">
      <line>testing</line>
      </nr1:MT_MLS_IN>
    Am I missing something? Why isnt it writing the file to the filesystem?
    Any help is very much appreciated.
    Thank you
    MLS

    HI
    Enabled the Variable Substitution:
    var1     payload:MT_MLS_IN,1,line,1
    Here is my payload:
    <nr1:MT_MLS_IN xmlns:nr1="http://mls-clientproxies">
    <line>testing</line>
    </nr1:MT_MLS_IN>
    is MT_MLS_IN and line at same level if so
    then define payload:line,1 only
    if they are in hierarchy then you need to do the above.
    Thanks
    Gaurav

  • Variable substitution not working for dynamic file name in Receiver File CC

    Hi Experts,
    I am doing the scenario of Proxy sender to File receiver and my purpose is to Create the text file
    as per the filename available in Source Message payload.
    I am using the Variable Substitution method for this as shown below.
    Source Message Structure:-
         <Row>            -
    having Cocurence 1.1
             <Filename>     -
    having Cocurence 1.1
             <Item>            -
    having Cocurence 1.Unbounded
              <Field1>
              <field2>
             <Item>
             <Item>
              <Field1>
              <field2>
                <Item>        
         <Row>
    Target structure is same as the source structure and i have mapped the Filename field of the Source
    with the Target structure Filename.
    In ID the following is the File receiver CC Configuration.
    File Name Scheme:- %Dyn_filename%
    In Advance tab, I have selected the Enable option and added one row as Variable name %Dyn_filename%
    and Reference as payload:Row,1,Filename,1
    In testing I am getting the Error as 'variable Dyn_filename is not found in Message payload'.
    Please suggest me.
    Regards,
    Jagesh

    Hi Pooja,
    Hi Pooja,
    Thanks for your valuable reply..
    I  tried with the same. but still Filename is appearing in Output file.Giving you some details regarding my Receiver File Configuration settings.
    Target Message Type:-
              <MT_Target_Struct>
                    <Row>----
    1.1 occurence
                            <Filename_test>----
    1.1 occurence
                            <ITEM>----
    1.unbounded occurence
                                  <Field1>
                                  <Field2>
                            <ITEM>
                            <ITEM>
                                  <Field1>
                                  <Field2>
                            <ITEM>
                    <Row>
              <MT_Target_Struct>
    Recordset structure:-  Row,Filename_test,ITEM
    Row.fieldSeparator----
    >'nl'
    Filename_test.fieldFixedLengths----
    >0  (Zero)
    Filename_test.fixedLengthTooShortHandling----
    >Cut
    ITEM.fieldSeparator----
    >,
    ITEM.endSeparator----
    >'nl'
    I want only ITEM node to be written in the output file.
    Please suggest.
    Regards,
    Jagesh

  • Acces dynamic configuration variable (e.g. filename) in ABAP mapping class

    Hi experts
    I am searching for a possibility to acces a dynamic configuration variable (DCV) in an ABAP mapping class. Since I could not find a solution in SDN and other sources, I hope somebody in this forum can help me.
    What I already found is the following code which can be used to set a DCV, but what I would be interested in is how to read a DCV.
    Any help is appreciated.
    Markus
    METHOD if_mapping~execute.
    DATA l_record type mpp_dynamic.
    * copy payload
    result = source.
    * add an adapter specific attribute
    l_record-namespace = 'http://sap.com/xi/XI/System/File'.
    l_record-name = 'FileName'.
    l_record-value = 'test.xml'.
    dynamic_configuration->add_record( l_record ).
    ENDMETHOD.

    Hi Markus,
    you can find everything in my blogs
    /people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping
    Regards,
    michal

  • Dynamic configuration variable lifetime?

    We are migrating from PI 7.1 to PI 731 and one of our applications uses dynamic configuration variable. It is a custom dynamic config variable saved in the first message (IDOC to PI BPM). We have asynch to synch scenario and  send a synchronous message from BPM.
    Once the response is received, the message is sent back from BPM (Second send step). During this message, we have a receiver determination (which uses the previously defined dynamic config variable). When I look at this message in sxmb_moni, I see no 'Dynamic Configuration '  and my receiver determination fails.. This used to work in PI 7.1 before and was curious if something was changed in PI 7.31?
    I had noticed previously that dynamic configuration variable was removed when the logic went in exception processing of the BPM (even in PI 7.1).

    As I had indicated, I was creating a custom dynamic configuration variable (with custom namespace and custom name). It was not a standard...
    Essentially, a short cut to store the variable from input message (which will no longer be available in my response). 

  • Diff betwn Substitution and Dynamic Variable

    Hi All,
    As I'm new in hyperion planning I'm not able to figure out the difference between Substitution and Dynamic user variable. does anyone have any explanation with an example.. :(

    Hi,
    Substitution variables act as global placeholders for information that changes regularly.
    Each variable has a value assigned to it that can be set and changed centrally on the Analytic Services server at any time. When you are creating a substitution variable it depends on the requirement that variable is going to used for all application and its database or for particulaer apllication and its databases.
    Substitution variables are especially useful when you are developing and reporting on rolling forecasts.
    You can also use substitution variable in web form , business rules.
    Substitution variable is created in Essbase but from 11.1.2.2 we can create substitution variable from workspace.
    There is nothing named as Dynamic User variable. If i am not wrong you are asking about user variable.
    User variables act as filters in data forms, enabling planners to focus only on the members they are interested in, such as departments in a particular division. Before you can associate a user variable with a data form, you must create the user variable.
    User variable can increase performance by helping planners focus on certain members.
    It is available in the File -> New -> User variable. It is also available in the Administration -> Manage -> User Variable.
    Hope this helps.
    Regards
    SST.....
    Edited by: ss1988 on Mar 1, 2013 2:14 AM
    Edited by: ss1988 on Mar 1, 2013 2:16 AM

  • Variable Substitution - dynamic names in receiver file adapter :)

    Hi,
    anyone tried this new feature yet?
    Variable Substitution
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    I hope it's working fine it may be a good answer to many questions on the forum:)
    I can't wait till I get my hands on XI SP12:)
    if anyone has a document the describes <b>all</b> of the changes that came with sp12 please post the link
    Regards,
    michal
    Message was edited by: Michal Krawczyk

    Hi,
    I can't wait to test the new test tool
    http://help.sap.com/saphelp_nw04/helpdata/en/6b/874a4273bb3830e10000000a155106/content.htm
    it looks like a very helpful thing
    come on, come on I want my sp12:)
    Regards,
    michal

  • Dynamic target directory with variable substitution

    Hi everyone.
    I'm trying to save a file in a folder with receiver adapter.
    This folder is determined in runtime and passed to the adapter with variable substitution. My problem is that in RWB i get a error like this : 'Content of variable XXXXX is not safe'
    Does anybody have done a variable substituion for output directory receiver file adapter?
    Regards,
    Inigo.

    Hi,
    Check this links,
    /people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    Regards,
    Phani

  • Dynamic file and variable substitution

    Hi Experts,
    I am working on a scenario where filename is reading from payload.based on header value ,i am creating file along with item records.I did variable substitution also.whenever header value changes ,a new file shud be created.
    I placed two records in my input message...
    <ns1:MT_DC_Send xmlns:ns1="http://urn:psr/ff/DC">
             <Source>
               <b> <FName>XYZ</FName>
                <FType>F</FType>
                <Input>Item1</Input></b>         </Source>
             <Source>
               <b> <FName>ABC</FName>
                <FType>F</FType>
                <Input>Item2</Input></b>
             </Source>
          </ns1:MT_DC_Send>
    but only one file is getting created with name XYZ.txt(I used cont conversion)
    output fiile data is
    <b>
    Item1
    Item2</b>
    Regards,
    Srinivas

    Srini,
    Thanks for the patience. The link which u sent is not working.
    Please find the total scenario in the below URL's, if u find any discrepancies , please let me know.
    <b>Structures defined</b>:http://www.flickr.com/photo_zoom.gne?id=956871756&size=o
    Create corresponding message types & Interfaces(Outbound:OB/Inbound:IB)
    <b>Mapping Logic:</b>
    First change the message occurrence:
    http://www.flickr.com/photo_zoom.gne?id=956027877&size=o
    Part1 :http://www.flickr.com/photo_zoom.gne?id=956871778&size=o
    Part2 :http://www.flickr.com/photo_zoom.gne?id=956871880&size=o
    Part3 :http://www.flickr.com/photo_zoom.gne?id=956871906&size=o
    UDF used in Part3 mapping:
    Test_Function[Cache:Queue, Input:FName, data]
    String local ="";
    for(int j=0;j<FName.length;j++)
    if(j==0)
    result.addValue(""data[j]"");
    local =FName[j];
    else
    if(FName[j].equals(local))
    result.addValue(""data[j]"");
    local =FName[j];
    else
    result.addContextChange();
    result.addValue(""data[j]"");
    local =FName[j];
    Message Mapping results:http://www.flickr.com/photo_zoom.gne?id=956027763&size=o
    <b>Interface Mapping:</b>
    http://www.flickr.com/photo_zoom.gne?id=956027893&size=o
    <b>Interface Determination:</b>
    http://www.flickr.com/photo_zoom.gne?id=956027913&size=o
    <b>Check your ID Objects:</b>
    http://www.flickr.com/photo_zoom.gne?id=956888454&size=o
    <b>Receiver Comm.Channel:</b>
    http://www.flickr.com/photo_zoom.gne?id=956027857&size=o
    Thats it!!!
    Now run the scenario. I used the same data which I used in the above URL's
    <b>SXMB_MONI</b>:http://www.flickr.com/photo_zoom.gne?id=956871938&size=o
    <b>Outputs</b>:http://www.flickr.com/photo_zoom.gne?id=956027957&size=o
    In the output file the first line which u see in the csv files are Item tag as per ur input. The second line is the filename , I don't know how to suppress the filename element in the output file. <b><i>Our friends has to help it out</i></b>.
    <b>Note:</b> While copying the test data from Mapping editor don't forget to remove the Messages element from the source.
    I hope it helps you!!!!!
    Best regards,
    raj.

Maybe you are looking for