cancel
Showing results for 
Search instead for 
Did you mean: 

Rename file without mapping in file/FTP channel?

Former Member
0 Kudos

Hi Gurus,

Now I have a requirement, need to pull a file from one folder with name such as "ABCDEF.dat" and push the file to destination folder with name such as "GHIJKLMN.txt".

That's a directly pass through scenario without message mapping,although i know we can do the dynamically rename task with mapping program, but here how to implement the requirement???

anyone help to guide me would be much appreciated.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

anyone can show me some script snippet about the rename function?

former_member854360
Active Contributor
0 Kudos

Hi Rajesh,

please find the Script.

You need to call this script from File Adapter.

sh /usr/sap/XX/ima/PI/Test/TestScript.sh %F

#!/bin/sh
HOST='12.11.11.11'
USER='usnername'
PASSWD='Password'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
rename $1 Afterrename.txt
quit
END_SCRIPT
exit 0

Former Member
0 Kudos

Debashish

how about a BAT script?

could you show me the same with bat script?

thanks a lot.

former_member854360
Active Contributor
0 Kudos

Hi ,

Please find batch file.

Assuminig it as NFS.

Put in communication channel text box

Input: abc.txt

output:abc.txt.jpg

cmd.exe /usr/sap/XX/ima/PI/Test/TestScript.bat %F

RENAME %1 %1.jpg

Answers (6)

Answers (6)

Former Member
0 Kudos

i am not sure whether u are willing to go for adapter modules or not...but its one of the ways of defining dynamic name in a file to file pass through scenarions...

Chk this...

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

Former Member
0 Kudos

Hi,

Create 1 SA,1 RA, 1 Sender CC and 1 Receiver CC

Create 2 component 1 for sender and another for receiver.

Create 2 CC, one Sender CC which will pick the from one folder with name "ABCDEF.dat" and another Receiver channel which will place the file in destination folder with name "GHIJKLMN.txt"

while creating SA and RA Key parameters are comm component, interface name and namespace,

While creating the SA, mention the sender Comm Component and any dummy name in both interface name and namespace and

Check the checkbox "Sender as Virtual Receiver" in SA and mention the receiver Comm component.

while creating RA, interface name and namespace same as mentioned in the SA.

This will create the scenario without mapping and will FTP the file to destination server with different filename.

Shabarish_Nair
Active Contributor
0 Kudos

refer - /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

Harish
Active Contributor
0 Kudos

Hi Rajesh,

you can give the file name in Receiver FTP communication channel if it is fixed. For dynamic filename other then timestamp you need to dynamically configure the file name.

Regards,

Harish

Former Member
0 Kudos

On the PI side, you can only do this using dynamic configuration. If you dont want to use mapping, you can try running an operational system command after the file has been sent. For example, you can save the files on a temporary FTP folder, and then send a command like "mv file file2". This takes the "file" and move to "file2" location, also changing the file name if required.

former_member854360
Active Contributor
0 Kudos

Hi Rajesh,

Please provide the logic of naming convention,

If its fixed for all the files (means same name) then you can only specify it in Receiver file adapter file name text box

as GHIJKLMN.txt

otherwise you can use varibale substitution

Or

SAP NetWeaver XI: Variable Substitution with Adapter-Specific Message Attributes via DynamicConfigurationBean

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

Processing Sequence
 
1	AF_Modules/DynamicConfigurationBean	Local Enterprise Bean	1
2	CallSapAdapter                          Local Enterprise Bean	0
 
 
Module Configuration
 
1	key.0	insert http://sap.com/xi/XI/System/File FileName
1	value.0	Hello.xml