How to use Smart Business with Non-HANA systems
When the smart business first came out I was lucky enough to get to use them on a customers Business Suite on HANA system. But always felt a little sorry for all the customers “left” with their non -hana systems, who couldn’t get to enjoy this really cool service to create small analytic apps and KPI’s or OPI’s for their currentl solutions.
Well that changed with the enablement of the Smart Business service on HCP makes it possible for us to connect non-HANA systems to the HCP and make use of this cool service to create analytic content and KPI’s for our non-HANA system.
Obviously the advice is still to go to Hana as you are putting an additional load on your system, but i’ll show you how anyways, i just won’t take responsibility for you potentially ruining the performance of your SAP system 😉
First things first, Go to your SAP system and access the gateway builder (SEGW)
Create a new Gateway service, make sure to pick the Service with Vocabulary-Based Annotations.
For this example we will piggyback on an existing service, instead of me showing a walkthrough on how to create the entities and entities etc.
So right click the data model and press Redefine –> Odata Service(GW). Choose the /IWBEP/GWSAMPLE_BASIC version 0001 and press ok.
Check the BusinessPartner, Product, SalesOrder, SalesOrderItem and press finish.
Press the Generate button and register your service on the gateway.
You should have something like this when you test it on the gateway
Alright off to the next step. For Smart Business to be able to use your gateway service, we will need to annotate it. We will do this in ABAP in the model provider extension class. So under runtime artifacts in the gateway builder, navigate to the ABAP workbench on the MPC_EXT class.
You need to redefine the DEFINE_VOCAB_ANNOTATIONS mehod.
Copy in the following code:
DATA lo_annotation TYPE REF TO /iwbep/if_mgw_odata_annotation. DATA lo_property TYPE REF TO /iwbep/if_mgw_odata_property. DATA lo_entity_set TYPE REF TO /iwbep/if_mgw_odata_entity_set. *Calling the generated mehtod for creating annotations CALL METHOD super->define_vocab_annotations( ). *First annotate the sales order entity set with the aggregate annotation lo_entity_set = model->get_entity_set( 'SalesOrderSet' ). lo_annotation = lo_entity_set->create_annotation( 'sap' ). lo_annotation->add( iv_key = 'semantics' iv_value = 'aggregate'). *Secondly annotate the entity type with the same but also annotate the NetAmount with a measure and the CustomerName with a dimension DATA(lo_entitytype) = model->get_entity_type( 'SalesOrder' ). lo_annotation = lo_entitytype->create_annotation( 'sap' ). lo_annotation->add( iv_key = 'semantics' iv_value = 'aggregate'). data(lo_txt_property) = model->get_entity_type( 'SalesOrder' )->get_property( 'NetAmount' ). data(lo_text_anno) = lo_txt_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ). lo_text_anno->add( iv_key = 'aggregation-role' iv_value = 'measure'). lo_txt_property = model->get_entity_type( 'SalesOrder' )->get_property( 'CustomerName' ). lo_text_anno = lo_txt_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ). lo_text_anno->add( iv_key = 'aggregation-role' iv_value = 'dimension').
Now if you test your gateway service again, you will notice the annotations appearing.
Alright so far so good, now i assume you have connected your SAP system to the HCP via the Cloud Connector to the cloud. It is pretty straight forward, so i won’t document that either, yes i am a bit lazy. If you need help, please add a comment.
After you’ve connected your cloud connector you need to create a destination in the cloud.
The Smart Business service filters on the naming of the destination, so you need to name it BusinessSystem0X (The X is a number between 1 and 9, i use 2). If you already have a destination pointing to your backend, just simply copy it and rename it to BusinessSystem0X.
You can see here how you create a destination. Only change is that you need to change to onpremise and add your virtual system and port maintained in the cloud connector and then these properties as well.
This is the WebIDEUsage string dev_abap, bsp_execute_abap, odata_abap, ui5_execute_abap
Of course the sap-client is your own client, mine in this case is 500.
Alright, almost done. You now need to enable smart business in your HCP landscape. Murali from SAP already wrote an excellent blog about that, so i won’t repeat all that. Only thing that is slightly different is the step where you deploy the smart business apps, Murali shows a link to Configure Smart Business Apps, this isn’t present anymore, you should instead click the Access Smart Business Service Tiles and then in the popup click the SB Configuration tile, that will let you deploy the smart business apps.
Now on to the more fun part. Head to your Fiori Launchpad where you deployed your smart business apps.
Click the Configure Business Systems tile
Select your BusinessSystem that you named in the destinations and press Save.
Now click the Create KPI Tile
Give your KPI a proper title and scroll down to the Data Source. Select your Business System and add the path to your odata service. Select your entitySet and your measure
Now Press Save, then Activate Add Evaluation.
Give your evaluation a title as well and add some targets, afterwards click Save and Activate and configure Tile.
Click the Add tile in the bottom right corner.
Select the sample catalog and sample group.
Now a really important step that i often miss, press the Save and Publish Site and then go back to edit mode of your tile and press the Save and Configure Drill-Down. Now press the Configure on the following screen and add your measure and dimension.
You can view it with real backend data if you choose change from dummy data to Actual Backend Data. Give your View a title as well and press save View.
Head back to the Launchpad and refresh the page. You should now see your new tile.
Great work Jakob, thanks. One of the key KPIs at my current customer is the percentage of stock counted at each warehouse per month. I imagine that could work as a smart business tile?
In your example you published your service to a gateway frontend, but I assume it would also work using HCP OData Provisioning?
Yes i see no problems in that. Only important thing is the annotation part, which is fairly simple. Also you do have to think a bit about how you are summing up as the smart business doesn't just do it itself. I'd be happy to show you.
Thank you very much for this blog. The annotations part is what I was looking for to connect the service to our ERP.
Do you know how this would work with a pureJAVA application and Apache Olingo OData (no ABAP or SAP instance) like the ESPM example? I think that the disconnect from your tutorial is how to annotate the the OData service.
Any help or pointers would be greatly appreciated!