cancel
Showing results for 
Search instead for 
Did you mean: 

File Adapter: Dynamic file name

Former Member
0 Kudos

Hello,

I would like to use a filename like this:

Name.<DOCNUM>.Direction.<Timestamp>

For DOCNUM I use variable substitution. Works fine.

For <Timestamp> I need a different format as the timestamp function

in file adapter create. So I try to set up my timestamp in mapping like

dynamic file name:

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

conf.put(key1, a);

Input a is date function which creates my desired timestamp format. In file adapter I try this:

Name.%DOCNUM%.Direction.%Timestamp%

or

Name.%DOCNUM%.Direction.Timestamp

or

Timestamp

all doesn't work for Timestamp.

So is there a possibility to configure a dynamic filename like this???

Is there a possibility to access dynamic configuration variables in dynamic filename except

the known for filename and directory??

thanks

chris

Edited by: Christian Riekenberg on Mar 10, 2009 4:02 PM

Edited by: Christian Riekenberg on Mar 10, 2009 4:05 PM

Accepted Solutions (1)

Accepted Solutions (1)

VijayKonam
Active Contributor
0 Kudos

I dont think there is a TImestamp variable available. You can populate the timestamp field in the mapping by calling Java DateTime (something like that) package functions.

VJ

Answers (4)

Answers (4)

former_member216353
Participant
0 Kudos

Hi Christian,

You achieve all this in Dynamic configuration itself.

Write a small udf to set the file name in the mapping using dynamic configuration variable "FileName"

Pass your other paramerters - DOCNUM, DIRECTION, DATA (use a small java date function to get date in your desired format) as input to the above udf.

Let me know if you need any more details.

Regards,

Younus

Former Member
0 Kudos

Ok, did it with dynamic configuration. I don't like it, because I have to look into mapping if I would like to see the filename in detail.

thanks to all.

jyothi_anagani
Active Contributor
0 Kudos

Hi,

check this link

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

No need to go for UDF--Dynamic configuration...

Just check Adapter specific attributes in both communication channels and give File Construction mode as ADD TIME STAMP

Now You will get like %dynamicfilename%timestamp for example source file is input then your target file is input20090312-173817-187.txt like this

thanks

Shabarish_Nair
Active Contributor
0 Kudos

your file name needs to be

Name.<DOCNUM>.Direction.<Timestamp>

dont use variable substitution. use only dynamic configuration and set the file name

introduce a logic that will create the string

Name.<DOCNUM>.Direction.<Timestamp>

eg. String filename = "Name" + var_docnum + "Direction" + var_timestamp;

then use the dynamic conf code to set the file name and use adapter specific properties in you adapter to retrieve it.

Ref:

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

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

siddhesh_pathak4
Contributor
0 Kudos

Use the UDF while mapping,

String DATE_FORMAT_NOW = "yyyyMMddHHmmssSSS";

   Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
    return sdf.format(cal.getTime());

Concat this with your File name and pass to "DynamicConfig".

You just need to import

java.text.SimpleDateFormat

Let me know if you have any problem.

Filename UDF -> DynamicCofig -> Node

Former Member
0 Kudos

@Siddhesh Pathak

I can also create the required format by using the standard function currentDate in mapping.

The problem is, that I don't want to use the dynamic Filename. But there seems no other way

to do this.

Shabarish_Nair
Active Contributor
0 Kudos

note:

you cannot combine both dynamic configuration and variable substitution in the same scenario to get the result. either go only for the variable substitution or dynamic configuration

siddhesh_pathak4
Contributor
0 Kudos

Ohh.. ok I thought you need the time in other format...Sorry about that.. but yes as per my knowledge there is no other way...

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

My speculation is that the dynamic configuration cannot access the time stamp. However you requirement is much possible, rather than trying to assign the time-stamp dynamically in the mapping use the Standard Date function currentDate with the format as yyyyMMdd-HHmmss-SSS ( same as the timestamp of the file adapter) and map it.Refer to this element in the variable substitution like Name.%DOCNUM%.Direction.%Timestamp%.

Thanks,

SaNv...

Former Member
0 Kudos

@ Sãnthosh Kûmãr V

Also think about this possibility, but I'm not able to use a field on my own. So I have to discuss if there is any empty field I can use for this.

thanks

chris