Run operating system command for sender File adpter (NFS)
Hi All,
iam doing a file to RFC scenario, using 'Run operating system command' in sender file adapter to change the file name while archiving (after processing completed).
I mention OS command like this:
sample_server\scripts\Test\Rename.bat"
Rename.bat file calls a 'perl script' code.
when i run interface, could see below statement in adapter log ->
"Execute OS command "
sample_server\scripts\Test\Rename.bat"
but the script was not run and file name was not changed.
Please advice what could be the problem?
Does this mean script executed successfully?
Do i need install perl software on XI server, even perl script (.bat file) is executing on sample_server?
Thanks in advance..
Regards,
Rajesh
Hi,
Just check the following URL and give it a try again :-
Executing Unix shell script using Operating System Command in XI
Hope this info Helps..
Regards,
Aditya
Similar Messages
-
Run Operating Systems command.
Hi Experts,
Please provide information on Run Operating Systems commands for File adapter.
I have gone through t he below mentioned link already:
[http://help.sap.com/saphelp_nw04s/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm]
Also , please provide links for OS commands whch can be used for windows OS.
thanks,
NehaHi Neha,
pls do chk this linkfor windows OS commands
http://webtools.live2support.com/windows/
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/sapXIFileAdapterOSCommandLine+Feature
An interesting usage of Variable Substitution in XI
Solution to the problem encountered using Variable Substitution with XI-SP12
Copy a file with same filename using XI
thanx
Sampath
Edited by: venkata sampath on Jul 8, 2008 7:20 AM -
File Receiver Adapter:Run Operating System COmmand after message Processig:
Dear All,
I have gone through this link
[http://help.sap.com/saphelp_nw2004s/helpdata/EN/e3/94007075cae04f930cc4c034e411e1/content.htm]
But i have a problem.
In the scenario which we have, File name is DYNAMICALLY GENERATED by a UDF
I want to call the file at run time after message processing via Command Line and execute some os commands.
But since the file name is Dynamic....How will i call the file at run time in Command Line:
SYNTAX: %f(FileName)
How will i specify the file name in the above syntax as the file name is Dynamic and not constatnt.
Please Advice.
Senthilprakash.Dear All,
Yes just now i got the answer from this thread[OS command line script - Need help;
Actually i have another doubt now
In REVEIVER FILE ADAPTER:
when we give Run Operating system Command After Message processing
does the OS command get executed after the output file is placed in the Receiver folder/server or before its placed in the receiver folder?
Regards,
Senthilprakash. -
RUN OPERATING SYSTEM COMMAND BEFORE MESSAGE PROCESSING
hi.
just i want to know what is the purpose of run operating system command before message processing,after message processing under file sender adapter.
waiting for your great answer.
bye.
regards.
seeta ram.Hello Seeta,
let me see if I give it using a simple scenario that I implamented : i nedd to transfer a very large file from one server to the other by XI.
to save space and network traffic I use an OS command before picking up the file to run a zip command to zip the file.
after I transfer the file to the target server I run another OS command after the transfer to unzip the file.
now to your second question:
the before Os command on the target server is used mostly for checks (make sure there isn't a file by that name or backing up existing data)
and the after sender OS command is usualy for backing up or erasing existing files (cause it is done only after the first part was finished succesfully).
Uri Lifshitz.
p.s.
there was a blog obout this titled "XI as a huge file mover"
and you can see a description and my scripts at https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/05/03/additionaltipsforusingXIasahugefiletransfer%28withbatchscripts%29& -
Hi,
There is an urgent requirement, i want to know about Run Operating System Commands in file adapter. What are all possible commands for windows operating system? and how it works? Kindly send me your suggestions and links at the earliest.
Your help will be appreciated.
Thanks,
Sadhna.Hi,
Run Operating System Command Before/After Message Processing
● Command Line
An operating system command specified here is executed before or after the message processing of a file that was found in a run. The default value is an empty character string (no command).
When the operating system command is called, the file name currently being processed can be specified with the following placeholders:
● %f (file name)
● %F(absolute file name including path)
● Timeout (secs)
This specifies the maximum runtime of the executing program in seconds. When this time interval is exceeded, the adapter continues processing. The executing program continues to run in the background.
● Terminate Program After Timeout
Set this indicator if the adapter is to terminate the executing program when the timeout is exceeded.
The adapter writes the output (STDOUT and STDERR) for the operating system command in the system trace.
Regards,
Phani -
How to Run Operating System Command Before/After Message Processing SAP PI
Hi,
We are trying to execute multiple commands via "Operating System Command Before/After Message Processing".
When we use single command say for example cp or mv (copy or move) the commands get executed fine.
eg: cp %F /var/opt/data/outbound/Test/Dummy.txt
/this works fine/
when we club commands together or try to redirect the outputs of commands, none of the commands get executed.
eg:
cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
or
wc -l %F > /var/opt/data/outbound/Test/Dummy.txt
Is it possible to execute multiple commands or redirect the output of commands without using a shell script? The PI server we are working on iis hosted on UNIX environment.Hi Harleen,
try like this
cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
instead of semicolon try this
(1) &
command1 & command2
Execute Command1 and then execute Command2
(2) &&
command1 && command2
Runs the command2 only when command1 doesn't Complete successfully
(3) ||
command1 || command2
Runs the second command if the first command had an error
(4) ()
(command1 || command2) || (command3 & command4)
Defines the order in which commands are to be executed
Regards
Suraj -
Operating System commands for LINUX OS
Hi,
I am working on PI7.1 OS LINUX,i am clear about WINDOWS OS how to call and execute but not clear with Linux OS
Just trying one POC kind of requirement with Operating System Commands
first i started with simple requirement moving one file from one directiry to other directiory,but unfortunaltly i was not sucesfull.
the help documentation also not clear ,could you please any one give some clear clue to hoW to call shell script.
i have created below script.
#!/bin/sh cd /Interface
cat BIA1.xml >> /interfaces/BIA2.xml
http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature
thanks,
Rajhi its very simple,just copy .sh file in PI server and call just sh path.it will work
-
Regarding Run operating system command
Hi experts,
I have a requirement of creating an empty file onto the same folder where my reciever file adapter writes the result file. Is it possible in case of FTP as well or is just supported for NFS?
Regards,
AmolHi Amol,
I have no experience with scripts. But if my understanding is correct, you can achieve this. The script file to be called should be placed in your XI server. The script file will have commands to do the FTP and create file in the remote FTP server. Although I have never worked on scripts to be 100% sure. May be a person familar with scripts can give the cirrect info.
Regards,
Jai Shankar -
Wild Cards in External Operating System Commands for HP-UX
Hello,
Is it possible to use wildcards for HP-UX commands in SM69?
For example, I would think the following would work in HP-UX:
mv /directory/file_name.* /directory2
But whenever I execute a command with the * wildcard in SM69 I get the message 'No such file or directory'
Thanks,
JoelThis is wierd, I can't even do 'ls *.TRC'
Here's another example, using absolute path names that didn't work:
mv /usr/afisinw_cpafiscd/WHSE/ready/portalActivity_311688752_1243622628104.* /usr/afisinw_cpafiscd/WHSE/ready/portalActivityOld
error: cannot access: No such file or directory External program terminated with exit code 1
But when I replace the * with txt it works. Unfortuneately I need to move multiple portalActivity files each time, and the beauty of using an external command is that my ABAP program is only a few lines long.
Could there be some sort of a safety feature in SAP to prevent the use of * in external commands? -
Hi,
I want to pass UNIX operating system command for outbound FILE adapter. Is it possible to pass two parameters along with the command?
If yes, could you please send sample syntax?
Thanks & Regards
Katta Mohan ReddyHi,
but why do you want to do it in this way when SAP
gives a standard way of renaming files?
Variable Substitution
http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
it's available for sp12 but maybe it's worth to wait 1 day until your basis people install sp12 and start testing the new solution ?
I won't see the sp12 till tuesday so I cannot say if it works but it looks (from the documentation) great
BTW
can you turn on the monitoring of the folder the file adapter tries to use and check if any command is being executed at all?
Regards,
michal
Message was edited by: Michal Krawczyk -
Is it possible to call operating system command after file receive?
Hi expert,
I'm trying to call operating system command after file receive comm.channel receive a txt file.
operating system command uses txt file name as parameter.
Is it possible? How?
Thanks.Hi,
It should be possible, actually we have two options that are
1.RUN OS command before message processing
2.RUN OS command after message processing.
So you can give the commands in the RUN OS command after message processing.
Check this links for more info
http://wiki.sdn.sap.com/wiki/display/XI/SAP%20XI%20File%20Adapter%20OS%20Command%20Line%20Feature
http://help.sap.com/saphelp_nwpi71/helpdata/en/44/556cb799c93677e10000000a114a6b/content.htm
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417200)ID1690747750DB11724434094963199241End?blog=/pub/wlg/10392
Regards
Ramesh -
File adapter operating system command exit code
Hello,
If you call an operating system command in the file adapter, how is the exit code of the command handled? The documentation says nothing about this.
If I call 'true', I expect the file adapter to succeed.
If I call 'false', I expect the file adapter to fail.
Hope someone can calrify.
Best regards
/Otto FrostHi, Yes, you are rigth, it spawns a subprocess, that runs without control.
In java you use Runtime.exec().
It returns a process.
process.exitValue() returns an int.
The process is already used to terminate the process after timeout I suppose.
You would like to be able to have the fileadapter succeed or fail depending on this exitValue.
Depending on the command you execute, the exit code is different. RTFM on unix.
You would like to define which codes should be treated as success, and which ones that should be treated as failure.
true typically returns 0 and false not 0
However, a comparison command could for example return 0 for equal, -1 if the frist argument is smaller and 1 if the first argument is larger.
For the diff command, Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
Thanks
/Otto -
Operating system command in file receiver adapter
Hi,
How to use the Run Operating system command after message processing option in the parameters tab of the file receiver adapter.
I am working on a scenario wherein a batch file needs to be invoked after the file is written on the file system.
So how do i invoke this batch file from the file reciever adapter ( Run Operating system command after message processing ).Hi,
did you see this page?
http://help.sap.com/saphelp_nwpi71/helpdata/en/44/556cb799c93677e10000000a114a6b/content.htm
it shows all you need to know
Regards,
Michal KRawczyk -
Problem with zip operating system command
Hello,
i have the following configuration in the file receiver adapter:
Directory: /tmp/
File Name Scheme: %name%.txt
Variable substitution:
Variable Name: name Reference: payload: record,1,name,1
Run Operating system command:
/usr/bin/zip /tmp/%f.zip %F
The execution is succesful, but i have a small problem. The file name is "file.txt.zip", the .txt should appear but i dont know how to skip it, I have tried so many ways but it doesnt work, I should receive a file called "file.zip" With a file inside in txt format...
Thanks,
LuisHi Sriram,
Thanks, but that wouldnt work out, Im using the %f for my file name, so this move command shouldnt work for me, because my filename changes in every execution, so I cant write something like this: mv file.txt.zip file.zip
The only solution I see would would be a command which deals with strings and that could remove the four last characters of "%f"..but I havent found anything for doing it.
Regards,
Luis -
Execute external operating system command
Hi Friends,
I have a requirement to run a script file with extention '.PL' on the application server using ABAP.
i have sample how to run it in XI.
XI3.0 provides a very simple way of handling this using the "Operating System Command" in the File Adapter.
I post my output file in the following folder,
/usr/sap/sapout/test/
The shell script is available in the following path,
/usr/sap/bin/convert.pl
The figure below explains as to how we call the shell script using "Operating System Command".
File Acess parameters
Target Directory = /usr/sap/sapout/test/
File Name Scheme = TestOutput.txt
Processing Parameters
File Construction Mode = Add Time Stamp
File Type = Binary
Operating System Command = /usr/sap/bin/convert.pl %F
I have to do the same thing in ABAP as it has been done for XI as mentioned in the above example.
My operating system is UNIX.
If any one can give me a sample it would be really helpful to me.
Thanks in advance,
Arundhathi.Hi Arundhati,
You can run operating system commands from ABAP.
e.g. If you want to change UNIX right for any file, you can use following code.
lv_ucomm = 'chmod a+rwx 123.txt'.
CALL 'SYSTEM' ID 'COMMAND' FIELD lv_ucomm.
whatever command you provide in Field parameter ( lv_ucomm in the above case ), ABAP run that command at operating system level.
In your case, you can provide command in lv_ucomm to run script at operating system level.
Hope it will help you.
Regards,
Naren
Maybe you are looking for
-
F4 help for the batch field in VL02N transaction
We have upgraded our system from 4.6 to ecc 6.0 .In 4.6 the f4 help for the batch had " Batch selection via plant/Material/Storage location/Batch " which is not there in ECC 6.0. Please tell us the procedure to add in the existing search help H_MCHA
-
Delivery date grayed out in Purchase order change
Hello, We have a request to change the delivery date in the PO. While I tried to update the delivery date with the fast change, it did not update due to the delivery date field is grayed out. Please let me know how to enable this field so that I
-
Can I have some open and honest feedback on this site?
Hello everyone, I am posting to get some open / honest feedback on my site. Please feel free to comment, you will not hurt my feelings. I would rather here it from you guys, the pros and enthusiasts who do this for a living (or hobby) and who know
-
Hi, We have a negative balance in area 02 of AuC. We cannot settle that to asset as no negative values are allowed to fixed assets and we cannot change that setting too. Now we posted a manual correction entry to WBS and settled it to AuC to nullify
-
Data type determined at run time, how to provide the input type in advance
Hi all, Here I have a requirement: on my UI, there is an inputfield which receives user's input. But the data type can't be known at design time. But I need to bind a context attribute to the inputfield first at design time, which data type should I