Skip to Content
Author's profile photo Ivan Femia

Mobile Augmented Reality in SAP

Mobile is getting more and more important in these days and it gives us a new world to explore.

 

image

 

In this blog I will focus on Augmented Reality, but what is it?

 

Augmented reality (AR) is a term for a live direct or indirect view of a physical real-world environment whose elements are augmented by virtual computer-generated imagery. It is related to a more general concept called mediated reality in which a view of reality is modified (possibly even diminished rather than augmented) by a computer. As a result, the technology functions by enhancing one’s current perception of reality.” (Wikipedia)

 

 

Layar is one of the most famous application for iPhone and Android, that gives an exceptional augmented reality experience, and it gives you the opportunity to create your own layer using their APIs.

 

The interaction between Layar application and your SAP is performed using JSON; Layar point to a public web URL that response with a JSON hotspots list.

 

Demonstration 

 

image

image

image

 

This is what I did with our ECC IDES system, Business Partners are displayed in augmented reality, is it cool?

 

How is it possible?

 

1. Create Master data

 

First of all we need to create a Layar Master Data in our system and a report that fill the Layar table reading Business Partner.

 

I used the Community Project ZGEOCODE by Gregor Wolf to retrieve Latitude and Longitude from http://www.openstreetmap.org/ and a simple report ZLAYAR_POI_UPDATE that searches for Business Partner and fill Layar table.

 

Next step is to create a public URL that retrieve the data and generate the JSON response.

 

2. Create JSON response

 

I created a function module ZLAYAR_GET_HOTSPOTS that filters the POIs showing them in the search range in the current location and it creates the JSON response using the code provided by the Google Code json2abap.

 

I had to modify the form write_field_to_json  code in function module Z_JSON_OUT and function module Z_JSON_FORMATER_VALUE and in order to be compliant to the JSON syntax. 

 

3. Create a public service that returns the JSON response

 

To create a JSON response we need to create a service that returns a content-type application/json. I have created an empty BSP Application and into the OnInizialization event handler I call the Function Module previously created.

 

4. Test your service

 

Before submitting JSON url to Layar service, I tested it using The JSON Validator.

 

image

 

Everything is ok! We can create the layer.

 

5. Create the layar project

 

I followed this tutorial on Layar dev site in order to create my layar: First Layar Tutorial – Create a simple layer and with few simple steps my layer is ready.

 

Development portal gives you the possibility to test the layer before the submission and publication below my integration test.

 

image

 

My layer is ready!

Many other features are available, for example a useful feature is the possibility to associate user actions to the hotspot (call a contact, send an email, etc.).

I hope this could help someone to create a very special business case and share it with the community.

What is still missing to have this application in an Enterprise reality?

Thanks to Sergio Ferrari and Luca Grilli their support.

Assigned Tags

      15 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo John Astill
      John Astill
      Hi Ivan,

      Nice blog. I also used Layar for my Plant Maintenance Application at Demo Jam http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/21763

      I see that the Augmented Reality tools are now becoming really useful.

      Did you try any of the other tools out there?

      John

      Author's profile photo Ivan Femia
      Ivan Femia
      Blog Post Author
      Hi John,

      thanks for your greetings, I really appreciate!

      I haven't tried any other tool yet, but I want to develop a custom reality browser, just to taste the complexity.

      Does any one want to create a project on Code Exchange about that?

      Ivan

      Author's profile photo John Astill
      John Astill
      Hi Ivan,

      I would definitely be interested in collaborating with you on this in CodeX.

      Regards
      John

      Author's profile photo Ivan Femia
      Ivan Femia
      Blog Post Author
      John,

      I have created a new project on Code Exchange https://cw.sdn.sap.com/cw/groups/augmentedsap.

      Keep in touch to organize it.

      BR,
      Ivan

      Author's profile photo Gregor Wolf
      Gregor Wolf
      Hi Ivan,

      great to see other using ZGEOCODE.

      Best regards
      Gregor

      Author's profile photo Ivan Femia
      Ivan Femia
      Blog Post Author
      Gregor,

      this is why I like SCN 😀

      Cheers,
      Ivan

      Author's profile photo Former Member
      Former Member
      Ivan,

      this is absolutely cool. i was very skeptical during TechEd, but i'm an absolute convert.

      Author's profile photo Chris Paine
      Chris Paine
      Ivan, you keep building cool stuff! Where do you get the time man?!

      Great innovation!

      Cheers,

      Chris

      Author's profile photo Ivan Femia
      Ivan Femia
      Blog Post Author
      Hi Chris,

      great to see your comment!

      Sergio Ferrari's lab team and I are always on the Edge and with great passion we carry on this experiments. 😀

      I happy that the community is giving us a great feedback, this is my happiness 😀

      CU on next blog

      Ivan

      Author's profile photo Chris Paine
      Chris Paine
      Hi Ivan,

      in your blog you refer to json4abap yet you then mention a couple of FM that would appear to be part of ZJSON function group - http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=163840922

      How did you actually encode your data into JSON?

      I'm building a RESTful service to return data to a desktop widget and looking for a way to convert to JSON - am interested in which approach you took.

      Cheers,

      Chris

      Author's profile photo Ivan Femia
      Ivan Femia
      Blog Post Author
      Chris,

      not sure I get your question, btw I'll try..

      OnInitialization BSP Event, I generate the JSON string then I encode it with a simple:

      call function 'SCMS_STRING_TO_XSTRING'
        exporting
          text     = lv_hotspots_str
          mimetype = 'application/json'
        importing
          buffer   = lv_hotspots
        exceptions
          failed   = 1
          others   = 2.

      lv_hotspots contains the data to be associated to the BPS response.

      Ivan

      Author's profile photo Chris Paine
      Chris Paine
      Hi Ivan,

      sorry, I have phrased my question badly,
      what code did you use to generate your JSON strings from the ABAP data?

      There seems to be at least three libs/methods published that I can find:
      -  json4abap, ZJSON, smartJSON
      What did you use?

      Cheers,
      Chris

      Author's profile photo Ivan Femia
      Ivan Femia
      Blog Post Author
      Chris,

      I used ZJson, it is a beta abap IMHO.
      I'm not sure, but Uwe Fetzer created something in his Twibap.

      Regards,
      Ivan

      Author's profile photo Gregor Wolf
      Gregor Wolf
      Hi Chris, Hi Ivan,

      yes, the Twibap Project contains a Json creator/parser.

      Best regards
      Gregor

      Author's profile photo Ivan Femia
      Ivan Femia
      Blog Post Author
      The layer is public, search for 'saphotspots'.

      Ivan