Dynamic Filename in global container

Hi,
I want to get filename dynamically and I have standard function
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String sourceFileName = conf.get(key);
I want to put this code in java functions and I had put and I am getting error as
cannot resolve symbol symbol : variable container
Can you please help me on this?
B

Hi Harleen,
Even I had a simlar Probem I used this UDF
public void DynamicFilename(String[] a,String[] b,ResultList result,Container container){
  //write your code here
AbstractTrace trace = container.getTrace();
String strDirectory=" ";
String strFileName="";
try
     Map map= container.getTransformationParameters();
     //This is for generating the file Direcotry Dynamically
     DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get
(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
     DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "Directory");
     DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File",
"FileName");
strDirectory= "/fms/PPM/S3";
strFileName= b[0] + b[2] + b[1]+ ".XML";
trace.addWarning("strDirectory " +strFileName);     
conf.put(key, strDirectory);
conf.put(key1, strFileName);
result.addValue(b[0]);
catch(Exception ex)
trace.addWarning("Catch Block " );

Similar Messages

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

  • Dynamic Filename in Fileadapter

    Hi all,
    I like to use the new feature (SP15) of the "Adapter Specific Message Properties" but with out success. I have read Michaels Blog "XI: The same filename from a sender to a receiver file adapter - SP14" but it give me not a clue how to use these properties during the normal receiver configuration and also the manual is not very clear about it. I have set a Variable with "FileName    message:FileName" (I have tried also "message:File_Name") Than I have used this filename Variable in the field "Filename Schema" like %FileName%. But I allways got this error: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: Unknown message header category 'FileName' for variable 'FileName'.
    What have I missed out here?
    Thankx
    Manfred Schmidt-Voigt

    Hi Manfred,
    The dynamic filename generation concept is as follows.
    In your filename field. just give a variable with % symbols. (eg: %file% ).
    Now, under the option Variable Name Substitution, you can give how the value has to be created.
    It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.
    For the former, your give
    message:interface_name ,etc
    and for the payload part you give,
    Payload: "your element root which u wanna acecss"
    Just check this link out,
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    And read the contents under variable substitution and it will help you understand the concepts better.
    If you have any clarifications, do get back,
    Regards,
    Bhavesh

  • Dynamic filename in XI

    Hi,
    In XI SP12 is possible to use dynamic filename? I need to generate a filename in Adapter using the content of an element in message, how I do it?
    thanks.

    Hi Elton,
    The dynamic filename generation concept is as follows.
    In your filename field. just give a variable with % symbols. (eg: %file% ).
    Now, under the option Variable Name Substitution, you can give how the value has to be created.
    It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.
    For the former, your give
    message:interface_name ,etc
    and for the payload part you give,
    Payload: "your element root which u wanna acecss"
    Just check this link out,
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    And read the contents under variable substitution and it will help you understand the concepts better.
    If you have any clarifications, do get back,
    Regards,
    Bhavesh

  • Dynamic filename in receiver AS2 adapter in B2B Add-on

    Hello Experts,
    Can you please let me know how we can put dynamic filename in the receiver AS2 adapter for B2B Addon on SAP 7.4.
    Thanks
    Saurabh

    Hi Ryan / Experts,
    Let me explain you in more detail.
    In the receiver AS2 Communication channel, if I keep the Filename field as blank as shown below, then in the Mendelson inbox folder, a file is generated with the name "ASJAVA_DX5" which is my business component name.
    If I fill the filname field for example with "CONTRL", then in the Mendelson inbox folder, a file is generated with the name "CONTRL".
    This is my requirement because, suppose i trigger this interface "first time", a file with static name (ASJAVA_DX5/CONTRL ) would be generated in the inbox folder. If I trigger this interface "second time", since the file already exists with same name, it is not overwritten and I cannot check the output of 2nd trigger . Contents are not overwritten.
    To solve this problem + as a general requirement, I wish to have this name to be dynamic, atleast with date+timestamp.
    Can you please help.

  • Dynamic Filename in BPM process (SOAP with attachm. and PayloadSwapBean)

    Hello together
    I have the following BPM process:
    1. IDoc=>WebServiceRequest
    2. WebServiceResponse (payload) => IDoc
    3. WebServiceResponse (attachment) => File
    XI receivs an IDoc an map it to an WebService. The Webservice is called by XI and we receive the WebServiceResponse including a PDF attachment.
    The challenge is to store the PDF attachment with a dynamic filename from the payload of WebServiceResponse.
    We use the PayloadSwapBean to change the payload to the PDF attachment. But then we are not able to access the required information on the original WebService-XML-Response via variable substitution.
    Is there a solution in the standard or have we to use a custom adapter module?
    Thx
    manuku

    Hi Jayasimha,
    We can do this by "Adapter Specific Message Properties" of ur comunication channels.
    1.If u want to keep the output filename same as input filename, no need to use the UDF. only the 'adapter specific parameters' in both sender n receiver file adapter will do that.
    In case if u want to get the filename inside our mapping we have to create a user defined function
    which will return the filename and map it to one of our XML tags. 2nd point gives solution 4 that:
    2. If u want to generate an output file taking some input from the payload,then u hav to use the UDF.There u hav to populate the name.
    Pretty much.... if you set an attribute from the sender side, for example, you can use a UDF and access the particular attribute sent and use it in the mapping. In another example, where no attributes are sent from the sender, you can still actually set a particular attribute, say a filename derived from the payload, using a UDF, and enable the receiver attribute to use it. That's where the UDFs come in - either to get or set particular adapter specific message attributes.
    This will be a very helpful blog which solves ur query:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Regards,
    Vinod.

  • How to embed views dynamically in a view container ?

    Hi ,
        Can you please guide me how to embed a view dynamically in a view container ?
    Thanks & Regards
    Gaurav Jain

    Hello,
    Please read this [/people/rajagopal.vemuri/blog/2006/09/19/web-dynpro-for-abap-creating-dynamic-ui-elements-and-context-step-by-step].
    Regards.

  • FTP how to pass dynamic filename/directory location - reading a file in 11g

    Hi All,
    We r using FTP adapter(SOA 11g) for getting files in remote server, May i know how to pass dynamic filename and directory where the file exists for reading in server.
    Thanks,
    Rak

    Hey according to my understanding, the Dynamic partner links are set only for the Outbound invocations only. Is my understanding right? if so, how do we create the dynamic partnerlinks for the ftp get kind of stuff...??
    Thanks in advance

  • Dynamic filename configuration via custom EJB

    Hi Experts,
                        We are doing a poc on whether we can do the dynamic filename configuration,i.e. set the file name dynamically in a custom EJB deployed on the server and called in the sender comm. channel of any J2EE based adapter.
    The requirement is for some interfaces, there is no mapping requirement other then setting the filename dynamically, which maybe based on a certain value of the input file or a specific portion of string in the payload.
    The custom EJB takes the namespace and attribute as input parameters along with other string manupulation parameters to determine the receiver file name. That is if we are using sender JMS adapter, we can have namespace = http://sap.com/xi/XI/System/JMS and attribute as DCJMSMessageProperty1. The bean would read the value and perform the manipulation based on certain other input parameters and set the file.
    There is one particular bean : AF_Modules/DynamicConfigurationBean but it does not allow us to manipulate the filename.
    Any help would be much appreciated.
    Regards,
    Shiladitya

    Hi,
    please refer to the following links for your reference
    Re: Reading Dynamic Configuration information in side adapter module.
    Re: Dynamic Filename in File adapter
    Regards,
    Bhanu

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

  • ABAP mapping split messages and dynamic filename

    Hello,
    i have set up a IDOC to file scenario where the IDOC is split into several files, which works fine. In addition to this it is required to set a dynamic filename out of the ABAP mapping for each file. If only one file is created this works already as well but how do you set the dynamic configuration when the messages are split?
    Regards,
    Andreas
    Edited by: Andreas on Feb 26, 2009 9:09 AM

    you cannot do dynamic configuration for message splits. The below is from SAP help.
    Adapter-Specific Attributes and Multi-Mappings
    In multi-mappings, there are multiple message headers with adapter-specific attributes. The mapping API can only access one message header. This has the following consequences depending on whether there are multiple source or target messages:
    u25CF     1:n Transformation
    If there are multiple target messages, the header for the adapter-specific attributes is copied for each message. This means that you can only create one header for all adapter-specific attributes, and not individual headers.
    u25CF     n:1 Transformation
    This variant is only possible for multi-mappings in integration processes. If there is more than one source message, read-access to the adapter-specific attributes of the various message headers is not possible at runtime.
    u25CF     m:n Transformation
    All afore-mentioned restrictions apply here. Developers can at most write the same adapter-specific attributes for all target messages to the header, without read-access to the attributes of the source messages. m:n transformations are only supported within integration processes.
    What i will suggest is to use BPM to have the message split i.e 1:N mapping and then after that have another mapping 1-1 to have the dynamic configuration

  • How to pass dynamic filename to Receiver JMS channel

    Hi experts,
    I want to pass the dynamic filename to receiver JMS message Properties.
    for example
    I am passing directory name via adapter module AF_Modules/DynamicConfigurationBean with key and value combination like below. How to pass dynamic filename value to a dynamic property ( say DCJMSMessageProperty1)
    eg.
    key.0 - >insert http://sap.com/xi/XI/System/JMS DCJMSMessageProperty0
    value.0 - >  testdirectory ( which is static value)
    Note: Im have not created any ESR object . i just have to bypass the file to a jms queue. I have used AAE integrated configuration scenario ( file to jms )
    Regards,
    Balaji
    Edited by: Balaji Pichaimuthu on Jan 27, 2011 4:45 PM
    Edited by: Balaji Pichaimuthu on Jan 27, 2011 4:46 PM

    Already given link for the dynamic configuration code snippet in the earlier reply... Below is the code snippet
    Note: Use Adapter Specific Message Attributes for the target Communication Channel(CC).Check the indicator for filename in the advanced tab of CC
    //UDF code
    String filename="";
    String NameSpace = "http:/"+"/sap.com/xi/XI/System/JMS";
    try{
          DynamicConfiguration conf = (DynamicConfiguration) param.get(
            StreamTransformationConstants.DYNAMIC_CONFIGURATION);
          DynamicConfigurationKey key  =  DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File",   "FileName");
           // read filename value
           filename = conf.get(key);     
          // So far we extracted filename value .. now do your logic  something like this...
          DynamicConfigurationKey key2 = DynamicConfigurationKey.create(NameSpace,"yourjmsvalue goes here");
           conf.put(key2,filename);
         } catch(Exception e){

  • Java Message Mapping : Dynamic FileName and Directory for ASMA

    How to Put Dynamic FileName and Directory for ASMA Properties of File Receiver adapter in Java Message Mapping ???
    I know How to Do this in UDF , But In Java Type Message Mapping . How to do this ????
    Regards
    PS.

    Hi
    chk this:
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=95093307
    Thanks
    Amit

  • Global Container

    Hi all,
    I am trying to understand the concept of Global Container.
    i have referred to the following blog by Michal
    <a href="/people/michal.krawczyk2/blog/2005/03/04/globalcontainer--in-graphical-mapping-xi:///people/michal.krawczyk2/blog/2005/03/04/globalcontainer--in-graphical-mapping-xi
    I have created the Second UDF 'getContainer'.
    But, while testing I am getting the following error:
    RuntimeException in Message-Mapping transformation: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_TEST_IN_ method getContainer$[]
    Code that i am writing in getContainer is as follows:
    <b>GlobalContainer globalContainer = container.getGlobalContainer();
    String[] b = (String[]) globalContainer.getParameter("our_number");
    for (int i=0; i<b.length; i++)
    result.addValue(b<i>);
    }</b>
    getContainer function does not have any input parameters.
    Kindly, provide me some guidance about where am I getting wrong.
    Thanks & Regards,
    Nilima Rodrigues

    Hi Nilima,
    Hi Nilima,
       //write your code here
    GlobalContainer globalContainer1 = container.getGlobalContainer();
    String[] b = (String[]) globalContainer1.getParameter("our_number");
    String str_result = "";
    if( (b != null)  ) {
      int a1 = Integer.parseInt(b[0]);
      int cnt = Integer.parseInt(counter);
      int ans = a1;
      str_result = String.valueOf(ans);
    return  str_result;
    Note counter is a arguement for value based...
    Map Now like this
    use COUNTER standard function --> UDF getContainer --> then target field..
    this will work..
    regards,
    sridhar
    Message was edited by:
            sridhar reddy kondam

  • Call ABAP program from Unix script passing dynamic filename

    Hi,
    Does anyone know if it is possible to call an ABAP program from a Unix script passing a dynamic filename to the ABAP program?
    We are receiving a file from an external company and on receipt of the file want to call an ABAP program passing the filename.  The filename is made up of File ID, Date and Time which we need to read in the ABAP program.  We usually use Events to trigger a program which is fine when the filename if static however since this filename will be dynamic we cannot do this.  In addition we cannot just rename the file to a static name in the Unix script as we need to know the value of the date and time from the file ID in the ABAP program.  I can change the ABAP program to check our /in directory for a Filename that starts with the fixed File ID however I thought there must be a better way of doing this.  We want the external company to put this information in a file header record but they don't want to change the file contents.  Any ideas would be appreciated.
    Thanks,
    Sinead.

    You could follow the following method
    1.Let the external file reside in the SAP application layer in a defined path e.g. /usr/sap/tmp/interface/working/
    2.Write an ABAP program which will include the following steps:-
       i) read all files in the file path using function module EPS_GET_DIRECTORY_LISTING
      ii) Read the data from files existing in the directory using OPEN_DATASET statement
    iii) After the files have been read move the files to another directory e.g. /usr/sap/tmp/interface/backup/ or you can delete the file.
    3.Schedule this program to be executed depending on the frequency of the external file being generated.

Maybe you are looking for