I believe SAP R/3 comes with REST API integration capability right? That probably would be the best way.
I believe R/3 can be deployed on DB2, Oracle, SQL Server, HANA and who knows what else, so you could target a direct interaction with that database, but that wouldn't be as portable. So I think using the REST API would be the best way.
Just to note, I've never worked with any of the SAP suites, so some due diligence is required with this advice.