The syntax of the assignment is all wrong. But you can avoid running the thing twice. This is one of the few situations where really you want to execute a command first, and then examine its exit code in $?
Code:
temp=`swlist -a revision 2>/dev/null | grep ABC` # note backticks, not regular quotes
case $? in 0) # grep succeeded, meaning it was found
echo Found $temp ABC version, please remove it first ... >&2 ;;
esac
I took the liberty of removing the 2>/dev/null from grep, because I don't see how it could produce an error.