on 11-06-2014 6:04 AM
Hi,
I want to use a shell script in the file sender CC before processing section.
The script will be used to add a prefix (i.e. "SubDivision_") in the files located in a ftp path and then it will be picked using Sender CC as SubVivision*.
This is first time I am using shell script.
Is there any step by step document for this. I had some doubt -
1) where the script should put. In FTP or in PI server . If in PI server then what should be the path.
2) what is the format to put the script in CC with path details.
3) Any additional configuration is required for this .
Please help.
Did you execute the script in putty? check if script works there. if you have done this please ignore this reply.
then you can come to PI and test it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Apu,
The 'Execute OS command before message processing' will execute only if the file is already picked up by the sender communication channel. So you can't rename the file at first and pick the file using the new name.
I would like to know the exact requirement you are having as only renaming all the file names adding same prefix won't serve anything.
Suman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for prompt reply.
Done some mistake in telling my requirement.
Actually my requirement is I need to pick a xml file and before processing it I need to delete and add some lines in the xml file and then I need to process it and after processing I need to add a prefix in the file name so that I can understand that the file is processed.
Actually, my client is not allowing to archive the file in different folder after processing . For this reason I need to add some prefix to give provision to my CC to pick the same file next time.
A quick solution may be you can archive in the same folder adding timestamp.
If you want to use shell script, you may put the .sh file in the PI server. Be sure that your server is running on UNIX Operating System. Otherwise you need to write batch file.
Your user need to have 'SAP_XI_CONFIG_FILE_OS_CMD_J2EE' role to write anything in 'Execute OS command before/after message processing'.
You may follow the links for your reference :
SAP XI File Adapter OS Command Line Feature - Process Integration - SCN Wiki
Defining Operating System Commands Before/After Processing - Advanced Adapter Engine - SAP Library
Hi Suman,
I have written the following in the after processing section
/usr/sap/tmp/rename.sh
Command in script :
#!/bin/sh
for f in *.txt;
do mv "$f" "Processed_$f";
done;
But In CC monitoring I can see the message
2014-11-06 17:23:41 | Information | Execute OS command "/usr/sap/tmp/rename.sh" |
2014-11-06 17:23:41 | Information | The message was successfully retrieved from the send queue |
2014-11-06 17:23:41 | Warning | Error executing OS command "/usr/sap/tmp/rename.sh" |
Could you please guide me where It is stucked? Also when I am trying to assign the role SAP_XI_CONFIG_FILE_OS_CMD_J2EE to the username its saying no such role exist.
Are you using JAVA only installation?Then you should be able to find that role in JAVA UME.
Path: http://host:port/useradmin
Tell you basis guy to assign that role to your user.
I don't have much idea about shell script. But I guess you need to use chmod 755 to change mode and give full permission. Is it working if you try to run directly in OS?
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.