How can i run the shell script from ABAP programming language

Thank you DGPicket for the reply. I should not ask you the same question again and again but should be becuase since i am a fresher with this shell script, and not aware of much, is it possible for you to send me the SCP code(practical code)? it would be highly appreciated.

Man Page for scp (All Section 0) - The UNIX and Linux Forums
Sorry about the width, but this web site goes beserk with some symbols, in code space, where it is supposed to butt out:

scp user1@host1:relative_or_full_path_of_source_files_or_dirs  [ user2@host2:relative_or_full_path_of_source_files_or_dirs . . . ] user_t@host_t:relative_or_full_path_of_target files_or_dirs

Much like cp, mv, rcp:

  • You can move one item(subtree) and change the entry name(top dir name) in the process.
  • if the target is a dir, you can have many sources: different user or host or path.
  • if the target is a dir, you can move whole subtrees with -r. For repeatability, it is best to move subtrees, without renaming, to either an absolute path or a target that will be the parent dir. Else, there can be target/source/ and target/source/source/ ! For instance, "scp /usr/local/bin xxxx:/usr/local" or "cd /usr/local ; scp bin xxxx:/usr/local". No matter how often you run it, you will not create xxxx:/usr/local/bin/bin/ like a repeat of "cd /usr/local ; scp bin xxxx:/usr/local/bin".
  • you can be on a different host altogether from sources and target!
  • has -p to preserve timestamps, ownership and permissions (but it can make problems if different user or group, source to target).
  • -C or similar adds compression, also nice for the network and for big move speed or multiple parallel copies, especially if the sending side is CPU rich. For real speed freaks with slow networks, I achieve the same effect as scp -C using more CPUs and my coice of compression with:
    text find ... | cpio -oaH crc | bzip2 -9 |ssh that_host 'bunzip2 | cpio -idmH crc '
    Then, I have a dumb demux tool xdemux.c or dumux.c to allow dividing the file list for N parallel runs (I like 2 x sending system CPU count, extras are OK as they deal with imbalance), but sometimes ssh gets sick from too much pressure on startup or too many sessions. On a secure network you can use rsh/remsh and save the encrypton costs:
    text find ... | xdemux 8 "cpio -oaH crc | bzip2 -9 |ssh that_host 'bunzip2 | cpio -idmH crc ' "

Thanks for the code. I followed the same and made this code

#!/bin/bash
dir=/usr/sap/nxa/comm/interface/fico/
scp fico@share.dteenergy.com:'get_file*'$dir
for I in $dir/get_file.*
   mv $I $dir/get_file_123${I#get_file}.csv
done
uuencode $dir/get_file_123.csv $dir/get_file_123.csv.mail | mail -s "get_file_123.csv" venkat@yahoo.com; rama@yahoo.com; 
rm $dir/get_file*

Looks like the space before scp target got lost, but that's the idea.

Why "ftp bla bla bla mget bla bla bla" when you can scp on one line?

Using ksh on systems like Solaris with /dev/fd/[0-9]* or bash <(...) or >(...), or on systems like Solaris with /dev/fd/[0-9]* using /dev/stdin or /dev/stdout, you can even scp from or to a named pipe and pipe the data to/from your process in real time.

"ftp bla bla bla mget bla bla bla" this is the one you asking with the previous code?

space before scp target got lost - i did not get you..

it is a script to automize the file transfer & send mail process.

Using ksh on systems like Solaris with /dev/fd/[0-9]* or bash <(...) or >(...), or on systems like Solaris with /dev/fd/[0-9]* using /dev/stdin or /dev/stdout, you can even scp from or to a named pipe and pipe the data to/from your process in real time.

yes we have many options to minimize the process.

scp source target 
scp fico@share.dteenergy.com:'get_file*'$dir 

maybe should be (without hypertexting and underlining from web site:

scp fico@share.dteenergy.com:'get_file*'  $dir

Also, '...' are overkill as the host: stifles local globbing. I like to " around $var, though, in case they develop white space or emptiness:

scp fico@share.dteenergy.com:get_file* "$dir"

Keep it simple, and you can make more complex things work!

I hate:

  1. temp and intermediate files,
  2. file name collisions,
  3. complicated file names,
  4. running out of disk space,
  5. extra latency,
  6. underutilized CPUs

and so I love all sorts of pipes.

yes the single ' can be overkill but shouldn't hurt. The " around $DIR should be fine(might be better if a path contains blanks anyway).

also, in stead of a password, you suggested me to use a private/public key pair (SSH - keygen). i am stucked here. i read the man page and understand but i am blank face(?) because not able to understanding how to use these expressions in my script? if possible, plz suggest me how could i do it? Thanks

You can find articles all over, including here, on getting ssh started. Get ssh2 if you can. Some sort of ssh keygen will give you nice big tough keys. Do not put a password in the keys, or you are back in the same kettle with better security. Make sure the permissions are right on the .ssh/.ssh2 dir, wherever it is. Here, it is not in $HOME because it is a mounted NFS disk. Get the local host name to work for "ssh host_name pwd". Once you get that ssh to work paswordless, if you copy the .ssh/.ssh2 dir to a remote host using scp -rp with a password once interactively, you will be passwordless to that host, give or take an initial save of host keys.

Hi DGPickett,

Hope everything is fine with you. Regarding the solution you provided me, getting a severe error like

"
Authenticated with partial success. Permission denied, please try again. Permission denied, please try again. Permission denied (). /usr/sap/NXA/COMM/interface/FICO/script1.sh: line 5: syntax error near unexpected token `mv'
/usr/sap/NXA/COMM/interface/FICO/script1.sh: line 5: ` mv $i $dir/ota_uta${i#ota}.csv'
External program terminated with exit code 2

"

Could you plz help me that how to resolve this issue? expecting from others too if anybody can. Thank you