File adaptor and variable substitution

i have used variable substitution in the reciever comm channel to dynamically alter the folder ...Question is ..is there a way to do this from the sender comm channel..
I know, i know we can write a custom module..etc..etc..
I mean besides that ..is there a way sap provides out of the box...
Michal..what do you think..?
PS: your blog on var subst is very good !
Regards
Venkat

Hi Venkat,
For implementing variable substitution on the sender side. you can develop your own module as per your requirement.
Only question is you can easily implement this on receiver side receives payload information coming after the mapping. While processing communication channel, it has payload to refer for variable substitution..
While on the sender side communication channel do not have payload to implement variable substitution.
Can you explain in detail about condition you want to apply in variable substitution.
- Gaurav Jain

Similar Messages

  • Abap mapping and variable substitution in File adapter

    Hi experts!!.
    I am new in abap mapping, but I can do one abap mapping succesfully, but my problem is:
    I need to do a variable substitution in my file receiver adapter:
    Target directory = %cliente&/out
    File Name Scheme = TC%Fecha%.EFI
    ¿Using abap mapping is this possible? How I can do it?.
    Please is very urgent.
    Thanks in advance, and best regarts.

    Yes you can,.
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        “http://sap.com/xi/XI/System/File”,
        “FileName”);
    will become
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        “http://sap.com/xi/XI/System/File”,
        “Directory”);
    In the receive file adapter all you would need to do is select Adapter Specifc Attributes --> File Name and Directory and givce some dummy values for the filename and directroy. In the runtime values will be taken from the SOAP header which you set in the mapping.
    Regards
    Bhavesh

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

  • Error-Receiver File Adapter using Variable substitution when file is empty

    XI Experts,
    We are on PI 7.0, SP14.
    We are using variable subtitution to get the filename from source message. This works fine as long as we have data in the payload for filename element. But we have a scenario where we don't have to create file when certain condition does not exists in source message so in the message payload filename element will not exists in such condition and file will be empty and we should not create file.
    Parameter in the communication channel for Handling empty message is "Ignore".
    Does anyone knows how to handle this scneario. We don't want to default any file name in the message mapping if source file name element does not exists.
    We are following getting error in the Adapter engine.
    MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: file: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: file
    Thanks
    MP

    You can implement this by writing the module to throw an exception or whatever method you want to execute.
    If you don't want to receive an error message then module is suitable for you.
    Gaurav Jain

  • FILE CONTENT CONVERSION/ VARIABLE SUBSTITUTION

    Hi Experts,
    I have a reciver file which should have
    HEADER
    field 1
    field 2
    DETAIL
    field 1
    field 2
    TRAILER
    field 1
    field 2
    My reciever structure is
    HEADER
    field 1
    field 2
    DETAIL
    field 1
    field 2
    TRAILER
    field 1
    field 2
    TEMP
    field 1
    I am using TEMP field1 only for variable substitution and do not want
    it to be written to file. How can i use it in FCC.
    Pl. Help
    Akhil

    Hi,
    Plz do refer the folowing links:
    Sender -
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    Key value:
    /people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter -
    TAB delimited
    /people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
    /people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
    NAB the TAB (File Adapter)
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
    Receiver FCC no need of Endseparator
    /people/shabarish.vijayakumar/blog/2007/08/03/file-adapter-receiver--are-we-really-sure-about-the-concepts
    Regards,
    Vinod.

  • White lines generated in a txt File when using variable substitution

    Hello,
    I have a problem with a File generated by XI, my File Adapter is using variable substitution with reference to a field of my message type. I use content conversion as well and the generated file has a white line in top of file.
    How could I avoid this and make the white lines disappear? I was trying a lot of things but I don’t really know how to solve this issue, the following is the data type used:
    <FILE_NAME></FILE_NAME>
    <COMPANY>
         <COMPANY_CODE></COMPANY_CODE>
         <COMPANY_NAME></COMPANY_NAME>
         <ADRESS></ADRESS>
    </COMPANY>
    FILE_NAME is the field I use for variable substitution and COMPANY is declare as 0..unbounded.
    Thanks a lot in advanced,
    Luis

    Hi Jai,
    I have declare the following Content Conversion parameters:
    Recordset Structure: COMPANY
    FILE_NAME.fieldFixedLengths     0
    FILE_NAME.fixedLengthTooShortHandling     cut
    COMPANY.fieldFixedLengths     10,80,10,2,50,30,5,5,2,50,50
    COMPANY.addHeaderLine     0
    COMPANY.endSeparator     'nl'
    But it does not work, I have the same white line in the beginning of the file. Do you have any other suggestion??
    I couldnt find the blog written by Sravya either, could you post the link?
    Thanks a lot,
    Luis

  • Error file adapter with variable substitution in PI 7.31

    Hello,
    I'm trying to create a file with a dynamic name, based on the payload of the message.
    We're trying to create a filename with the bold content in the name %batchId%.xml. The subtitution we use is
    payload:batch,1,batch-info,1,id,1
    <ns1:batch xmlns:ns1="http://www.atosworldline.com/archivingPortal/receivers">
    - <ns1:batch-info id="test" isTest="true"> 
    <ns2:sender-identifier xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">String 2</ns2:sender-identifier>  
    <ns2:nb-elements xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">3</ns2:nb-elements>  
    <ns2:batch-integration-mode xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">String 4</ns2:batch-integration-mode>  
    <ns2:creation-datetime xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">1999-05-31T13:20:00Z</ns2:creation-datetime>  
    </ns1:batch-info>
    - <ns1:receivers> 
    - <ns1:receiver> 
    <ns1:id>String 5</ns1:id>  
    <ns1:action>String 6</ns1:action>  
    <ns1:contact-details />  
    - <ns1:tokenSets> 
    - <ns1:tokenSet startDate="1999-05-31T13:20:00Z" endDate="1999-05-31T13:20:00Z"> 
    - <ns1:token> 
    <ns1:tokenvalue>String 7</ns1:tokenvalue>  
    </ns1:token>
    - <ns1:token> 
    <ns1:tokenvalue>String 9</ns1:tokenvalue>  
    </ns1:token>
    </ns1:tokenSet>
    - <ns1:tokenSet startDate="1999-05-31T13:20:00Z" endDate="1999-05-31T13:20:00Z"> 
    - <ns1:token> 
    <ns1:tokenvalue>String 11</ns1:tokenvalue>  
    </ns1:token>
    - <ns1:token> 
    <ns1:tokenvalue>String 13</ns1:tokenvalue>  
    </ns1:token>
    </ns1:tokenSet>
    </ns1:tokenSets>
    </ns1:receiver>
    </ns1:receivers>
    </ns1:batch>
    The following error is shown, when processing the message through the receiving fileadapter.
    MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: batchId
    kind regards,
    Pieter

    AFAIK - Variable substitution does not support attributes. It only support the elements. (- <ns1:batch-info id="test" isTest="true">)
    May be you can go with dynamic configuration instead of variable substitution.

  • IDoc to File - IDoc number : Variable substitution in File Adapter

    Hi,
    I have an IDoc to File scenario. I want to use the IDoc Number as part of the target filename (using variable substitution) in the File Adapter. However, the target flat file does not have a field where I can store the IDOC number. I know the IDoc number is also stored in the message header ( under the IdocInbound tab), but is there any way I can access this in the variable substitution?
    Failing this, if I have the Idoc number in the target XML, is there any way I can skip it in the flat file generated?
    example...
    XML looks like this...
    <Root>
    <Record>
       <IdocNum>99999</IdocNum>
       <HeaderRecord>
       </HeaderRecord>
       <LineRecord>
       </LineRecord>
       <LineRecord>
       </LineRecord>
    </Record>
    </Root>
    But the flat file should be..
    HeaderRecord...
    LineRecord...
    LineRecord...
    Cheers
    Manish

    Hi Chandra,
    Thanks for this
    But this is standard stuff that is detailed in SAP help files (http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm)
    What I was looking for was in Sravya's blog (refer the earlier entry).
    Thanks anyway
    Cheers
    Manish

  • Blank Lines at end of file when using Variable Substitution in File Adapter

    Hi all,
    I'm using variable substitution in a File Adapter, it's refers an element of message, like:
    filename    payload:MESSAGE_INTERFACE,1,FILENAME,1
    The variable substitution is working right, but it's append a BLANK LINE at end of file.
    Anyone knows how to solve this problem ?
    Thanks in advance.

    Hi Regis,
    I suppose you're using content conversion?
    if so try adding
    <b>endSeparator</b> = '0'
    to your last element
    this will delete the default line break at the end
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

  • SQL Injection and variable substitutions

    Hello helpful forum, I'm trying to understand what really goes on "behind" the scenes
    with the variable substitutions in order to protect from sql injections.
    I'm using apex 3.0.0.00.20
    The trickiest component seems to be a Report of type "pl/sql returning sql", since
    multiple dynamic sql interpretations are done there.
    consider the following innocent looking disaster:
    DECLARE
    l_out VARCHAR2(2000);
    BEGIN
    l_out := 'select * from test_injection t where t.name like ''%' || :NAME || '%''';
    RETURN l_out;
    END;
    if NAME is a single quote the report will return:
    failed to parse SQL query: ORA-00911: invalid character
    which hints to the fact that NAME is not escaped, and you are in fact able to access db functions
    as in: '||lower('S')||'
    I also tried to put there a function that runs in a autonomous transaction to log its calls, and
    I see that it's called five times for each request.
    consider now the similar solution (notice the two single quotes):
    DECLARE
    l_out VARCHAR2(2000);
    BEGIN
    l_out := 'select * from test_injection t where t.name like ''%'' || :NAME || ''%''';
    RETURN l_out;
    END;
    with this second example nothing of the above is possible.
    So my theory (please confirm it or refute it) is that there is a first variable substitution done
    at the pl/sql level (and in the second case :NAME is just a string so nothing is substituted).
    Then the dynamic sql is executed and it returns the following string:
    select * from test_injection t where t.name like '%' || :NAME || '%'
    now another substitution is done (at an "APEX" level) and then query is finally executed to return
    the rows to the report.
    The tricky point seems to be that the first substitution doesn't escape the variable (hence the error
    with the single quote), while the second substitution does.
    Please let me know if this makes sense and what are the proper guidelines to avoid sql injection with
    the different kinds of reports and components (SQL, pl/sql returning sql, processes, ...)
    Thanks

    Giovanni,
    You should build report regions like this using the second method so that all bind variables (colon followed by name) appear in the resultant varchar2 variable, l_out in your example, which will then be parsed as the report query. This addresses not only the SQL injection problem but the shared-pool friendliness problem.
    Scott

  • File Reciver adapter - Variable Substitution

    Hi all,
    i am creating a file with dynamic file name.
    My structure looks like this:
    Row - 0-unbound (all the data)
    FileName - 1
    I don't want the file name to appear in the file I just want it for the Variable Substitution.
    so in the content conversion i use only the row.fieldFixedLengths
    but in the file i get an extra empty line because of the file name.
    Thanks,
    Naama.

    Hi,
    Its better to go for Adapter specific attributes with dynamic configuration. That will avoid you from usage of Filename field in target structure.
    Refer - Dynamic Configuration for file name
    Dynamic  File Name for Receiver File Adapter
    Dynamic File Name using XI 3.0 SP12 Part - I
    Dynamic file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II
    Thanks
    swarup

  • Steps to read a file through file adaptor and then i need that to insertDB

    Hi anyone please help me in reading a file through jdev and then insert into data base i am able to receive the file the null values and getting inserted..
    thanks
    saileshan.

    Hi,
    Please let us know the following -
    1) Did you verify that you are able to see all the data in the BPEL process from the File which is read?
    2) Are you using a transform or an assign activity to insert data into table?
    If using a transform activity, did you test the mapping file (.xslt) and see that the transformations are happening correctly?
    Let us know the answers to the above questions before we proceed further.
    Thanks,
    Ritika

  • Bursting XML Control File - only one variable substitution works

    Hello, I have the following from my bursting xml. In my subject I would like to have more than one substitution as in my example. Problem is that when I have more than one, the second one alway is "null". On there own they work fine. Is this a bug/limitation?
    <xapi:message id="111" to="${ADMIN_EMAIL}" attachment="true" subject="Unigas Inv
    oice No: ${TRX_NUMBER} for ${PARTY_NAME}">

    Use this syntax in your burst file (note you will need the above patch applied).
    <xapi:document output="${VAR - or hard code name here}" output-type="pdf" delivery="xxx" >
    Alternate way (if you don't have the patch) is to use the bursting listener by implementing it and doing the following in the afterProcessDocument interface.
    public void afterProcessDocument(int requestIndex, int documentIndex, Vector documentOutputs) {
    String outFileName = (String)documentOutputs.get(0);
    File newFile;
    File oldFile = new File(outFileName);
    newFile = new File(oldFile.getParent() + File.separator + "file" + oldFile.getName());
    oldFile.renameTo(newFile);
    documentOutputs.remove(0);
    documentOutputs.add(0, newFile.getPath());
    }

  • File Info and Variable values visible in Sharepoint?

    (FM11)
    We're considering Sharepoint as a CMS for use with FM11 (maybe FM12 later) and are looking for some trailheads.
    Can values of FM variables become visible through Sharepoint?
    What about File Info values (File > File Info) ?
    Which features of Sharepoint views / pages / layouts are particularly helpful or frustrating?
    If you were doing it again, what would you do the same and what would you do differently?
    Best regards,

    Hi,
    It is known issue that on exporting list items, look up column values are lost.
    For your issue, you can take steps as below to retain look up column values in export list template:
    1. Browse to the source Web’s lookup list “Sub Category” and choose Modify settings and columns.
    2. Copy the source lookup list GUID from the URL. It should be a sequence of numbers and letters similar to:  %7BFFA47BF8%2D849C%2D4F20%2D9C50%2D173D2F5B6725%7D.
    3. Browse to the destination Web’s lookup list and choose Modify settings and columns.
    4. Copy the destination lookup list GUID from the URL. Similar as point 2.
    5. Delete %2D from the string and replace with a dash sign (-). There should be no dash sign (-) at the start and the end. GUID should be in the following format: FA47BF8-849C-4F20-9C50-173D2F5B6725
    6. Save the source Web’s list that contains a lookup column “Category” to the lookup list as a list template called category.stp.
    7. Export the list template STP from the source list template gallery to the file system.
    8. Rename the category.stp file to category.cab so Windows can open it.
    9. Open the file, right click on the manifest.xml file and export it to the file system.
    10. Edit the manifest.xml file; find the source Web’s lookup list GUID and replace it with the destination Web’s lookup list GUID.
    11. Save the manifest.xml file.
    12. Open a VS.NET command prompt.
    13. Run the makecab command as: makecab manifest.xml category.stp
    14. Import the new STP into the destination Web’s list template gallery. You will need to delete it if it has previously been imported.
    Reference:
    http://sharepointknowledgebase.blogspot.com/2012/09/retain-look-up-column-values-in-export.html#.VPg8d3kcQiQ
    Best Regards,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Variable Substitution settings for Receiver File Adapter

    Hi All,
    I wanna use variables for File Name Sheme in the File Access Parameters.I had used by enclosing the variable names within %. When i wanna substitute values for those variables, it is given in the documentation(help.sap.com) that v need to set the Enable indicator. only after setting the indiactor, v can use the variables and can then enter the values for those variables in a table. but i can't see either the indicator or the table in my editor. how can i provide the values for the variables used in file name scheme/Target Directory. and for ur information,i'm using sp12.
    any help wud b appreciated.
    thnx
    Anil

    Hi Anil,
    Please check out the following link ...
    Re: Variable substitution - Pseudo Path Variable - file adapter
    Re: Variable substitution problem
    Regards,
    Raj

Maybe you are looking for

  • Error message when I Embed QT movie with Poster movie

    Hi, I posted a QT movie with poster movie to my blog, http://blog.ginauhlmann.com/ All info that I can think of is below, and any help would be greatly appreciated! I can't get my hosting company to help. Thanks! I uploaded a folder named video, with

  • Burn Folder gone bizarro!

    I created a Burn Folder in the MacOS 10.4.5 Finder today, with the intent of taking images from my iPhoto library and organizing a re-usable "staging area" to create CD-Rs from a catalogue of select images. As I understand it, a Burn Folder is suppos

  • Date Format in Leave Request

    Hi All, We are using ESS on Portal, with EHp3. In leave request we want to change the date format (From Date and To Date) from MMDDYYYY to DDMMYYYY. In back-end we are maitaining the date format as DDMMYYYY for the R3 User. Dont know where we maintai

  • (Movie included) - Upgrade to Creative MediaSource5 to version 5.10.38 HANGS (freezes) all the t

    The file to upgrade Creative MediaSource5 to version 5.0.38 HANGS (freezes) all the time. I?ve done this like 7 times already? same thing. (my current Version is 5.0.25, a bit old) Please take a look at this movie, it'ss short and small. http://web6.

  • LocalSessionFactoryBean - Could not instantiate bean class

    Hello, I am facing a problem with the instantiation of the LocaSessionFactoryBean in a sample Spring 3.0.4 - Hibernate 3.2.6, WebLogic 10.3.3 and Oracle 10g. I am run an web application using JDeveloper 11.1.1.3.0 with the integrated WebLogic Server