File Name in Java Map

Hello,
I want to add the time stamp in the file name in JAVA map.
Actually we are directly writing the file on to the file system from Java map and also giving its output to other map.
So we need when we write the file on the file system the file name should be ABC_timestamp.
Can anyone help me how to do this in Java Map.
Thanks and Regards
Hemant

Hi,
>>>Actually we are directly writing the file on to the file system from Java map and also giving its output to other map.
are you sure you want to do this?
this is highly inadvisable as mappings do not support restarts and any error handling
further more what if the mapping will crash but the file will be created?
if you restart the mapping you will get a second file?
I'd recomment not doing anything like that - maybe think about your scenario once more ?
Regards,
Michal Krawczyk

Similar Messages

  • Run time exception while checking dynamic file name in mesage mapping

    Hi Experts,
    In my file to idoc scenario i need to know the file name dynamicalyy as i require this file name during mesage mapping.
    for that i have created UDF with the following code.
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    but when i am testing this code in mesage mapping in IR i am getting runtime exception.why its giving so ?
    RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:Messages/ns0:Message1/ORDERS05/IDOC/EDI_DC40/MANDT. The message is: Exception:http://java.lang.NullPointerException in class com.sap.xi.tf._MM_EDI_HospitalsToORDERS05_ method filename$com.sap.aii.mappingtool.tf3.rt.Context@545f545f
    Can we test this in message mapping itself ?
    Best Regards,
    Rohit

    One more question - I hope you didn't forget return statement in your java code.
    this worx 4 sure:
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName;

  • [RFC to File]Problem about Changing file name in message mapping.

    Hi,
    my problem:
        Type:RFC to File
        I change the file name in message mapping.
    when I call the RFC to send the data twice at the same time, both of the output file names are changed while I only want to change the second output file name.
        thanks
    Sam

    In my MM, the input values to these variables (var1, var2 and var3) are (<ZZCOMBI>array,G499999,END_FIFC0029) ,
    var1 is an array of input <ZZCOMBI> item list;
    var2 is get from a property file by call another UDF;
    var3 is constant value.
    the test input data :
    I send the data for the first time:
    - <rfc:Z_IFCFR821_ZIFCTT82100010 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <T_ZIFCTS82100010>
    - <item>
    <ZZCOMBI>G000002G000002</ZZCOMBI>
    <ZZKYKBN>*</ZZKYKBN>
    <ENAME_VE />
    <ENAME_Z5 />
    </item>
    </T_ZIFCTS82100010>
    </rfc:Z_IFCFR821_ZIFCTT82100010>
    so the input values to these variables (var1, var2 and var3) are (G000002G000002,G499999,END_FIFC0029)
    the output file name(File1) :END_FIFC002920090413-171534-053.dat
    output record: G000002G000002
    because the data what I send is the last record, the system send the dummy data for the second time by program.
    - <rfc:Z_IFCFR821_ZIFCTT82100010 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <T_ZIFCTS82100010>
    - <item>
    <ZZCOMBI>G499999</ZZCOMBI>
    <ZZKYKBN />
    <ENAME_VE />
    <ENAME_Z5 />
    </item>
    </T_ZIFCTS82100010>
    </rfc:Z_IFCFR821_ZIFCTT82100010>
    so the input values to these variables (var1, var2 and var3) are (G499999,G499999,END_FIFC0029)
    the output file name(File2) :END_FIFC002920090413-171533-928.dat
    output record: G499999
    I find that File2(20090413-171533-928) was ouput before File1(20090413-171534-053 ) from the time stamp.
    I am not sure about that "XI will create a message ID for each message and the messages are independent." as you mentioned above.
    Best regards
    Sam
    Edited by: YONGHE ZHOU on Apr 15, 2009 3:59 AM

  • Accessing a File in a Java Mapping

    Hi,
    I am accessing one Random Access File through Java Mapping Program. This is working fine in Eclipse.
    But when I imported that jar file to IR, it is throwing FileNotFound Exception while trying to test through Interface Mapping.
    Actually it is not showing any error message but by research I understood that. Can any one please help me in this regard?
    One more thing, I used the same scenario for other interface. It is working fine.
    Please help me to chase this mistery.
    Thanks,
    Yogi.

    Hi,
    I think I am giving relative path only not direct path. I am just mentioning the path from my proj name. I am not specifying any local directories. For your Information, I am mentioning the path like below:
    "ProjectName/SomeName/File_Name.txt"
    Thanks,
    Yogi.

  • ** How to get Source File Name thru XSLT Mapping

    Hi friends,
    We require source file name after message processing (SXMB_MONI) in the output structure.  We understad from Forums and  blog 2664, this is possible thru UDF - DynamicConfiguration class. This UDF will work if we use message mapping. But, in our case we are using XSLT mapping. So, how do we call  the same from Java Pacakage ? (Imported Archives). For writing java class separately, what are the changes to be made in the program?
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return ourSourceFileName;
    Kindly reply, friends.
    Kind Regards,
    Jeg P.

    Hi,
    This is the example in this similar manner u have to call the method in which u have to write the code for picking the source file name.
    <name>
       <xsl:if test="function-available('javamap:concat')">
        <xsl:value-of select="javamap:concat($first, $last, $inputparam)"/>
       </xsl:if>
      </name>
    for reference check the Link,
    http://help.sap.com/saphelp_nw04s/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
    Regards,
    Phani

  • Get the file name using XSLT mapping

    Hi
    How to get the file Name at receiver side using XSLT mapping.
    Could any one please help me
    Regards
    sowmya

    Sowmya
    If you will use Grpahical Mesage Mapping then this can be achieved using Adapter-Specific Attribute u201CFileNameu201D
    http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
    Code Snippet -->
    DynamicConfiguration conf = (DynamicConfiguration) container
    .getTransformationParameters()
    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
    u201Chttp://sap.com/xi/XI/System/Fileu201D,
    u201CFileNameu201D);
    But in case you have to ONLY use XSLT mapping then I would suggest to use the same jave code & call it from your XSLT mapping. I never tried such thing you might use couple of jar files too.
    - lalit -

  • File to Idoc : Java Mapping

    Hi Experts,
    The scenario is file to idoc. In the file i'll be getting name,value pairs. For ex:
    Structure is
    MT
    ....Root(1..unbounded)
    ............Name
    ............Value
    File contains:
    Vishal....1
    Raj.........2
    RFC......10
    Rahul.....20
    Azhar....15 and so on..
    I need to loop through the file. When Name="RFC", I need to make an RFC call with Value as it's input. RFC returns 4 values which will be used for mapping.
    Then I need to continue looping through the file. On encountering a particular Name, I need to map corresponding Value to target field.
    For this, I should have 2 mappings. One to read the file and the other for mapping. I've never used RFC and Java mapping, Can someone provide me a link or a solution for this?
    Thanks,
    Vishal

    Hi,
    You can do this using a UDF.
    first let the source message contain first line and last line which you want to eliminate.
    change the context of the Value to MT ..
    start a for loop in UDF ignoring first & last line like
    for(int i = 1; i< input.length() - 1; i++)  // here i = 1 & not zero  & input length is -1 so that first & last field eliminates
           //carry on string operation to separate name & value on delimeter space
    String name = input<i>.subString(0,.... to the indexOf space);
    //similar for value also....
    now you have name & value
    check for name == 0052
    if(name == 0052)
      perform rfc lookup
    else

  • How to specify relative path for file name in java class

    I have a directory structure like this.
    C:\Aurora\com\optemys\aurora\validation
    I have a class Test.java under the validation folder.
    I have various files under the same folder i.e validation.
    If I want to access the file "test.properties" in Test.java, how can I just specify "test.properties" & not "C:\Aurora\com\optemys\aurora\validation\test.properties".
    I dont want to hardcode any file path into the class. How can I specify the relative file name into the class.
    Thanks In Advance
    Sachin

    switch the name in Test.properties and use
    this.getClass().getResourceAsStream(fileName)

  • Setting File Name inside ABAP mapping

    Hello All,
    We have a requirement where we need to send the IDOC in a flat file format to the destination system which we are doing inside an ABAP mapping. Now we need to set the file name depending on a particular field in the IDOC. For this we need to use the DynamicConfigurationKey class inside our ABAP mapping.
    Can anyone throw some light how to access these Adapter-Specific Attributes inside ABAP mapping?
    Thanks
    Abinash

    guess this is the one
    Re: Abap mapping and variable substitution in File adapter

  • How to get File name in Java Callout

    Hi,
    We are receiving EDI files with random file names through SFTP listening channel. How can we get the file name in the java callout.
    ~Ismail M

    You can try to find it out under CalloutMessage.
    CalloutMessage.getParameters().getProperty("filename")
    Thanks,
    Kathar

  • ATTRIBUTE_IDOC_METADEATA Error: File  to IDOC Java Mapping

    I have done a Java Mapping from File to Idoc and I get the following error in sxmb_moni:
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
    <SAP:Category>XIAdapter</SAP:Category>
    <SAP:Code area="IDOC_ADAPTER">ATTRIBUTE_IDOC_METADATA</SAP:Code>
    <SAP:P1>I::000</SAP:P1>
    <SAP:P2 />
    <SAP:P3 />
    <SAP:P4 />
    <SAP:AdditionalText />
    <SAP:ApplicationFaultMessage namespace="" />
    <SAP:Stack>Fehler: I::000</SAP:Stack>
    <SAP:Retry>M</SAP:Retry>
    </SAP:Error>
    The Idoc structure that I generate in my mapping makes no fullfil of the IDOC tags.
    For example:
    <IDOC BEGIN="1">
                   <EDI_DC40 SEGMENT="1">
                        <TABNAM/>
                        <MANDT/>
                        <DOCNUM/>
                        <DOCREL/>
                        <STATUS/>
                        <DIRECT/>
                        <OUTMOD/>
                        <EXPRSS/>
                        <TEST/>
                        <IDCOTYP/>
                        <CIMTYP/>
                        <MESTYP/>
                        <MESCOD/>
                        <MESFCT/>
                        <STD/>
                        <STDVRS/>
                        <STDMES/>
                        <SNDPOR/>
                        <SNDPRT/>
                        <SNDPFC/>
                        <SNDPRN/>
                        <SNDSAD/>
                        <SNDLAD/>
                        <RCVPOR/>
                        <RCVPRT/>
                        <RCVPFC/>
                        <RCVPRN/>
                        <RCVSAD/>
                        <RCVLAD/>
                        <CREDAT/>
                        <CRETIM/>
                        <REFINT/>
                        <REFGRP/>
                        <REFMES/>
                        <ARCKEY/>
                        <SERIAL/>
                   </EDI_DC40>
    Should I complete these values in my mapping program?
    Which values should I complete?
    Thank You.

    Antonio,
    you can ignore whole EDIDC Segement make disabled in our mapping still it works . but the problem is not with this is our meta data chekc in IDX2 t/c code of XI box.
          it has some problem the strcuture you generate and R/3 accepts are not same their is mismatch in structure
    Regards
    Sreeram.G.Reddy
    Message was edited by:
            Sreeram Reddy

  • Retrieval of the column name in Java Mapping

    Hi All
    I am presently working on JAVA mapping which retrives the data construct the xml I want to dynamically generate the xml tag name (table column names of the Table) is there any way to do it
    Thanks
    Jayaraman

    Hi,
    You can get column names from database tables as...
    ResultSet resultSet=statement.executeQuery("select * from table");
    resultSetMetadata=resultSet.getMetaData();
    String col1 = resultSetMetadata.getColumnLabel(1);  ---> to get first column name
    and use in XML node creation as...
    Document document = DocumentHelper.createDocument();
    Element root = document.addElement("Root");
    Element Node1 = document.addElement(col1);
    Regards,
    Uma

  • Determine Target directory from Source file names with out mapping

    Hi All,
    I have a requirement to determine the Target Directories from the Source file names.
    File Sender Adapter - XI - File Receiver Adapter
    In this scenario I am not doing any mapping. Source File directory contain 3 files. These file should go to 3 directories in the Target Server.
    Please help me how can meet this requirement
    Thanks in advance
    Kevin

    Hi Kevin,
    if you can separate the files by name. have 3 sender communication channels each picking up one of the files (you do this by making the regex in the file name mutually exclusive) and then send them all to the target system using the same comm. channel.
    regards,
    Horia

  • Resolving file names from java package

    Hello Everyone,
    I was wondering if there is a way to get the names of all the java classes inside of a package from my app. What I would like it to do, is to read the names of the classes in the package, and then use reflection to create an instance of each. At the moment, I have a properties file that contains all the class names. The app reads the file and uses reflection to create an object of each. This is not as good for me because i would rather be able to drop a new class into the package and have it work instead of having to edit the properties file first.
    So, is it possible get the list of files that are contained in a package?
    Thanks,
    Bryan Campbell

    So, is it possible get the list of files that are
    contained in a package?No, but why not let the application scan a folder?
    Kaj

  • Getting a file name using java.io.file

    Dear List,
    I am having problems using java.io package. I am reading a string on a linux tomcat server. I am
    trying to parse a windows type filepath (passed by a web-browser-client) and get only the filename. ie. sample.jpg.
    fileName = "c:\\temp\\sample.jpg"
    java.io.File file = new File(fileName);
    onlyFileName = file.getName();
    remember this on linux, and on my server onlyFileName contains "c:\\temp\\sample.jpg" and not sample.jpg as I would expect.
    can any one tell me what I (yet again) dont understand.? Strangely enough when the server is on windows and I am passing a linux string with the fileseperator as a forward-slash, the code manages to derive the correct filename.
    regards
    Ben

    Post this to the beginners forum - has nothing to do
    with native methods.Apologies I thought Java.io would be "native".
    sorry,
    BB

Maybe you are looking for

  • Messages stuck in AQ

    DB version: Oracle Database 10g Enterprise Edition Release 10.1.0.3.1 A small number of messages stuck in a queue table when our messaging system load is high. The 'state' column has value '3' in all these rows. What does that mean ? Why they are stu

  • How to create a dynamic tag in MII

    Hi  , I want to repeat this item tag for different segments and for each segment the <SEGNAM> will be changing and <SDATA> i am fetching from DB. Is there any way to make this item tag a dynamic tag. so that i will use the same item tag for different

  • Problem with esign - just changed Adobe DC ID

    Everything was working fine on ipad and iphone for esign and Pro DC. Then I needed to change my email for the esign to use. So I changed by Adobe User ID to the email I need to use from now on out. Once I have verified the email and logged back in th

  • Volume curve for multiple tracks?

    I'm just learning to score films with GarageBand. My first snag is that I want to be able to adjust volume curves on multiple tracks without affecting the audio track of the movie. Is this possible? It's kind of a bother to have to create control poi

  • Create Materialized View Failure

    I'm trying to create a materialized view on a database on my local laptop, and when I execute the create it fails with the following error: ORA-06550: line 1, column 60: PLS-00103: Encountered the symbol ".16" when expecting one of the following: . (