cancel
Showing results for 
Search instead for 
Did you mean: 

position of timestamp in the filename

Former Member
0 Kudos

Hello All,

I have an IDoc to multiple files scenario, for which I am using 1:n mapping, and the files are getting generated correctly.

My requirement is to create a dynamic filename which has the timestamp at a specific position in the filename.

i.e.

X_Y_ID_<b>TIMESTAMP</b>_ID1.txt

The default behaviour when generating dynamic filename using the standard functionality is it writes / appends the timestamp at the end.

Is it possible to:

1. Put the timestamp at the position as mentioned in above example?

2. Change the format of the timestamp as per specific format requirements?

Appreciate your replies.

Thanks in advance.

-- amol

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Amol

i have similar requirement, for the input file name INPUT_11_IN.TXT the output file name have to be INPUT_11_PRICE_IN_<TIMESTAMP>.TXT

how can i achieve this.

because by following jin blog /people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean, i am getting output file name as INPUT_11_IN.TXT_PRICE_<TIMESTAMP>

please help to achieve it.

Thank you,

MK

Former Member
0 Kudos

Amol,

Use variable substituion. In the message mapping just map any segment with the current timestamp using the standard function. Then use this in your filename like X_Y_ID_<var1>_ID1.txt

Expecting <var1> is the variable substitution parameter.

Regards,

---Satish

Former Member
0 Kudos

Satish,

Can not do that since the target system doesnt allow us to update structure expected by them with any such unwanted values.

-- amol

Message was edited by:

Amol Joshi

Former Member
0 Kudos

Amol,

There are two options.

1) Add timestamp to a segment or the top level structure (but not field) which is not mapped.

2) If the above is not possible then I would suggest to add one segment in the last. Then use this for Var sub. Dont write this segment in the ouput. just ignore it. (this solution is not possible if you are writing xml file)

Please check this:

/people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12

Regards,

---Satish

Former Member
0 Kudos

Hi Amol,

Check out this Michals blog..

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

Here he is reading input filename(You can sckip this part) and setting back to output with same filename..( Set with filename as per your requirement)

Hope this will help.

Nilesh

Former Member
0 Kudos

Hey

you might wanna write a UDF similar to the below help

http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm

only thing is that change the FileName attribute of ASMA to contain a Timestamp value(use Java function for this).

now the attribute FileName of ASMA will have the timestamp value in it instead of the actual Filename of the sender file,then u can simply specify the filename in receiver adapter as <i>sample%FileName%file.txt</i>

please note that the %FileName% will have timestamp inside it so your file name will have timestamp in between(or whereever you want).

Thanx

Aamir

Former Member
0 Kudos

Hey

i guess the standard Timestamp is always appended in the end,correct me if i m wrong

one option can be to use variable substitution,just get the value of timestamp in the header(so that it does not shows up in the received file) and use this to name your files dynamically.

Thanx

Aamir

Former Member
0 Kudos

how do I get the value of the timestamp from header?