Running Unix Shell Script within SAP

A short simple FTP script looks like this :-

You see, SAP looks at EXIT STATUS of shell script at the end. EXIT STATUS of 1 leads to batchjob failure (irrespective whether it was a EXTERNAL COMMAND or EXTERNAL PROGRAM). As not much shell-control is available after a FTP session is established till command "BYE", the only option is to redirect stdout (before connection, to a file) and after the session (BYE) perfom grep for certain strings (back to shell). This particular action is good reason to exit with a EXIT STATUS of non-zero. 

A short simple script looks like this 

#!/bin/sh 
ftp -n foo > success <<EOF 
blah blah 
blah blah 
bye 
EOF 
cat success | grep 'search for string here' 
EXITSTATUS=$? 
exit $EXITSTATUS (I was screwing up here by typing only exit, which always exits with 0) 

Questions
Do you have a SAP Basis Question?

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.