Skip to Content
Technical Articles

Part 1: How to Create Dynamic Images in SAP Analytics Cloud Story

Introduction:

 

In SAP Analytics Cloud, we can add static images or dynamic images (stored in a remote database Ex: SAP HANA) to a Story.

Prerequisites:

 

To create a dynamic image, you will need a model based on a HANA view with the following attributes:

  • A column containing BLOB data, used in the dynamic image. It is recommended that the image BLOBs used are less than 5MB in size.
  • A column containing a unique ID used to link the image model to an aggregate model via linked models.
  • When queries are performed on the aggregate model, the image object will update if a single member is filtered down to in the aggregate query.

This prerequisite is necessary to prevent duplicate image data to be added to the model.

Note:

  • Dynamic image objects are not supported in the mobile application and cannot be embedded in header widgets.
  • Dynamic image objects don’t support measure-based filters on the source model.

Procedure:

  1. First step is to create a HANA Table to Store the Images and Image Content of type ST_MEMORY_LOB.
  2. Download the images to display in SAC as a dynamic image and save the images in a folder.(Example: C:\\SampleImages)
  3. Upload the image in to HANA Table (created in the previous steps) using Java Class File.
  4. Create a Calculation View of type dimension.
  5. Create join between the Calculation View and table contains at least one measure.
  6. Create Model using the Calculation View in SAC.
  7. Create Stories with Image Dimension in SAC.

Upload Images in to SAP HANA

 

In SAP HANA we can store an image using BLOB (Binary Large Object) object up to 2 GB. BLOB can store a large volume of data, including PDF files, audio and video files.

To consume images in SAP Analytics Cloud the format should be ST_MEMORY_LOB in HANA.

Create a HANA Table:

 

1. Create a Column Store table with the below SQL statement.

2. Right click on the table, select Open Definition.

3. Save the Sample Images in a folder. For this demo, I have downloaded the below images and saved in “C:\\SampleImages”.

 

Create a Java Class File:

 

4. Create a JAVA project in HANA studio using the JAVA EE Perspective to load the images into HANA Table. Add ‘ngbc.jar’ on your libraries in the Java build path. For this right click on your project –>Build Path –>Configure Build Path–>Libraries–>Add External JARs–>Add the File Location.

5. Create a Class file and write the Java Code with the necessary details like Host Name, Instance Number, User Name, Password and Schema.

6. Run the Code by Right clicking on the Class File–>Run As–>Java Application.

7. You can see the similar message in Console.

8. Now the images are uploaded in to the table. You can check this by right clicking on the table –>Open Data Preview.

 

Create Calculation View:

 

9. Create a Calculation View of Type Dimension.

10. Drag and drop Projection Node and add the table to the Projection Node.

11. Select the INDUSTRY_ID as Key in Semantics and activate the view.

12. Create a Calculation View of type Cube with Star Join.

13. Drag and drop the Calculation View of type dimension created in previous steps in Star Join.

14. Drag and drop Projection and add a table which is having INDUSTRY_ID and at least one measure.

15. Join the table with Calculation View of type dimension. (Do not join with the transaction data table).

16. Activate the Calculation View.

Conclusion:

 

Now we have created Image Dimension in HANA. In Part 2 of the blog series, we will create a Live HANA Model on the Calculation View in SAP Analytics Cloud and consume the images in a Story.

Reference:

https://help.sap.com/

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