Skip to Content
Technical Articles
Author's profile photo Naoto Sakai

Use SAP Data From Unity.

I recently received an interesting inquiry:”Is it possible to connect to SAP from Unity ?”
He wants to create a kind of metaverse. And he wants to use SAP functions in it.
I responded that it should be possible to do this, and it is possible, but I had to check to make sure.
This is a memorandum of that.


SAP exposes most of its functionality as REST APIs and OData. Or you can expose them using BTP.
The basic code for access from Unity is as follows
For now, let’s access the API of the sandbox environment.
using UnityEngine.Networking;
    // I placed a button on scene for this test. 
    void OnClick()
        Debug.Log("Button Push!");


    IEnumerator GetProductDesc()
        UnityWebRequest request = UnityWebRequest.Get("$top=50&$filter=Language%20eq%20%27EN%27&$inlinecount=allpages&$orderby=Product");
        request.SetRequestHeader("apikey", "<replace to your api key>");
        yield return request.SendWebRequest();
        if (request.isNetworkError || request.isHttpError)
            // Print resopnse to debug console.
            //This is returned in XML and will need to be properly parsed and used.
We have tested it and confirmed that the results can be transferred successfully.


Since we are using Unity, let’s have a little fun with it by modifying the Unity sample TPS, placing assets (some of which are paid for), and creating a field that looks like a store.

I will place an avatar of a shop staff, and when I talk to him (collide with him in Unity terms), he will give you a list of items he is selling.

(I won’t write the code as in the case of Unity, the code structure is complex, but this is how I was able to do it.)

It’s kind of like the Metaverse. I only play board games like Mahjong on PC/Smartphone , I don’t have latest game machine.
I am not an expert on the metaverse, so I can’t say this is correctly so. I don’t know if you can build a perfect metaverse this way.
But if it is just a demo, I think I can make a metaverse “demo” in conjunction with SAP.
As I was building it, I thought, this requires a different talent than programming. I don’t think I could build a world. 🙂


Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.