How can i run the shell script from ABAP programming language


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can i run the shell script from ABAP programming language
# 1  
Old 06-01-2011
How can i run the shell script from ABAP programming language

I am in need to execute the Files transferring's shell script from ABAP programming language. it would be highly appreciated if you help me as quickly as possible. Thank you
# 2  
Old 06-01-2011
# 3  
Old 06-02-2011
Hi, Thank you for sending me the link. I just followed the process as per the link that you sent it to me. I have my SAP on UNIX and it doesnt have a ZSHELL Command but there is a other command ZTELNET which was created by a ECC guys for their purpose. plz let me know your idea that i can create a command like zshell and use it for the configuration purpose? Thank you

Last edited by Venkat1818; 06-22-2011 at 04:00 PM..
# 4  
Old 06-02-2011
# 5  
Old 06-17-2011
How are you buddy? Again buzzing you for another doubt...
i was told to drop the flat file and script file in the same (Ex: /usr/sap/xxx/comm/interface/FI/CO)directory in application server.
My question is:
Is it a good idea to drop the shell script and moving the test file to the same directory in application server?
Because i need to load the flat file from the same directory to SAP BI?
and again i need to execute my ABAP program to run the shell script for transfer the file from FTP server to the same directory in Application server.
If i keep the flat file and shell script in one directory, would i get any problem in going forward? like security/permissions or any conflicts between this etc? also, if you had experienced any of the other problems then plz share with me. Thank you.
# 6  
Old 06-17-2011
Quote:
Originally Posted by Venkat1818
How are you buddy? Again buzzing you for another doubt...
i was told to drop the flat file and script file in the same (Ex: /usr/sap/xxx/comm/interface/FI/CO)directory in application server.
It doesn't matter where the file is at all as long as the user running the script can read it.
Quote:
Is it a good idea to drop the shell script and moving the test file to the same directory in application server?
You can control file and directory permissions individually, so just having them in the same directory isn't necessarily a security problem. What permissions the files and directory are set to, and who can read or modify them, is more important.

Just dumping them all in the same dir may not be the most organized way to do it either, though.
Quote:
Because i need to load the flat file from the same directory to SAP BI?
Without seeing this script I'm not sure, but it's quite possible it'll either accept it from anywhere or can be modified to do so.
# 7  
Old 06-17-2011
Please see the below script. also, plz suggest me if that is the proper order, if so, would it work for all of my requirements like connecting to FTP server(windows) and sending it to application server (linux), then converting the file from .xls into .csv and finally sending a email with the file attachment to the user. It would be higly appreciated if you can help me. also plz suggest me how i can give you the points if any points could be assigned to your help. Thank you again.
Code:
#!/usr/bin/expect -f
# SETUP MY ENVIRONMENT
set force_conservative 0; 
# set to 1 to force conservative mode even if script wasn’t run (# # # )
# Conservatively originally.
If {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
# CONNECT TO FTP SERVER. After connecting, we can view the flat file #on main page itself. FYI.. It is not put under some folder in the FTP #server.
Set timeout -1
spawn $env(SHELL)
match_max 100000
send -- "sftp FICO@ABC.YAHOO.com\r"
expect -exact "Connecting to ABC.YAHOO.com...\r
FICO@ABC.YAHOO.com's password: "
send -- "ABC123\r"
expect -exact "\r
sftp> "
# COMMANDS TO EXECUTE
# FOR MOVING THE FILE FROM THE ABOVE connected server (FTP Server)
send -- "mget GET_FILE* /usr/sap/NXA/COMM/interface/FICO/"
expect -exact "mget GET_FILE* /usr/sap/NXA/COMM/interface/FICO/”
Send -- "\r"
expect -exact "\r
sftp> "
# FOR CONVERTING THE FILE FROM .XLS TO .CSV
send –- “for I in GET_FILE.*\r”
expect –exact “for I in GET_FILE.*\r”
send –- “do mv $i GET_FILE_123${i#GET_FILE}.csv\r”
expect –exact “do mv $i GET_FILE_123${i#GET_FILE}.csv\r”
send –- “done\r”
expect –exact “done\r”
send –- “\r”
expect –exact “\r
sftp> “
# SEND AN EMAIL TO THE PARTICULAR USER THAT FILE HAS BEEN MOVED #TO THE /usr/sap/NXA/COMM/interface/FICO/. PLZ SEE THE DIRECTORY.
send -- "uuencode GET_FILE_123.CSV GET_FILE_123.CSV.MAIL | mail -s "GET_FILE_123.CSV" VENKAT@yahoo.com\r"
expect -exact "uuencode GET_FILE_123.CSV GET_FILE_123.CSV.MAIL | mail -s "GET_FILE_123.CSV" VENKAT@yahoo.com\r"
send –- “\r”
expect –exact “\r
sftp> “
# SHOULD REMOVE THE FILE FROM FTP SERVER AFTER MOVED TO THE #APPLICATION SERVER
send -- "rm GET_FILE*"
expect -exact "rm GET_FILE*"
send -- "\r"
expect -exact "\r
sftp> "
send -- "bye\r"
expect -exact "bye\r"
send -- "exit\r"
expect eof


Last edited by Scott; 06-17-2011 at 07:04 PM.. Reason: Please indent your code and use code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

3. Programming

How is a new Web Development language written ?

I'm wondering how programmers develop new Web Development languages because I want to learn how everything begins from the start. Let's say I'm planning to write a new language for the Web. How do I do this? Is there anyone who knows about the way Web Development languages first appear ? I'm... (3 Replies)
Discussion started by: Anna Hussie
3 Replies

4. UNIX for Dummies Questions & Answers

Is PERL a programming language?

I need a small and simple clarification... Can someone tell me whether PERL is a programming language or not. Also, can shell scripts also considered as programming language or not. Also, please tell me the exact difference between programming language and scripting. Please help.... (3 Replies)
Discussion started by: Anjan1
3 Replies

5. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

6. Programming

c programming language

Can someone enligten me on what below program does? I understand getchar and putchar.. but what is this program suppose to do? I try to put printf on it, but it shows nothing.. can someone explain to me what this program is suppose to do? It is reading something and assigning to c? so, if... (8 Replies)
Discussion started by: convenientstore
8 Replies

7. UNIX for Dummies Questions & Answers

Does the programming language matters?

I see you guys encouraged people studied and used C while they were working on UNIX. Does C++ or JAVA matter? And in the past threads, Neo, PxT, and other members recommanded lots good books. I think those people who asked for the references, such as Dominic, had experiences on sys admin or... (8 Replies)
Discussion started by: HOUSCOUS
8 Replies
Login or Register to Ask a Question