Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Alex_Hauck
Advisor
Advisor

As promised last week, with part two of my blog series I’m going to show you how to generate data within the HANA XS environment.


Static: Data generation with the OData Explorer in HANA XS


Requirements:DB user with writing rights, XS application development
Benefits:Integrated into HANA XS environment and into Web-based Development Workbench, Fill the backend with data for demonstrating purposes
Downsides:Not automated, Execute the procedure once generates only <= 10 data records, For generating more data records a repeated execution is necessary

Developing native HANA applications has various advantages in terms of integration of data storage and data processing. For instance oData is used as a common approach to expose data to front-end applications using UI5. With the help of configuration files (.xsodata), stored data in corresponding tables and views can be accessed. Obviously it is necessary to have some data in the database ;-). Creating content in the XS framework could be done with the help of the xsodata file itself and the OData Explorer. Using this tool, which is based on the SAP River Application Explorer, gives you the possibility to do this. Some of you will probably remember, it was released within SPS07.

Let´s get started and generate some mock-data with the OData Explorer!

1. Choose the appropriate .xsodata file, which contains the table or view you´d like to generate data for. The tool uses the metadata as template and proposes the columns for data generation.

2. Right-click on this file. A context-menu opens. Choose the menu point "Open OData Explorer". Afterwards the explorer opens and displays all repository objects that are configured for being exposed with this file (in this case only one view).

3. After selecting the desired repository object (in this case the selection is quite limited 😉 ) you have to press the "Generate Data" button as indicated above. A dialog opens and prompts you to configure the data generation process.

You´ve got the choice between three different data generation modes. #1 shows the Fixed mode. You just have to enter a value that sticks to the defined data type and afterwards this value will be inserted for the selected amount of data records - maximal 10! #2 presents the No value mode. Selecting this one leads to no data generation for this column. The last mode (#3) creates data in a random manner.

Due to the fact I haven´t found any information about how data is generated by using the random mode and which algorithm(s) are involved I´d like to show you the result of this automated data generation process.

As this figure shows, data for columns with random mode configuration gets inserted by using a pattern. Columns defined as data type "CHAR" use the name of itself as prefix followed by numbers generated randomly. Columns whose definition differs from "CHAR" generate data in a random manner without using any prefixes. I´m aware giving you more detailed information about this would be more satisfying - so if anybody knows more about this: Those information are much appreciated. 🙂

This way of generating data is more appropriate for inserting data sporadically into the database than generating mass data. Giving the customer/user an idea of how the application works could be one of the use cases in which you are going to use this tool. In my opinion it is not suited for getting an idea how the application handles big data as it does not create enough data records at once.

My last blog post connected to this series is going to deal with generating data records for dynamic applications. Hints or best practices how to achieve this goal are very welcomed!