As per my knowledge it’s possible.
If you deploy the applications into the SAP Server.
It will connect SAP System using Web Services (EJB) and RESTFUL services application using JCO connecter in SAP Enterprise Portal.
We need to communication between SAP Server and SAP Back System
For example: let assume instead of 3rd party System we will connect SAP Backend System using JCO Connector in SAP Enterprise Portal
SAP UI5 Application is connected to 3rd party System (SQL Database) Using EJB & REST Service
If you deploy applications into the 3rd Part Server.
We need to communication between SAP Server and SAP Back System. If it’s possible, we will follow same scenario