cancel
Showing results for 
Search instead for 
Did you mean: 

How to save the file without time stamp in receiver file adapter.

Bhargavakrishna
Active Contributor
0 Kudos

Dear All,

we have a requirement, where the file should be saved with date, without time stamp.

im using PI 7.3 ehp1, i have used file construction mode as ADD Time Stamp. as we know, it will save the file in YYYYMMDD HH:MM:SS format.

so how can i save the file with date.?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use dynamic configuration:

DynamicConfiguration conf = (DynamicConfiguration) container

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

var_Filename = conf.get(key) + date in desired format;

conf.put(key, var_Filename);

Regards,

Beena

Former Member
0 Kudos

Hi,

Try the below code.

DynamicConfiguration conf = (DynamicConfiguration) container 

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");

//get current date

Date date = new Date( );

var_Filename = conf.get(key) + dateFormat.format(date);

conf.put(key, var_Filename);

Thanks,

Satish

Answers (3)

Answers (3)

Bhargavakrishna
Active Contributor
0 Kudos

Hi all,

thanks for the inputs..

with the help of this website http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=272171407

i have used variable substitution, it is showing the error as var1 is not found in message payload.Inline image 3

Former Member
0 Kudos

Hi Bhargav,

In variable substituion while delcaring var1 which path you have used.  You should have to use target path.

If you use source path it will give the error.

Thanks,

Satish.

Former Member
0 Kudos

Hi,

You can achieve your requirement in 3 ways.

1)Dynamic configuration UDF.

2)Custom module in receiver file adapter.

3)OS based command in receiver file adapter.

1)If you are doing any transformation in PI .then choose this option.You can use the code provided by satish.

2)If you are not using any transformation then go with 2nd option.

3)I would recommend not to choose this option as this has some constraints(NFS,Need to make sure no body should delete script file,OS dependent...etc)

Regards

Venkat

Bhargavakrishna
Active Contributor
0 Kudos

Hi venkat,

Thank you very much..

Former Member
0 Kudos

Hello,

U have to use DC UDF for the same.

Thanks

Amit Srivastava