Filename based on varying payload elemet.

Hi All,
My file name is dependent on the payload.The file name is not based on a fixed element in the payload but varies with the payload type (although the schema is the same for all).
Variable Substitution will not work as the substitutation itself is not fixed.
I thought of writing a module and change the file name before CallSAPAdapter is invoked.
Basically I am planning to use Adapter Specific Attibute.This way the Dynamic configutaion will be filled and I an provide the value in my module.
Has anyone tried this.
Any other idea on how to manipulate the Filename otherwise without having multiple Receiver defined.
Please note ,the Sender Adapter in this case is IDoc and using UDF (in mapping) to update DYNAMIC_CONFIGURATION using Adapter Specific Atribute may not work.
Thanks in Advance,
Regards,
Bikram

Hi Sravya,
In the example you mentioned, "conf" or the  "valueOld" will be null as there is no dynamic configuration defined in the sender adapter (IDoc in my case).
// access dynamic configuration
      DynamicConfiguration conf = (DynamicConfiguration) param.get(
          StreamTransformationConstants.DYNAMIC_CONFIGURATION);
      // read value
      String valueOld = conf.get(KEY_FILENAME);
      if (valueOld == null) {
          throw new StreamTransformationException(
              "Filename is missing. ");
I tried the following in UDF and "conf" is null.
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
Any other idea ?
How Can I access the DynamicConfiguration in a module ?
Regards,
Bikram

Similar Messages

  • Filename based on a payload-field condition?

    Hi there,
    I'm wondering if it's possible to condition the fieldname based on a payload "flag", like a simple "if flag = 1 then filename it's 'flat.txt', else filename it's 'nested.txt'." where flag is part of the payload and can be mapped to the target message...
    I was looking for some adapter-specific attributes but it seems that this only applies for the SOAP message, not over the payload.
    So i was thinking about java stack, like using global containers or something but i don't know how to access them using the ASMA bean or something like that, but i don't have any documentation how to do it, so if you can advise which will be the best way to achieve that, it will be great...
    Points rewarded if useful...
    Thanks folks.

    You can do it by using adapter specific attributes as mentioned in blog
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    You can write a UDF as mentioned by this blog, passing the flag to this UDF
    Inside UDF you can check flag value and accordingly set the filename in dynamic configuration

  • Splitting a file based on the payload field - multimapping

    HI Everyone,
    I have a requirement of splitting a file based on the field .
    e.g When I am a file as :
    row1  David    US
    row2  Cindra   US
    row3   Peeru   CA
    row4   Jay       CA
    Then, I have to split the file into two files, one file with the US rows and  another file with the CA rows.
    There can be many countries in the input file, so number of target files need to be generated is not fixed.
    I have gone through the below links :
    /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible   ( in the blog we know that there are two receivers but in my case I dont know that )
    https://bond.newellco.com/irj/scn/,DanaInfo=www.sdn.sap.com,SSL+thread?messageID=6449801#6449801
    ( Everyone is providing JAVA mapping as a solution....)
    Is Java mapping the only option to resolve the problem case I have ?
    Thx
    PEERU IN

    Hi Peeru,
    I don't have access to the any FTP or file server of XI to check the file adapter as i am travelling right now(I am 100% sure that the file adapter splitting will work as i have done this for one of my requirement).
    Coming to your requirement:
    I wrote an java map which will read the XML file and create the multiple recordset based on number of different country exists in the file, then i am printing the final structure in an multi mapping layout (please see the attached input file Country.xml and out put file which the java map generated Final.XML) if we do this i think the file adapter will create the different files based on the number of recordset we have as you can see the output file is generated with the 3 recordset (<Country>) tag each country tag has its own records, now if i give the filename in variable substuition pointing to region then i think i should get 3 files with names
    us.xml
    us01.xml
    us02.xml
    i think by using the multi mapping i can generate 3 files and by using the variable substution i can give the 3 different names from the payload of each file and also can add the timestamp for each of the file, again i didn't have access to the file adapter in the project i am working on so i couldn't verify in XI server, but if you still looking for solution then let me know i will give the map details.
    Input File: Country.xml
    <?xml version="1.0"?>
    <check>
         <order>
              <name>Nisar1</name>
              <region>US</region>
         </order>
         <order>
              <name>Nisar2</name>
              <region>US</region>
         </order>
         <order>
              <name>Nisar3</name>
              <region>US</region>
         </order>
         <order>
              <name>Nisar4</name>
              <region>US01</region>
         </order>
         <order>
              <name>Nisar5</name>
              <region>US01</region>
         </order>
         <order>
              <name>Nisar6</name>
              <region>US01</region>
         </order>
         <order>
              <name>Nisar7</name>
              <region>US</region>
         </order>
           <order>
              <name>Nisar8</name>
              <region>US</region>
         </order>
           <order>
              <name>Nisar8</name>
              <region>US02</region>
         </order>
    </check>
    Output File : Final.XML
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
         <ns0:Message1>
              <country>
                   <Order>
                        <name>Nisar1</name>
                        <region>US</region>
                   </Order>
                   <Order>
                        <name>Nisar2</name>
                        <region>US</region>
                   </Order>
                   <Order>
                        <name>Nisar3</name>
                        <region>US</region>
                   </Order>
                   <Order>
                        <name>Nisar7</name>
                        <region>US</region>
                   </Order>
                   <Order>
                        <name>Nisar8</name>
                        <region>US</region>
                   </Order>
              </country>
              <country>
                   <Order>
                        <name>Nisar4</name>
                        <region>US01</region>
                   </Order>
                   <Order>
                        <name>Nisar5</name>
                        <region>US01</region>
                   </Order>
                   <Order>
                        <name>Nisar6</name>
                        <region>US01</region>
                   </Order>
              </country>
              <country>
                   <Order>
                        <name>Nisar8</name>
                        <region>US02</region>
                   </Order>
              </country>
         </ns0:Message1>
    </ns0:Messages>
    regards
    Nisar Khan

  • ABAP proxy to FILE - filename partly build from PAYLOAD

    Hi
    I have an ABAP proxy sent from SAPBACKEND ->PI->FILE
    I need to build the filename dynamically based on a template "FILENAME"+variable1.XML
    Variable 1 is from the payload - so a field in my XML - "FIELDVAL".
    How to extract the value from the payload and build the filename dynamically?
    Can I use substitution values in the filename in the CC? or must I build up the entire filename in UDF?
    We are using PI 7.11
    Cheeers

    Hi,
      You can do this either by Dunamic configuration (Writing a UDF) OR by variable substitution..
    Check below links
    http://wiki.sdn.sap.com/wiki/display/Snippets/SAPXIDynamic+Configuration
    http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot
    /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name
    Amol

  • File Receiver - Dynamically create filename from data in payload

    Hi there.
    Can anyone tell me the approach I need to take to be able to use the data in one field to determine the filename in the file receiver adaptor.
    I have a requirement that requires that I save a file with the following mask:
    xxxx_xxx<b><date extracted from field in payload></b>.csv
    I would appreciate any help on this.
    Thanks in advance.
    Mick.

    Hi Mick,
    you just need to use adapter specific parameters
    and you will be able to set the name in your mapping
    (from your payload)
    /people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Dynamic Filename from source IDOC payload

    Hi,
    I have a scenario IDOC --> ABAP Mapping --> Flat File.  I need to create the receiver file name dynamically with the document number from souce IDOC. Since the target payload is flat file I don't know whether I can use the variable substitution. Also can I use the dynamic configuration with ABAP Class mapping.
    Please help.
    Thanks.
    Srini

    Actually Henrique's reply in this thread has the exact code,
    Re: Abap mapping and variable substitution in File adapter
    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.
    Regards
    Bhavesh

  • Dynamic FileName based on environment

    Hi expert,
    I have a proxy to file scenario in which I create dynamic FileName using an UDF. I'm using UDF because filename must contains date with a particular date format (yyDHHmm).
    My need is to generate file name prefix based on environment, for example:
    In DEV environment FileName must start with T
    In QTY FileName must start with Q
    In Prod FileName must start with G.
    Is possible to catch the environment name in UDF (I think from DynamicConfiguration)?
    Which values I have to test in the IF statement?
    thanks,
    Fabio

    Hi Fabio,
    Is possible using:
    String EnvironmentName = (String) System.getProperty("SAPSYSTEMNAME");
    Then, you can use the IF statement and a Concatenate statement:
    String output = null;
    if (EnvironmentName == 'DEV') {
    output = "D" + Filename;
    } else if (EnvironmentName == 'QAS') {
    output = "Q" + Filename;
    } else if (EnvironmentName == 'PRD') {
    output = "P" + Filename;

  • Set Message Processing Queue based on input payload

    Hi all..
    Can i set the message processing queue from graphical mapping?
    Receiver system in my scenario is ECC.Whuile sending messages to ECC, i need to send the message related to a particular ORDER Number in a particular queue.
    for EX: if ORDER Number  from my input payload is 457 i want to set the queue as ABC457.
    Please let me know how to get it done from mapping or if there is any other approach.
    Thanks
    Manohar

    Hi Ram,
    What do you mean by Queue here?? we can check condition in mapping level only based on ORDER Number we can send message to receiver.use enhance receiver determination.
    Regards,
    Raj

  • SOAP respond payload based on request payload parameter

    Hi,
    I have a requirement to repond the soap payload based on the sender request payload. For example
    if sender payload
    <a1>11</a1>
    <b1>22</b1>
    <c1>33<c1/>
    the respond must be
    <a1>value</a1>
    <b1>value</b1>
    <c1>value</c1>
    There was a lists of parameter that may require based on the sender payload. How can i achieve this?
    Thanks.
    Edited by: fcgan on Feb 26, 2010 5:35 AM

    Hi,
    Thanks for reply. The request payload will be dynamic. Fro example 1st time is <a1> <b1> , 2nd time maybe <b1> <c1>. Currently i already create the data type for a to z the my abap proxy will search the value and return the value a to z. but the requirement is only respond the value that requested.
    thanks.

  • Using javascript to save a pdf to a different directory and generating a new filename based on form fields in the document.

    I have built the following script in an attempt to create a submit button that will automatically save the document in a different directory on my computer. It will also use the form field data "customer" and "date" to generate the filename. I printed out the variable myPath and it looks like it printed the correct string. I keep getting the following error:
    TypeError: redeclaration of const path
    any help would be much appreciated.
    var customer = this.getField("Customer").value;
    var date = this.getField("Date").value;
    var path = "C:/Users/awilliams/My Documents/Test/"
      var reg = date.match(/(\d+)\/(\d+)\/(\d+)/);
    var myPath= "C:/Users/awilliams/My Documents/Test/" + customer + "_" + reg[1] + "." + reg[2] + "." +
    reg[3] + ".pdf";
    this.saveAs(myPath);

    "path" is a keyword within a PDF you should not use keywords as a name for any other object as a general rule.
    Have you checked the PDF Reference to see how to create a file path name within a PDF,  3.10.1 File Specification Strings page 118?
    Did you carefully read the Acrobat JavaScript Reference for the saveAs method?
    The notes following the description:
    Note: This method can only be executed during a batch or console event. See Privileged versus non-privileged context for details. The event object contains a discussion of JavaScript events.
    (Adobe Reader S): This method is available in Adobe Reader for documents that have Save usage rights.
    How to Save a PDF with Acrobat JavaScript

  • Setting save directory and filename based on fillable form fields.

    Hello,
    I'm new to .pdf development in Acrobat. I'm trying to create a form which allows users to fill in data, then save a copy of the form to a directory and file name which will be based upon several of the fields in the document. Is this method of saving possible? I've tried a script but can't seem to make the process work.
    Thanks for the help!

    It's possible, but the code that does the actual save (using the doc.saveAs JavaScript method) needs to be in a folder-level JavaScript file and further in a trusted function and app.beginPriv/app.endPriv block:
    http://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript
    http://livedocs.adobe.com/acrobat_sdk/11/Acrobat11_HTMLHelp/JS_API_AcroJS.89.173.html
    or in a certified document that the user chooses to trust to execute privileged code. If you've done either of these, can you post the code you're using?

  • Create a filename based on form content

    Hello,
    I always have a hard time explaining my question's but here goes.
    I have a button which saves a form once filled out. I would like to take the thinking out of this when it comes to naming the file and it create the name based on a numerical field in the form (in this case a serial number). The example would be something like 00000_Inspection Form.pdf. I am certain this can be done with  javascript but not being a programmer, I have no idea where to begin with this. I have a variable set up but no idea how to act upon it.
    thanks in advance.
    Brad

    Hi
    try this syntax
    Sum(HrsWorked)/(Count(Payperiod) In Report)
    Regards,
    Stratos

  • Determine output filename based on input filename content with RFC lookup

    Hello Guys,
    I have this sitaution which needs your ideas/sugestion.
    1)  PI system picks up text file from FTP server folders.
    2)  Within PI system,  we need to dynamically determine output filename , logic to determine output filename will be :
              2a)  Read content of the input file particular line number  (Fixed)
              2b)  Pass the value got from step 2a)  to the Remote function module passing value read in step 2a) to get response
              2c)  Use response received from 2b) to construct output filename.
    Please let me know if you have any qeustions on my problem,  appreciate your ideas/suggestions.
    Thanks,
    Krishna

    Hello Priyanka,
    THanks for your response to my post.
    My input  TEXT filename has following contents
    :20:CHASGB2LXXX
    :25:24803501
    :28:11264/01
    :60F:C110921USD85410,88
    :61:110921C12307,00NTR NONREF//5311802
    :86:TR ?
    ?20IV.2000199238 FR.26.08.11 IV.2000198595FR.22.08.11
    ?23AZMAT20091123183
    Now  I would like to read second row of this TEXT file containing   ":25:24803501"   and would like to read only text
    24803501.
    Hope this additional info will provide me more info on my requirement.  Appreciate your response.
    Regards
    Krishna

  • Billing plan type determination based on Variant configuration characterist

    Hi All,
    We have a process where in to determine the Billing plan of the contract based on the Characteristic value of the material.
    If the characteristic value is 'M' Monthly billing plan and assign corresponding billing plan to FPLA, if value is 'Q' then quarterly.
    what is the right place to update the FPLA table and further getting FPLT updated automatically.
    We tried doing the code in MV45AFZZ, VBKD routing.. But the FPLT is not getting updated all the time.
    Thanks,
    Ajai.

    Prathiba
    Are you able to resolve this issue?

  • Creating a filename based upon entered fields

    Using Acrobat 7, I have two fields that I would like to draw upon to create a unique filename under which the document will be stored.
    Field #1: Name.Last (no formatting)
    Field #2: Date.From (formatted as mm/dd/yyyy)
    If #1 = "Smith" and #2 = "02/03/2008", the unique name created would be "080203-smith".
    So I need to concatenate and then store.
    Any suggestions?
    Steve

    As Earlierly suggested, the Outputs PS from the ReadPropSet method does not match the fields defined in the init method.
    And One More thing as i observed
    var fileLoc = "c:example.xml"; ( As u Declared)
    should be
    var fileLoc = "c:\example.xml";
    Just Try Once :-)

Maybe you are looking for