cancel
Showing results for 
Search instead for 
Did you mean: 

Shell script in File sender CC

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Muniyappan
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi,

Its already tested in putty and its working fine there.

Muniyappan
Active Contributor
0 Kudos

can you paste your os command here?


i never worked on scripts . but i believe command should be something like below.

sh /usr/sap/tmp/rename.sh (your input to script)

suman_saha
Contributor
0 Kudos

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

Former Member
0 Kudos

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.

suman_saha
Contributor
0 Kudos

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'.

Former Member
0 Kudos

Hi,

Thanks a lot for your response.

When I am trying to add the role you have mentioned its saying role does not exist.what can be the possible reason.

One more thing, Can I put the script in any path of al11 in my pi server.

Former Member
0 Kudos

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:41InformationExecute OS command "/usr/sap/tmp/rename.sh"
2014-11-06 17:23:41InformationThe message was successfully retrieved from the send queue
2014-11-06 17:23:41WarningError 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.

suman_saha
Contributor
0 Kudos

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?