cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file name using reciver file adpater if no Mapping involved

Former Member
0 Kudos

Hi XI/PI experts,

I am working on one scenerion where I have to poll the files from one server and send them to target FTP server with no content conversion( no Mapping involved).

for example:

if the source file is ABC_Invoice_item.csv

then the target file is expected as invoice_YYYYMMDD.csv

Please advise how we can acchive this?

Many Thanks in advance for your valuable inputs.

Cheers,

Mohan

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

thanks all for ur help.

closing thread.

Former Member
0 Kudos

chk this:

http://wiki.sdn.sap.com/wiki/display/Snippets/DynamicfilenameinaFiletoFilepassthroughscenario

RaghuVamseedhar
Active Contributor
0 Kudos

Hi Mohan Arya,

Please check my reponse in this thread [Link|].

Regards,

Raghu_Vamsee

Former Member
0 Kudos

Hi All,

if there are 4 files from sender at the same time with diffrent files names and same have to sent to Target system with diffrent file names. So can we put condition in one java mapping or we need to do java mapping for all four files. do we need one sender channel and 1 reciver channel or 4 sender chanel and 4 reciver channel?

Please advise.

thanks.

peter_wallner2
Active Contributor
0 Kudos

Hello Mohan,

Did you try the Java mapping that Raghu Vamsee pointed out under

?

If you use that it does not matter how many files you get. If you get 4 files you use 1 sender and 1 receiver channel. And that Java mapping will name the 4 files the way you need it.

Best regards,

Peter

Former Member
0 Kudos

One sender channel and 1 receiver channel. The Java mapping should handle the filename change.

For example, use a switch case in your java map to deal with the different filenames that can be encountered.

Regards

Former Member
0 Kudos

Hi,

I have to create the target file name with the first character of the source file name,

like source file is Order.txt - target should be order_20110609.txt

Invoice.txt target should be invoice_20110609.txt

I tried that with if else condition but its not working.

Could you please let me know how we can write the the code for this in java

many thanks.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Mohan,

it seems you are using PI server as file transfer agent. If I have understood your requirements correctly then

1. There is no mapping involved

2. no FCC required

3. change in filename of target file by adding a timestamp.

All this can be achieved by shell scripts.

The scripts will transfer the file using sftp.

You can also rename them using mv command and use of shell variables.

By this method you can prevent overloading of PI server.

regards

Anupam

Former Member
0 Kudos

Hi,

If you need to keep a dynamic part of your source filename in the receiver, since the source and target filenames differ, you will need to use mapping to populate the filename in adapter specific attributes.

If you don't want to use any mapping, the only other alternative would be to write a custom adapter module where you populate the filename dynamically.

Otherwise, as per your example, if the receiver filename format is Invoice_YYYYMMDD.csv, you can simply use File Construction mode as "Add Time Stamp" in the receiver file adapter

Regards

Former Member
0 Kudos

Hi,

Thanks for the response.

is there any other alternative except to go for adapter module.

and if we have 4 files with diffrent names then how the file channel will find the correct file. do we need to configure 4 comm channel for the same?

since it is file pass through ( no structure given , no mapping involved), how we can achive this requirement.

Please advise.

Many Thanks.

Cheers,

Mohan

peter_wallner2
Active Contributor
0 Kudos

Hello,

Couldn't you use this functionality:

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

And you leave out step 3 of course. Then you just keep the original filename.

Best regards,

Peter

Former Member
0 Kudos

If you need to keep only a part of the original filename, which itself is not constant, then you would need to go for either a mapping or adapter module.

To pick up 4 different files, if these are the only files in the particular directory, you can simply define filename as * in the sender adapter.

If this is not the case and there are other files in the directory that should not be retrieved, you can use the option Advanced Selection for Source File to define additional filenames that will be picked by the same comm channel.

Regards

Former Member
0 Kudos

Hi Peter,

its file pass through. we have to transfer the files from one location to another. there is no mapping involved.

could you please advise any other alternative.

thanks.

cheers,

Mohan

Former Member
0 Kudos

Hi,

as u advised mapping can be used, since there is no structure given here, do we have to use the dummy mapping ?

will it work?

Many Thanks.

Former Member
0 Kudos

hi,

Please also refer these blogs :-

/people/stefan.grube/blog/2009/06/19/unknown-use-case-of-dynamicconfigurationbean-store-file-name-to-jms-header-without-mapping

/people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean

Regards,

Ninu

peter_wallner2
Active Contributor
0 Kudos

Hello Mohan,

the problem with my solution is is that the whole filename is kept.

But you only need a part of the filename, e.g. "invoice".

I also think the only possibility is what Shiladitya Sarkar already suggested.

Best regards,

Peter

Former Member
0 Kudos

Hi,

You can refer the following link for selecting additional files using a single comm channel :

http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/692ab8a4b633eae10000000a1553f6/content.htm

You can also use a Java mapping instead of adapter module to store the filename dynamically in the message header. In this case, use a data type that has just one field under it. Use the same data type for both sender and receiver.

In your Java mapping, use the code for dynamic configuration to retrieve the sender filename, alter it and then store it in the message header again for use by the receiver adapter.

No changes will be required in the sender comm channel. There will not be any conversion to xml format and the data will pass through as is.

Regards