Skip to Content
author's profile photo Former Member
Former Member

Need Time stamp like yyyymmddThhmmssGMT

Hi Friends,

i am doing file to file scenario.

i am getting file with time stamp as 20081020-062614-501.txt.

But i want Time stamp as yyyymmddThhmmssGMT.txt.

please give me replies.

Thanks

Anil M

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Oct 20, 2008 at 12:34 PM

    Hii

    You can solve this by using dynamic configuration.

    Please follow the below blog for reference.

    https://blogs.sap.com/?p=41013

    Implement the below code to achieve the same.

    Create UDF with Date(pre-defined function) as input parameter.

    Map the UDF to the root node level of the target message.

    //Get Current time

    Calendar cal =new GregorianCalendar();

    int hour = cal.get(Calendar.HOUR);

    if(cal.get(Calendar.AM_PM) != 0)

    hour+=12;

    int min=cal.get(Calendar.MINUTE);

    int sec=cal.get(Calendar.SECOND);

    String cur_time=hour""min""sec;

    //Get Input Date in the reqd format

    String Datetime= Date+""cur_time"GMT";

    //I hope file name is constant

    String Filename ="ABC";

    String extension =".txt"

    String dynaname = FilenameDatetimeextension

    DynamicConfiguration conf = (DynamicConfiguration) container

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

    DynamicConfigurationKey key = DynamicConfigurationKey.create(

    “http://sap.com/xi/XI/System/File”,

    “FileName”);

    conf.put(key,dynaname);

    return "";

    Rgds

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 20, 2008 at 01:15 PM

    You can do it with dynamic configuration option in UDF. Inside UDF, you can get the file name as it is, then change the file name as per your format.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.