You can create RFC function module and then call this function module from outside. You can create RFC using T-Code SE37
You can use the following link to know more about using RFC function module:
This tells about how you can create an FM in SE37 in Target system enabling Remote-Function Enabled and using attributes of FM.
To create an RFC connection, you need to use T-Code: SM59 mentioning Username and Password.
Another link that you can refer which tells about creating RFC and Remote-enabled FM and call from another SAP system using ABAP Program: