whenever you are in SAP, it's an internal SAP system. I don't quite get your requirement. External systems can access SAP via remote function calls. So when you are in your RFC, you can check the RFC user (sy-uname) to see if this is the assigned RFC user. This way you know that it is being called from 'outside'. But again, clearify your requirement.