cancel
Showing results for 
Search instead for 
Did you mean: 

How do you vary the Date/Time stamp format in File Adapters

Former Member
0 Kudos

In the receiver channel of the File Adapter where you specify the 'File Name Scheme', you do have the option of specifying a 'File Construction Mode' of 'Add Time Stamp'. How can you specify a different Date/Time stamp format ( eg MM/DD/YY vs YYYYMMDD vs MMDDYY, etc. ) without changing the Date/Time stamp for the entire SAP system? Also, can you control where the Date/Time stamp appears in the filename?

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member189519
Participant
0 Kudos

Do you mean there is a standard 'module' like timestamp feature in the file adapter?

Where can i find information about this?

Former Member
0 Kudos

Hi Bernhard,

He doesn't refer to any 'module'. He is referring to accesing adapter specific Identifiers with in mapping. Ref:<a href="/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14's wblog</a> for understanding the same.

Regards,

Jai Shankar

Former Member
0 Kudos

Hi,

There are many threads discussing the same issue. Go thro the following:

Bhavesh's reply in above thread:

You can use Adapter Specific Identifiers and then change the file name in the mapping. Append the tiem stamp in the format that you want and so on.

Just use this code in an UDF,

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

java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMdd" );

dateformat.format( new java.util.Date() );

String newfilename=SourceFileName+dateformat;

// change to new file name

conf.put(key, newfilename);

return "";

Regards,

P.Venkat

Former Member
0 Kudos
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);

java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMdd" );
dateformat.format( new java.util.Date() );

String newfilename=SourceFileName+dateformat;

// change to new file name
conf.put(key, newfilename);
return "";

Where in the mapping does this UDF go?

My target message type is as follows

MT_XML_FILE

FILEHEADER Element xsd:string

COAL Element 1..1

PRICE

DATE

FILETRAILER

Former Member
0 Kudos

Hello Chris,

unfortunately, the timestamp format is hardcoded. What you might use is the the new SP14 Adapter-specific Message Properties feature where you can set the target file name (which can consequently utilize your own date formatting convention) e.g. from a Java mapping or a module.

Regards,

Thilo