Using unix script (perl) copyoutboundfile
Hi guru,
I want to copy a file from a directory origin to directory destination.
The script copyoutboundfile use parameter $sourcesid and $targetid.
How i progmammed it in abap .
I defined a unix command name Z_TRANS_FILE to execute the script in SM69 .
How i pass the parameters if i use this function ?
or do you have other solution ?
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = unix_command
additional_parameters = params
IMPORTING
status = return_code
TABLES
exec_protocol = tabl
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14.
Thanks in advance
Soufiene
Re: Running a batch file kept on the server
FM ''SXPG_COMMAND_EXECUTE"
Using of SXPG_COMMAND_EXECUTE Function Module.
Similar Messages
-
Call a Java API using Unix Script
Hi SDNers,
I want to call a Java API using Unix Script. Please suggest what will be the commands in Unix.
Please help!!
Thanks,
Priti
Edited by: Priti Rani Patnaik on Jul 7, 2010 4:17 PMHi
Try this
String[] cmd = {"/bin/sh", "-c", "ls > hello"};
Runtime.getRuntime().exec(cmd);
[Other Help|/thread/5425832 [original link is broken];
BR
Satish Kumar -
How to load abap ztable using unix script
Hi Experts,
I want to upload the data from excel sheet into abap ztable using unix script. If possible give me a sample coding for this..
Regards,
vijayhi vijay see the code below
REPORT YFTP1 .
FTP by abap.
This program passses host, user, source/target
directory and file parameters to a UNIX script which
in turn gets the required file from the host by ftp.
The unix script should look like this:
#! /bin/sh
ftp -n $1 << !!
user $2 $3
cd .. <-- only for mainframe ftp
get $4 $5
quit
placed in the adm path, preferably under
/sapmnt//exe. In order to make this program
work please create sapcpic/manager cpic user and
apply note no. 41770.
PARAMETERS: HOST(10) OBLIGATORY LOWER CASE,
USER(8) OBLIGATORY LOWER CASE,
PASSWORD(8) OBLIGATORY LOWER CASE,
SRC_FILE(45) OBLIGATORY LOWER CASE,
TRG_FILE(45) DEFAULT '/usr/sap/trans/data/??????' OBLIGATORY LOWER CASE,
BIN AS CHECKBOX.
DATA: JC(8), FLG(1), B(128), PRNAME(128), LOGFILE(30), AAA(40).
DATA: BEGIN OF A,
1(12), 2(10), 3(10), 4(47), 5(47),
END OF A.
IF HOST = 'zxaq'.
IF BIN = 'X'.
PRNAME = 'ftp_bin_vms'.
ELSE.
PRNAME = 'ftp_asc_vms'.
ENDIF.
ELSE.
IF BIN = 'X'.
PRNAME = '/usr/sap/trans/bin/ftp_bin_unix'.
ELSE.
PRNAME = '/usr/sap/trans/bin/ftp_asc_unix'.
ENDIF.
ENDIF.
A-1 = HOST.
A-2 = USER.
A-3 = PASSWORD.
A-4 = SRC_FILE.
A-5 = TRG_FILE.
CONDENSE A.
B = A.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = 'FTP'
IMPORTING
JOBCOUNT = JC.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
AUTHCKNAM = SY-UNAME
EXTPGM_NAME = PRNAME
EXTPGM_PARAM = B
EXTPGM_SYSTEM = 'jupiter'
JOBCOUNT = JC
JOBNAME = 'FTP'.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = JC
JOBNAME = 'FTP'
STRTIMMED = 'X'
TARGETSYSTEM = 'jupiter'
IMPORTING
JOB_WAS_RELEASED = FLG.
LOGFILE = '/tmp/ftp.log'.
DO.
OPEN DATASET LOGFILE FOR INPUT IN TEXT MODE.
IF SY-SUBRC = 0. EXIT. ENDIF.
ENDDO.
DO.
READ DATASET LOGFILE INTO AAA.
IF SY-SUBRC = 0. WRITE / AAA. ENDIF.
IF AAA = 'FTP completed'. EXIT. ENDIF.
ENDDO.
CLOSE DATASET LOGFILE.
delete dataset logfile.
now the file is in the application server which you can upload in your internal table and update the database table....
thnkx
bhanu -
File port query File transfer from SAP R/3 to Webmethods using Unix Script
SAP drops the files in the /sapio/ directory and triggers an unix script using File port partner destination.
Unix script will perform a secure copy of files to Webmethods server.
If in unix script, error occurs then an RFC function will be called to send an error notification to a person.
Queries
1) How is the unix script triggered using the File port partner destination ?
2) What is the unix command to invoke a report which sends the error notification mail ?
3) Does SCP command to copy files to webmethods work , if the unix script is placed in /sapio/ directory ? Or whether
any connection need to be established between SAP and Webmethods server ?Hello,
Since you want to transfer Article Master, it should be a Retail System. So you should use Message Type ARTMAS. For fullbuild, you can use transaction WDBM and for changes, you can use WDBU. For changes, you can enable change pointers for required fields using BD64.
Thanks,
Venu -
Changing the filenames using unix script
Hi,
I have a scenario where I have to change the file names on the Receiver CC using a unix script and add date and timestamp to the file name
this is what I'll be writing to filename_01.xml I need to change that to newfilename_01_MMDDYYYY_HHMISS.xml
the 01 in the file name is the counter, so I might having more than one file where 01,02, etc will represent the counter on the filename.
Any help is really appreciated.
Thanks,
Joe.Pyou can try this
create the field called filename in target
use a costant and concat it with the out out of UDF( or some functon avaleiable counter) which will genereate numbers like 1,2,3,4,5,6 and send this filename_01 to the output field and use this in the variable substution to genreate the filename by the CC
if you dnt want to send this fieldin output file then specify that fieldname in CC length as 0 -
How to call pakage using Unix script
Hi,
I have created one package in Oracle(contains2 funcation and 4 procedure) which is in in xxx14database.
Now i can execute the package and its working fine at database level.
As per requirement ,i need to create on Unix script to trigger the package.
I have no idea how to create the Unix script to execute the package.
The Unix script need to created in xxxx001 Server.
Can anyone please let me know the template or any link which I can refer to create the same.
Or anyway i can create a script/batch on window and test first in my laptop and use the same script for my project work with required modification
Secondly the application owner asked me to give them both database and Unix script to them so that their database team will test the Package which i developed.
Database script meand the Package body and spec i should save as file.pkb format and send them or i can save them in .sql file and send them
Thanking you all in advance please help its urgent.Now that you know how to do it ... reconsider whether doing so is a good idea.
There is almost nothing you can do calling from a shell script that can't be done more easily from DBMS_SCHEDULER other than compromise security. Shell scripts connecting to the database are, as shown in the demo code, inherently insecure and, if you get enough of them, make it difficult to cycle passwords on a regular basis. -
I'm creating ACH file using program RFPNFC00 which goes and stores in the application server. I need to ping this file from application server to FTP for which i wanna know which one is the best way to do is that with FM CALL FUNCTION 'FTP_CONNECT' or shall i ask the Unix guy to write a small script to ping the file from app server to FTP.
Basically can anyone lemme know the advantages and disadvantages of Unix script and ABAP code to ping the file to FTP.
Regards
VENk@Venkat,
it depends on the security-configuration in your company.
If you're authorized use SAP-FTP -> look sample program RSFTP004
hope that helps
Andreas -
Trigger ABAP program using UNIX script
Hi All,
I want to trigger an Abap program whenever a unix file comes to SAP.
Can any1 please tellme how to write a unix script to trigger the ABAP program.
Thanks in advance.you will need to create a batch job in SM37 for the ABAP program, and use an event for the start criteria.
The event can be created in SM62
Then in unix, you will need to call an executable SAPEVT.
This will be in the directory /usr/sap/<SAPSID>/SYS/exe/run
you will need to use the appropriate profile for the SAP system to run the sapevt utility.
example :-
sapevt abap_event -t pf=/usr/sap/<SID>/SYS/profile/<SID>_DVEBMGS00_<SYSNAME> nr=00 -
Drop user package using Unix script
Hi,
When I run this script, I get an error :
#!/bin/ksh
echo
echo '==== DROP AND RE-CREATE ALL TEST PACKAGES ===='
echo '# After executing this script with 'y' option execute test.sql'
echo
echo 'Do you want to drop and re-create test packages ? (y/n)'
echo '# rtrvCondTest.pkb'
echo '# ex2_test3.pkb'
read ans
if [[ "$ans" = "y" ]]; then
echo 'Rebuilding all.... '
sqlplus -s / <<-eof
set heading off
set echo off
set serveroutput on
DROP PACKAGE rtrvCondTest
DROP PACKAGE ex2_test3
START rtrvCondTest.pkb
START ex2_test3.pkb
eof
fi
exit 0$ ./rebuildAll.ks
==== DROP AND RE-CREATE ALL TEST PACKAGES ====
# After executing this script with y option execute test.sql
Do you want to drop and re-create test packages ? (y/n)
# rtrvCondTest.pkb
# ex2_test3.pkb
n
./rebuildAll.ks[10]: syntax error at line 13 : `<<' unmatched
How do I get this script to work??
Any help is appreciated.
Thanks
Sharaththere should be no space left to eof
Regards
Laurent Schneider
OCM-DBA -
Insert into a table using UNIX
i have file Summary.txt
contants looks like this
./log_CS-185.lst:Error detected, rollbacking
./log_CS-13603.lst:Error detected, rollbacking
./log_CS-1002.lst:Error detected, rollbacking
now i have to parse this file to get (CS-185,CS-13603,CS-1002)
and insert these vlaues into a table... how do i do this using unix script ?..i have to parse this file to get (CS-185,CS-13603,CS-1002)
and insert these vlaues into a table... how do i do this using unix script ?..Example :$ cat read_Sum.sh
cat Summary.txt | while read LINE
do
VAR=`echo $LINE | awk -F_ '{print $2}' | awk -F. '{print $1}'`
echo $VAR
sqlplus -s test/test << EOF
insert into summary values('$VAR');
exit
EOF
done
$ ./read_Sum.sh
CS-185
1 row created.
CS-13603
1 row created.
CS-1002
1 row created.
$ sqlplus test/test
SQL*Plus: Release 10.2.0.3.0 - Production on Thu May 19 13:32:40 2011
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from summary;
CODE
CS-185
CS-13603
CS-1002
SQL> -
Using Unix tools with Oracle on Windows
I currently have an Oracle database installed on Windows, but would like to use Unix scripting tools and commands when connecting with my database.
Can anyone advise a good way to configure my system so that I can connect to my database from a Unix-like system?
Thanks in advance!If getting a unix like system installed is not feasible (or is not an option), use this:
http://cygwin.com/
http://www.cygwin.com/mirrors.html
This is not exactly like running unix tools against the Oracle db, but allows you access to unix type shell for almost all of your unix shell scripting needs.
Message was edited by:
Kamal Kishore -
How to Run a text files using UNIX
Hi,
I have 10 text files in my project my task is to load all the text files data into Relational Database so i can use sql*loader to load all the text files data into a Database.
but the thing is another project i have 200 text files so i need to run these text files using UNIX script could anyone tell me how to load all the text files using UNIX
Thank's
Edited by: Lavanya on Sep 5, 2012 3:09 PMLavanya,
This question relates to shell scripting and in IMO it is not an oracle question.
I have made some initial assumptions before my proposed solution.
PLEASE note that this is untested, but can just guide you as a template for solving your problem.
Assuming that you have properly set up the control file and mapped each and every table in it as per the file information which you have..
Assuming the text file to be in the format of : ------ (as suggested by other posters earlier, this file holds instructions about the file and table mapping which shall be used by your sqlldr process.)
tmp.txt:
text_file_1-------------should goes to----customer_info_table
text_file_2------------should goes to------customer_address_table
text_file_3-----------should goes to-------customer_order_table
while read line
do
SQLLDR CONTROL=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.ctl,
LOG=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.log,
BAD=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.bad,
DATA=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.txt
USERID=scott/tiger
done <tmp.txtAll I am trying to run from the above shell script is : -- PLEASE TEST it if it matches your requirement.
SQLLDR CONTROL=text_file_1.ctl, LOG=text_file_1.log, BAD=text_file_1.bad, DATA=text_file_1.txt USERID=scott/tiger
SQLLDR CONTROL=text_file_2.ctl, LOG=text_file_2.log, BAD=text_file_2.bad, DATA=text_file_2.txt USERID=scott/tiger
SQLLDR CONTROL=text_file_3.ctl, LOG=text_file_3.log, BAD=text_file_3.bad, DATA=text_file_3.txt USERID=scott/tigerRepeating my assumptions, I assume you have all those files required for SQLLDR process to run (ctl file, data file...)
Cheers,
Manik -
How to submit a batch compare job using a unix script and cron?
I understand I can setup a unix script to be used to schedule a database compare job. I'm not sure how to get past the popup log in window tho... When I use the command line and include the -id<myid> the OMS login window pops up requesting login password and service. This won't do if I do not want to run this interactive. I cannot find any syntax for the command line other than --id<adminid> How to I include the password and service?
Thanks ;)
LaurieI had the same problem.
My shell looks like (baseline_ELITE.sh):
ocm login -idsysman
ocm capture -l BL_ELITE -idsysman
I don't have the ocm logout.
First, run the baseline_ELITE.sh, it will ask you about the password. The next times, it never ask again for the password, but take in account don't use the ocm logout.
Humberto Gomez
OCP Dev2k, 8i, 9i
[email protected] -
Sending email attachments using unix shell script
hi
I want to send report generated my spooled file as attachment using unix shell script.
Can somebody help me out ?
many thanksthanks a tonn it worked.
but i have another issue is it possible to add names in CC also ?
Also here is my code which spools the output of SP to a txt file. the File name is generated dynamically.
as shown below:
I need to send this generated file as attachement.
how do I do this? Here the shell script
=========================================================
#!/bin/sh
ORA_USER=scott
ORA_PWD=tiger
#Get the input parameter
if [ ! "$1" ]; then
STR="NULL"
else
STR="'"$1"'"
fi
#echo "exec pkg1($STR);"
#Connecting to oracle
sqlplus -s <<EOF
$ORA_USER/$[email protected]
---sql plus enviornment settings
set linesize 160
set pagesize 60
set serveroutput on size 1000000 for wra
set feedback off
set termout off
column dcol new_value mydate noprint
select to_char(sysdate,'YYYYMMDDHH24MISS') dcol from dual;
spool &mydate.report.txt
exec pkg1($STR);
spool off
EOF
exit
=========================================================
the file name will take sysdate as name so that every time a new file will be generated.
this file I need to send as attachment.
null -
How to run script file ( unix script file like ksh or sh file) using Java
How to run script file ( unix script file like ksh or sh file) using Java Program?.
I am using the following code snippet to run the simple commands like top or ls ,etc....
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("top");
Thanks In Adavance
-SivaString [] { "ksh" , "-c" , "script", "arg 1", "arg 2", "arg 3"}
Maybe you are looking for
-
How do I remove ios 8 and restore ios 7
I recently installed ios8 onto an iphone 5. the phone stalls all the time facebook will not open. Battery life wasnt good before but is now about two hours. I can see lots of people saying problems and wanting to go back to ios 7 but general opinion
-
Installing OS 10.5.4 On a 17" iMac intel
Hi, I have an 17" iMac intel that had 10.4.11 installed on it. I am trying to install 10.5.4. I got to the Language screen , selected English. Hit continue. A window popped up stating, "This software cannot be installed on this computer." With OK and
-
Urgent Internal Harddrive question
Hey I have a Power Mac G5 Dual 2.3 i bought a second drive, a Seagate 300 gb internal drive that says on the package that it works with macs however, the ribbon cable types are different!!! am I doing something wrong?? This is a Ultra ATA/100 7200 RP
-
Service PO Net Price is zero , Alternative calculation
Hi, While creating/updating the Service Purchase Order at Item level the Net Value is not zero ( we have some alternative calculations in Item level) but in header details we have zero . Why in header details Net Value don't sum up all Net Values of
-
UNDO Retention on 10.2.0.2
We are noticing some of these snapshot too old errors 01555 errors and we are not making use of any of the flashback functionality so I believe we are only interested in the undo table keeping the undo data while the transaction itself is active to e