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

Similar Messages

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

  • ORA-04054 : using variable substitution for the database link name

    Hi,
    I need to use variable substitution for the database link name.
    Here is my command :
    declare
    GET VARCHAR2(50);
    begin
    select OIA_GET_DESIGNATION into GET from INFODRI.OMA_IN_ARTICLES;
    for rec in (select * from [email protected]_GET_DESIGNATION)
    LOOP
    dbms_output.put_line('TEN_CODE vaut : '||rec.ten_code);
    END LOOP;
    exception
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERREUR ORACLE DETECTEE : '||rec.OIR_CUR);
    DBMS_OUTPUT.PUT_LINE('Message Erreur : '||SUBSTR(SQLERRM,1,245));
    :crd := -1;
    end;
    When I run this programm, I receive the error :
    ORA-04054: database link REC.OIA_GET_DESIGNATION does not exist
    When I replace :
    for rec in (select * from [email protected]_GET_DESIGNATION)
    by :
    for rec in (execute immediate 'select * from tensions@'||rec.OIA_GET_DESIGNATION)
    I receive the error :
    PLS-00103 : Encountered the symbol "IMMEDIATE" while parsing.
    What can I do to resolv my problem ?
    Regards,
    Rachel

    What is the name of the DB Link and the name of the object you are selecting
    from?
    I find it easier to create a view on the remote object then use that in selects.
    e.g,
    Link Name = MyLink
    Object_name = Addr_Loc
    create or replace VIEW Rem_Addr_Loc AS
    select * from addr_loc@mylink;
    In the code I then use the view
    begin
      for C_Rec in (select * from Rem_Addr_loc)
      loop
         dbms_output.put_line('Rec: '|| C_Rec.Col1);
      end loop;
    end;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • FTPs connection error:When using Variable substitution for Directory path

    Hi
    I am transferring data from BI to xml file via PI: Here a Client proxy from BI sends the data to PI and the PI FTPs the XML file to a remote location. For FTP I am using FTPs SSL connection.
    It was working fine untill I used Variable susbstitution to determine Directory path dynamically. I am using this because different xml files are intended to goto the different locations.
    I did the variable substitution like this:
    Target Message Structure:
    ---> Target Directory: %var1%
    <?xml version="1.0" encoding="UTF-8" ?>
    <MT_BI_EXTRACT_FILE>
      <Header>
         <Directory>/Customer</Directory>
    </Header>
    <Detail>
    </Detail>
       </MT_BI_EXTRACT_FILE>
    And in the variable substitution I am doing it this way
    payload:MT_BI_EXTRACT_FILE,1,Header,1,Directory,1
    And the error I am getting is:
    Attempt to process file failed with Error when getting an FTP connection from connection pool: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: iaik.security.ssl.SSLException: Peer sent alert: Alert Fatal: handshake failure
    MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error when getting an FTP connection from connection pool: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: iaik.security.ssl.SSLException: Peer sent alert: Alert Fatal: handshake failure
    Exception caught by adapter framework: Error when getting an FTP connection from connection pool: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: iaik.security.ssl.SSLException: Peer sent alert: Alert Fatal: handshake failure
    Delivery of the message to the application using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error when getting an FTP connection from connection pool: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: iaik.security.ssl.SSLException: Peer sent alert: Alert Fatal: handshake failure.
    Does anybody have some Idea of this ??
    Regards
    Naina

    Hi,
    I guess the problem is not with Variable Substitution..
    Error when getting an FTP connection from connection pool:
    So its a connection problem..
    Also check the option Disable Security check and try again...
    Try to check again if the interface is executing properly without Variable substitution and let us know..
    Babu
    Edited by: hlbabu123 on Jan 7, 2011 2:46 PM

  • 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

  • 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

  • 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 for File Name Scheme

    Hi all,
    Please clarify the following issue.
    I have two source fields
    Transfer Order number  -  0000000222
    Transfer Order line item - 0001
    Both i map it into one target field
    The target field output is  - 0000000222#0001
    I need a file name which starts with ABC <TranferOrderNumber>.txt
    The problem is, when i try to use payload i get output
    (ABC0000000222#0001.txt). The reason is i use the target field which was concatenated. I don't have any target field with only transfer order no.
    Please give me a solution where i would get output
    (ABC0000000222.txt).
    Thanks in advance,
    Jose Augastine

    Hi,
    Other way may be like this ..Create a one more segment in your target structure with field name as Transfer Order No. And populate only this no. And in the Reciever File adapter , in the variable sub, use only this field. But this new segment will come in the file. To avoid this, you can make use of " Cut "  Parameter in the File Content Conversion.
    This will hold good, if you have content conversion-
    /people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12
    Otherwise, you can think of Bhavesh's suggestion
    Regards,
    Moorthy

  • Where is explanation of variable substitution for localization files in Adobe docs???

    It's odd, I was looking over the live docs about localization in Flex and no where did I see any mention of how you could substitute variables dyanmically? For example  maybe in English I want "Welcome Rick!" but in some other language I want "Rick, Welcome!" (where "rick" as name is the dynamic portion.)
    After many google searches I found this helpful post on another site: http://soenkerohde.com/2008/07/flex-localization/
    That describes how you could do it, but shouldn't this be in the docs somewhere? Can someone point me to the adobe doc page that I'm missing. It's probably covered in some other area other than localization, but I'm not finding it.
    Thanks

    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 for IDOC-XML-Flat File

    Hello
    I have a scenario where I need to populate the Idoc number into my file name. the Source is an Idoc and the Target is XML but the target is then converted to an Flatfile via a module in the processing sequence. When I try to use the variable sub method it errors out as the final target structure is a flat file and not the XML structure that I hav used in the graphical mapping. Any help on how I can go abut doing this will be greatly appreciate.
    Thanks
    Lavanya

    IF I remove my adapter that converts the XML file to Flat file from the module sequence this works perfectly. So is there a way for me to now read the xml file for the target file name in variable sub. but still have the Flat file structure derived for the processing seq.

  • Variable Substitution  need to define pay load for the following structure

    Hi All
    Please help me for defining the pay load for the following structure for the Variable Substitution 
    for genearing the file dynamically fro the payload
    Target structure is like this
    MT_RFQ_IND_IDOC_MYSPACE_TARGET............> my message type
        <HEADER>
              < FileName>
              <INDI>
              <RFQNO>
              <DOCUTYPE>
       < ITEM>
              <FEILD1>
             <FEILD2>
             <FEILD2>
    please help me
    thanking you
    Sridhar

    Hi,
    should this var1 given in any data type of my IR - No
    in variable substitution, in value give the complete thing which i said above in italics i.e. payload:MT_RFQ_IND_IDOC_FILE_TARGET,1,hEADER,1,FileName,1
    which user you used for CPACache refresh - it can only be done by XIDIRUSER.
    Regards,
    Rajeev Gupta
    Edited by: RAJEEV GUPTA on Feb 6, 2009 7:34 AM
    Edited by: RAJEEV GUPTA on Feb 6, 2009 7:35 AM

  • Variable Substitution with tag attribute

    Hi,
    is possible to use variable substitution with tag attribute? as follow:
    <root directory="xxx"  filename="yyy">
       <....
    </root>
    using variable substitution for directory : root,1,directory,1
                                                               root,1,filename,1

    Hi,
    I solved my problem using Dynamic Configuration to set the FileName and Directory fields in Adapter Specific Configuration. To use Variable Substitution only accept element in XML.
    Thanks for all.

  • Dynamic Filename

    Hi
    i am using the variable substitution method in file adapter for dynamic filenam.e But the adapter is throwing error saying
    "Message processing failed: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: var1"
    am using the variable %var1%.dat in the filename.
    Any idea why happens. Am in SP14.
    And if use Adpter specific message properties, it is saying FileName missing. Even if i give this as variable it is not taking.
    Regards
    Andy

    Anandan
    Check the help..If its part of message Payload you need to prefix with  <b>payload:</b>
    %% isused incase of attributes of the message header
    Chk the help@
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm</a>

  • Doubt in Variable substitution

    Hi experts,
    Can i use variable substitution for taking a part of the input filename.
    My output filename contain only a part of the input filename.
    Regards,
    Divia

    >>With out storing the part of the input file name in a output files structure, is it not possible to achieve?
    You can use Dynamic Configuration UDF to set the file name instead of Variable substution.
    Have a look at Scenario #2 in my wiki [More with the File Adapter|https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/morewiththeFileAdapter]
    Thanks
    SaNv...

Maybe you are looking for