append TimeStamp

Helllo guys,

i have a very simple requirement yet it is very hard and difficult for me because i am new to java.

I have interface developed in SAP business Connector, however in the flow i am using a SavePipelineToFile builtin service,so the file is getting created in the operating system.
my requirement is i need to append a time stamp to that file name. becauase if i don’t append a timestamp.then every time the file will be over writen. :frowning:

plz plz tell me how to append a timestamp to the file and if i need a java server…then please tell me the code and all the steps for that as i am very new to java
Thanks

There is no need of new java code.

Before your savepipelinetofile, you can call the service “WmPublic/pub.date:getCurrentDateString” with the parameter “pattern” at “ddMMyyyyHHmmssSSS” (in order to have a string representing the date & time)

Then add in the parameter “fileName” of the savepipeline the string that the getCurrentDateString have just created(surrounded with “%” and don’t forget to check the “Perform Variable substitution”).

use the above suggested solution, thats the simplest approach.

-nD

It sounds like you may be using savePipelineToFile as part of the integration solution. I would recommend against that. That service is intended primarily as a debugging aid.

Thanks Aloooot arnaudW it works perfectly :slight_smile:

really thanks for your prompt help.

reamon what do u suggest instead of using savePipelineToFile? although it is used generally for debugging but for my scenario it does the work…is there and standard flow service that save the message coming from other system rather than saving the whole pipeline? in my case i need to save evey file coming to SAP BC before processing and that’s why i wanted to append the timestamp to it…so it is not for further processing but of course it would be greate if i can save only the message not the whole pipeline…if you have any solution please tell me what is it.

however for now my problem got solved and many thanks for you arnaud and devexpert. :slight_smile:

I strongly agree on Robs advise against savePipelineToFile, beside (or because) being for debugging only it write the complete pipeline ad runtime, so the outcome is not guaranteed and it may containg data unwanted in the file.

If you need to write a file, you should write small Java service for this (eaxample to be found in PSUtilities), please look into

[URL]wmusers.com

for details where Rob and me already posted about this.