Quantcast
Channel: SAP HANA and In-Memory Computing
Viewing all 927 articles
Browse latest View live

R Integration with HANA - Test of "Outside In Approach" - Part 1

$
0
0

R is an open source programming language which is popular among data scientists, statisticians and data miners for developing software for statistical computing and data visualization graphics. It is widely used for advance data analysis.

SAP HANA also provides excellent support for advance analytics. R language can also be used for SQL procedures in HANA and HANA supports embedding of R code. However R environment supports many and much more advanced set of statistical functions and growing set of new libraries of functions. When R environments more advanced capabilities are needed in HANA SQL procedures, then HANA can be integrated with R environment as shown in image below.

R Integration Pic 1 - Inside Out.jpg

In this approach, the advanced analytical and statistical capabilities of R environment are leveraged by transferring the data from HANA to R and aggregated results are sent back to HANA.

However, how about a scenario where HANA is treated as just another database and connected using ODBC or JDBC ?. I thought of testing a use case in which R session can fetch data from HANA Tables into its environment. I term it as Outside in approach as this way of reading data can be viewed from R developers perspective.I feel if this works it opens lots of possibilities in the scenarios where ERP data needs to be viewed and merged with data from other outside domains. However I am thinking of using example data from a previous exercise in which i was able to save twitter messages into a HANA table. Although lot of linguistic analysis can be done in HANA, much more extensive analysis using regular expressions is possible in R environment.

 

RStudio console snapshot images of a successful connection to HANA system are provided below.

 

R Integration Pic 2 - Console HANA connected.JPG

tweets <- sqlFetch(connection,"MyHanaSchema.Table") reads the data from the HANA Table and

 

Here is the snapshot image of the tweets data in R .

R Integration Pic 3 - Tweets sample records from HANA.JPG

Note : Duplicate twitter message also exists in HANA Table.


There are few parameters in sqlFetch() function that allows control on number of records that can be fetched, next i am going to test that and write my own select statement and run it with function sqlQuery() to execute thatSQL or even try JDBC connection with HANA ?

 

 

 

 

 

 

 

 




SAP HANA: Calculating distance between 2 cities using Geo-Spatial functions

$
0
0

Hi Folks,

 

I got into one of the requirements where we were supposed to get the nearest cities (by distance) based on the user location. This is a simple requirement which has already been done in multiple ways.

 

Having never used the Geo spatial functions before getting myself started in learning them and blogging here to share my initial experiences.

 

Let take an example of how to calculate distance between 2 cities.

 

Let us create a table Cities, where we store the city name and its Coordinates.

 

CREATE COLUMN TABLE CITY(
Id BIGINT not null primary key generated by default as IDENTITY, /* To automatically fill the Id column */
City NVARCHAR(40) NULL,
LongLat ST_GEOMETRY (4326)) /* Using ST_GOEMETRY shape which is a super set to load points information */

Some observations while creating the table:

 

1) ID Column:

 

Here I used Identity column to generate the numbers for the ID column, you can see more details about it in the below blog mentioned by Lars:

Quick note on IDENTITY column in SAP HANA

 

2) Longitude & Latitude points:

 

I have loaded the Latitude and Longitude details with the information I got from this website: Geographic coordinates of Hyderabad, India. Latitude, longitude, and elevation above sea level of Hyderabad

 

3) ST_GEOMETRY:

 

We are using this data type ST_GEOMETRY to load our coordinates for the city.

 

SRID Value 4326:

 

Spatial reference identifier (SRID) and that the 4326 refers to the WGS84 standard which is commonly used.

 

Now let us load the data:

 

insert into CITY (City,LongLat) values('Hyderabad', new ST_POINT('POINT(78.4744400 17.3752800)'));
insert into CITY (City,LongLat) values('Vishakapatnam', new ST_POINT('POINT(83.3000000 17.7000000)'));

Note: While Inserting also we can mention the SRID value as shown below but it will not make any effect and will remain as 4326 only ( because we created with 4326 as reference while creating the table ) as shown below. With 4326 and if we try to calculate the distance then it would give the result in metres.

 

Screen Shot 2014-07-09 at 2.14.40 PM.png

 

If we had create the table like below :

 

CREATE COLUMN TABLE CITY(
Id BIGINT not null primary key generated by default as IDENTITY, /* To automatically fill the Id column */
City NVARCHAR(40) NULL,
LongLat ST_GEOMETRY) /* Using ST_GOEMETRY shape which is a super set to load points information */

 

And you have used the below insert statements:

 

insert into CITY (City,LongLat) values('Hyderabad', new ST_POINT('POINT(78.4744400 17.3752800)',4326));
insert into CITY (City,LongLat) values('Vishakapatnam', new ST_POINT('POINT(83.3000000 17.7000000)',4326));

 

Still the SRID will refer to the default value i.e 0 as shown below:

 

SELECT LongLat.ST_AsEWKT() FROM CITY;

Screen Shot 2014-07-09 at 2.08.59 PM.png

Hence we are using 4326 as reference while creating itself.

 

OK ! now we have data so now let us create stored procedure to calculate the distance between the 2 cities Hyderabad and Vishakapatnam. And also convert the distance into KM's or Metres as required.

 

Procedure Code:

 

CREATE PROCEDURE SP_CALC_DISTANCE
( In Latitude DECIMAL(18,10), In Longitude DECIMAL (18,10), In Convesion NVARCHAR(10))
LANGUAGE SQLSCRIPT AS
BEGIN
DECLARE STRING_STR varchar(200);
/* Converting the Metres to KM */
IF :Convesion = 'KM'
THEN
EXECUTE IMMEDIATE ('select A.City AS "Origin City",B.City AS "Destination City"
,A.LongLat.st_distance(B.LongLat)/1000 AS "Distance(KM)"
from CITY A,CITY B
where A.id = 1 and B.id = 2');    
ELSE
EXECUTE IMMEDIATE ('select A.City AS "Origin City",B.City AS "Destination City",
A.LongLat.st_distance(B.LongLat) AS "Distance(meters)"
from CITY A,CITY B
where A.id = 1 and B.id = 2');
END IF;    
/* Calculating the distance from the location points given in the input against the table */   
STRING_STR:= 'SELECT NEW ST_Point(''POINT
(' || :Latitude ||' ' || :Longitude || ')'',4326).ST_Distance(LongLat)/1000 AS "Distance(KM)" FROM CITY
WHERE id = 2';          
EXECUTE IMMEDIATE ( :STRING_STR);    
END;   

 

CALL SP_CALC_DISTANCE (78.4744400,17.3752800,'KM')     

 

Output:

 

Screen Shot 2014-07-09 at 2.48.13 PM.png

 

Screen Shot 2014-07-09 at 2.48.30 PM.png

 

CALL SP_CALC_DISTANCE (78.4744400,17.3752800,'Metres')     

 

Output:

 

Screen Shot 2014-07-09 at 2.50.50 PM.png

 

Note that the distance you are seeing is the distance between those 2 points.

 

Am mentioning the below referenced documents which has helped me to learn and should also help you guys in further exploring.

 

References:

 

Hana SPS07, the spatial engine and taking a byte out of the Big Apple

Hana SPS07 and spatial data

Reverse Geocode your HANA Data with this XS JavaScript Utility

Serving up Apples & Pears: Spatial Data and D3

 

Well My first exercise on spatial , we got some results.  Hope you enjoyed the blog and you will join in my journey of learning this.

 

Your's

Krishna Tangudu

R Integration with HANA with JDBC - Test of "Outside In Approach" - Part 2

$
0
0

In my previous test of Integrating R with HANA R Integration with HANA  - Test of "Outside In Approach" - Part 1

ODBC was used to make connection with  HANA Database on a Cloud Platform. Eventhough I used R environment to make the Database  connection and do SQL operations. ODBC should work similarly for any other Programming environments.

 

SAP supports variety of Integration technologies and methods to write interfaces to connect with its data, right from its native & proprietary RFC techniques (my favorite)  to some of the web based and open standards techniques.

 

This time i thought of using JDBC for making connections to HANA .Again I have used R in my example . It should work similarly if writing a Java based application. One of the key dependency is to use "ngdbc.jar" . This Jar file with its location need to specified in the Build path of Java application. It comes as part of HANA client install.  It is needed for integrating R environment with HANA as well.

 

I am using HANA on cloud , so i have to use secure Data base tunnel to connect and get my user credentials.

The JDBC works with on premise HANA install as well, however you may need to contact HANA system administrator for the parameters values to be used in the function calls.

 

The R Script snippet  using JDBC to connect to HANA is shared below

 

install.packages("RJDBC")

library("RJDBC")

drv <- JDBC("com.sap.db.jdbc.Driver", " <path of ngdbc.jar>", "'")

conn <- dbConnect( drv,"jdbc:sap://<host>:<port>/?currentschema=<your HANA Schema>", "HANA User ID", "HANA Password")

res <- dbGetQuery(conn, "select * from Schema.Table")

 

 

With correct system credentials put in the above R script,  and putting in the correct values of HANA Schema and Table name.

I was able to read the twitter messages stored in the HANA table. Snapshot image of the <res> shared below.

 

So in effect , Data can be read from HANA and brought back in a R data.frame Object which can be now used for further analysis.

 

R Integration Pic 4 - JDBC Tweets sample records from HANA.JPG

 

So another successful test done to connect with HANA using R !! - this time using JDBC

R Integration with HANA using ERP data - Test - Part 3

$
0
0

After establishing the connectivity between HANA and R, It is time to Integrate these two in memory technologies for data analysis and data visualization.

 

Both environments support excellent tools for data analysis including predictive analysis and data visualization.  Analytic & Graphics based  Data Visualization Applications  can be easily developed in both environments and bundled into a Web Product.  If Vector operations in R make it ideal for statistical and data analysis of large data sets, then HANA in memory SQL operations and calculations are better suited for constructing entity relationships of the data. If interactive and animated graphics are more easily produced in R then HANA Cloud Platform is ideal to roll out a web based solution.

Though advanced graphs for data visualization, for example plotting data points over Google maps can be made in either platform, R supports variety of libraries and packages, which makes producing multivariate graphs very easy compared to SAPUI5 library. The choices are plenty for enabling end user scenarios. Best of the breed is the way forward and Integrating the process and data remains the key.

 

For my test case, I decided to use HANA's Data base artifacts created by SQL for storing Sales data in memory data base. Shown below is an Image of Analytic view created in HANA for Sales Orders Line items  (for die hard R/3’r it is filled with table VBAP data). It can be easily created in HANA Studio IDE as a catalog object and its column attributes can be extended by joining it with Product , Customer and Supplier/Vendor  Master data tables.

 

R Integration Pic - Sales Order Lines Analytic View.JPG

 

The extended sales line item data in this view is read to an R environment as shared in the earlier post.

Once the sales information data is available in a R data.frame object. It can be easily consumed by R functions.

 

Product Category is one of the attributes available on the data view which describes what kind of product was sold i.e. Notebook computer or Handheld device or a printer. If we are interested to analyze sales of Notebook computers  then sales information regarding Notebooks can be easily extracted to R data.frame object without using SQL by use of following R code.

notebooks <-  result[result$Product_Category == "Notebooks",]

 

Now , sales information for notebooks can be analyzed further.


Typical Sales information analysis like how much sold by customer, region, product category is important and data visualization for analysis is quite easily achieved.

However, If we wish to visualize and analyze sales based on country of products origin or supplier of the product, Multi variable Graph Plot to group sales of products by their country of origin or suppliers as shown in the image below can be easily created using R graph functions, for example.



qplot(NetAmount,data = notebooks, facets = .~Supplier_Country, main = "Sales by Supplier Country", binwidth = 500)



R Intgeration with HANA - Plot 1.png

Notice, there areno orders worth between $2500 and $4000 that are being supplied from Japan.


Graph plot to visualize correlation between Product Price and Sales Amount , creating scatter plot by supplier country can be easily achieved by using R Functions, for example

 

qplot(Product_Price,NetAmount,data = notebooks, facets = .~Supplier_Country)

R Integration with HANA - Plot 2.png


There are many more advance functions in R to plot graphs and do data visualization.

There are plenty of data sheets available that depict performance criterion of using these environments.

Their capabilities to do fast computations on huge volumes of data are unquestioned.

Illustrated above are just quick examples to show how easy it is to visualize data from HANA using R graphs.

 

Next task is to work on use case to analyze data combining ERP and Non ERP domain data !


 


Data Warehousing on HANA: Managed or Freestyle? BW or Native?

$
0
0

Lots of people think of those questions in terms of black/white, good/bad, legacy/new. As in many, many situations in software and real life, it usually is a trade-off decision. This blog attempts to clarify the differences in both approaches. Ideally, this leads to a less ideological and biased but factual discussion of the topic. Furthermore it should become apparent that the HANA EDW approachallows to work along both approaches within the same (HANA) system. So it is not the case to have - for example - one data warehouse system based on BW (managed approach) and a second, purely SQL-based (freestyle approach) data warehouse system on an RDBMS.


Fig. 1: Two different approaches: managed vs freestyle data warehousing.

Fig. 1 pictures the two different approaches:

  • On the left-hand side, jigsaw pieces represent various tools that are harmonised, meaning that their concepts / objects "know" each other and have the same lifecycle. For instance, when a data source(as an example of such an object) gets changed then the related data transformations (further examples of such objects), cubes, views, queries, ... (i.e. other objects) can be automatically identified, in the best case even automatically, adjusted or at least brought to the attention of an administrator so that the necessary adjustments can be manually triggered.
    Another example is BW's request concept which manages consistency not only within the data warehousing (data management) layers but is also used in the analysis layer for consistent reporting. It's a concept that spans many tools and processing units within BW.
    The individual tools to build and maintain such a data warehouse need to understand and be aware of each other. They work of the same repository which allows one consistent view of the meta data that consitutes the organisation of the data warehouse. When one object is changed, all related objects can be easily identified, adjusted and those changes can be consistently bundled, e.g. to apply them in a production system.
    Due to the dependencies, the tools are integrated within one toolset. Therefore, they cannot be replaced individually by best-of-breed tools. That removes some of the flexibility but at the benefit of integration. SAP BW is an example of such an integrated toolset.
  • On the right-hand side, you see similar jigsaw pieces. On purpose, they are more individually shaped and do not fit into each others slots from the very beginning. This represents the situation when a data warehouse is built on a naked RDBMS using best-of-breed tools, potentially from various vendors. Each tool only assumes the presence of the RDBMS and it's capability to process (more or less standard) SQL. Each tool typically comes with its own world of concepts and objects that are then stored in a repository that is managed by that tool. Obviously, various tools are needed to build up a data warehouse, like an ETL tool for tapping into source systems, a programming environment - e.g. - for stored procedures that are used manage data flows and transformations, a tool that monitors data movements, a data modeling tool to build up analytic scenarios etc. Technically, many of those tools simply generate SQL or related code. Frequently, that generated code can be manually adjusted and optimized which provides a lot of freedom. Per se, the tools are not aware of each other. Thus their underlying objects are independent, meaning with independent lifecycles. Changes in one tool need to make it "somehow" to the related objects in the other tools. This "somehow" can be managed by writing code that connects the individual tools or by using a tool that spans the repositories of the individual tools. SAP's Information Steward is an instance of that. This is pictured as "glue" in fig. 1.
    The freedom to more easily pick a tool of your own choice and the options to manually intercept and manipulate SQL provide a lot of flexibility and room to optimise. On the other hand, it pushes a lot more responsibility to the designers or administrators of the data warehouse. It also adds the task of integrating the tools "somehow". Beware that this is an additional task that adds revenue for an implementation partner.

SAP's Product Portfolio and the two Approaches

As can be seen from this discussion, each approach has its merrits; there is no superior approach but each one emphasises certain aspects. This is why SAP offers tooling for both approaches. This is perceived as a redundancy is SAP's portfolio if the existence and the merrits of the two approaches is not understood.

I frequently get the question whether BW will be rebuilt on SAP HANA. Actually, it is philosophical to a certain extent as BW evolves: e.g. today's BW 7.4 on HANA has less ABAP code in comparison to  BW 7.3 on HANA. This can be perceived as BW being rebuilt on HANA if you wish. However, what does not make sense [for SAP] is to kill the approach on the right-hand side of fig. 1 by integrating the "freestyle tools" into a second, highly integrated toolset which mimics the BW approach because that would simply remove the flexibility and freedom that the right-hand approach has. Fig. 2 pictures this.


Fig. 2: It does not make sense to implement two toolsets for the exact same approach.

What is true, however, is that HANA will see a number of Data Warehousing Services arising over time. They already do exist to some extent as they surged when BW was brought on to HANA. They can be generalised to be usable in a generic, non-BW case. Nearline storage (NLS), extended storage, HANA-based data store objects, a data distribution tool etc are all execellent examples for such services that can be used by BW but also by a freestyle approach.

Finally, I like to stress - again - the advantages of the HANA EDW approach that allows to arbitrarily combine the two approaches pictured in figure 1. You can watch examples (demos) of this here or here.

 

This blog has been cross-published here. You can follow me on Twitter via @tfxz.

Innovation Day Focused on Predictive Maintenance & Service in Atlanta and Dallas

$
0
0

Companies today are facing critical challenges.  You need to know how to optimize maintenance while providing support services.  Plus you are always worried about how to save costs. But where do you start?  How do you take your maintenance program to the next level? 

 

To help you face these challenges, SAP will be hosting two Innovation Days focusing on Predictive Maintenance and Service.   You can join us free of charge at the SAP offices in Atlanta on Thursday August 14th or in Dallas on Thursday August 21st.

 

We’ll discuss real business cases were companies have used huge amounts of data gathered from machine to machine connectivity and powered by the real-time processing capabilities embedded in SAP HANA to make informed decisions.

 

You’ll learn how a large agricultural equipment manufacturer was able to realize a multi-million dollar annual return on their investment through:

 

  • Increased Revenue due to greater asset uptime supporting increased productivity;
  • ReducedService Parts Inventory allowing for more accurate & timely service parts inventory forecasting;
  • Decreased R & D Costs based on predictive maintenance findings regarding equipment design
    resulting in higher quality products and fewer warranty claims

 

Helping increase uptime of your critical assets is a win-win for both you and your customers. SAP’s Solution for Predictive Maintenance & Service can
help.  So to register or to  learn more just click on the appropriate link below:

 

INNOVATION DAY in ATLANTA, GA

Thursday August 14th,  9 AM – 1 PM (local time)

SAP Office, 1001 Summit Blvd, Suite 2100, Dogwood Conference Room, Atlanta GA 30319

 

Click here to Register or Learn More.

 

INNOVATION DAY in DALLAS, TX

Thursday August 21th,  9 AM – 1 PM (local time)

SAP Office, 5215 N. O’Connor Blvd, Suite 800, Lone Star Conference Room, Irving TX 75039

 

Click here to Register or Learn More.

 

Can make either day? Learn more about SAP HANA and Predictive Maintenance

Test yourself, or Do you really know JavaScript in SAP HANA XS?

$
0
0

Introduction:

In this article I would like to talk a bit about the possibilities xsjs which I did not find any documentation on scn, but which, in my opinion, would be useful to know those who study or work with SAP HANA XS about. The article is also dedicated to iterators, dynamic function arguments, easy way to copy objects, the Map object, a small example of currying, and an example of typed arrays.

Code, examples, explanation:

Definition of Iterator:

“An Iterator is an object that knows how to access items from a collection one at a time, while keeping track of its current position within that sequence. In JavaScript an iterator is an object that provides a next() method which returns the next item in the sequence. “

For better understanding Iterator just have a look at the following code:

function Generator(){  yield "num1";  yield "num2";  for (var i = 0; i < 3; i++)    yield i;
}
var g = Generator();
var temp1 = g.next();
var temp2 = g.next();
var temp3 = g.next();
$.response.setBody(temp1+', '+temp2+', '+temp3+' ');
$.response.contentType = "text/html";

 

The Result:

num1, num2, 0

Theyieldkeyword is used to pause and resume agenerator in a program.

Here is more complex example:

function vals() {  for (var i = 0; i < arguments.length; i++) {    yield arguments[i];  }
}
var o = vals(1, 2, 'abc');  
var temp = o.next();
temp = temp+o.next();
temp = temp+o.next();
$.response.setBody(temp);    
$.response.contentType = "text/html";  

 

 

An iterator is also formed in this example. But the sequence number depends on the number of arguments in a function.

The Result:

3abc

Why 3abc, and not 12abc? Because o.next () returns all the arguments one by one, but the variable temp first will be Number, and after retirning of the third argument –it will become  string.

And if the order of the arguments call is changed like this:

 

var o = vals('abc',1, 2); 

 

The result will be:

аbc12

The following example shows a function that turns any object into a symbol representation. It is the Inverse function of eval - uneval.

One of the most obvious ways to use it - is to copy objects:

var m = function () {this.a = 1};
var temp = new m();

temp.am_i_copy = 0;
var h = temp;
var h2 = eval(uneval(temp)); 
h2.am_i_copy = 1;
$.response.setBody(h2.am_i_copy+' - '+h.am_i_copy);    
$.response.contentType = "text/html";

The Result:

1 – 0

  1. i.e., h reference refers to object temp.

And Object h2 – the new one – is clone, so when we change property am_i_copy – to 1 source  h – doesn't change. We couldn’t use JSON.stringify() and JSON.parse() because of functions..

The following example is a description of the Map() object. Map allows to operate the “key –value” pair. Here we create an array of values pairs ​​, and then we add to it the result of the method execution.

var res = [];
var Maper = new Map();
Maper.set(0, "zero");
Maper.set(1, "one");
Maper.set(2,function() {return 1;})
for (var [key, value] of Maper) {  res.push({k:key,v:value});
}
var temp = Maper.get(2)();

res.push({t:temp});
$.response.setBody(JSON.stringify({res:res}));    
$.response.contentType = "text/html";

The Result:

{"res":[{"k":0,"v":"zero"},{"k":1,"v":"one"},{"k":2},{"t":1}]}

The important point is that the third object – {“k”:2} – doesn’t have value because of using function, so if we change this:

res.push({k:key,v:value});

to:

res.push({k:key,v:uneval(value)});

the result will be :

{"res":[{"k":0,"v":"\"zero\""},{"k":1,"v":"\"one\""},{"k":2,"v":"(function () {\n\"use strict\";\nreturn 1;})"},{"t":1}]}


Next example will be interesting for people who doesn’t know about currying on javascript.

This is the example of javascript code which returns another function as the result of the first one and concatenate the first and the second values:

function curry_concat(x){    return function(y){        return x +'  '+ y;    }
}
var a = curry_concat('Test')('Curry');
$.response.setBody(a);    
$.response.contentType = "text/html";

Result:

Test Curry

Test yourself! Do you know the result of the following two statements? What do You think?

var x = new Uint8ClampedArray([-47]);
var x1 = new Uint8Array([-47]);
$.response.setBody('Clamped -' + x[0]+'; NoClamped'+x1[0]);    
$.response.contentType = "text/html";

Conclusion

Over the last example - if the community is interested in this topic, in the future I would be glad to write a detailed article about the pros and cons of using the typed arrays.

Besides the presented here functions there are also others that are not represented in the standard documentation. May be, it also will be interesting ...

SAP Business Suite on HANA at a Glance for Chief Information Officers

$
0
0

The SAP Business Suite ECC on HANA, will open the possibilities to transform in a very positive way your current approach in how you are serving your company.

Be prepared to be changed from your old title of Chief Information Officer to Chief Business Transformation Officer (CBTO).  It is not you changing but rather the way that you will provide real value to your Corporation, adopting the new technology trends, shifting functions that do not belong to your core business value out of your Company, and concentrating your efforts in truly understanding the real Business opportunities to create value through a fast, reliable and efficient business transformation.

What to approach and what to look in your initial planning to adopt or upgrade or migrate your current SAP ECC systems to the new SAP Business Suite on HANA system.

Installation -   Commonly is completed via an Upgrade and DB Migration.  Technical

Functional  - Even if the Project is approached as a pure Technical Migration.

Activation of Transactions available on HANA

Analysis of specific Transactions that can be activated to work in HANA.

Analysis of ABAP programs that need to be enhance and/or enable to run efficiently in SAP HANA.

There are some specific tools to analyze the Programs,  to be changed, re-programmed, unit tested etc.

Functional Transformation– For those customers adapting the new Business Processes that come with SAP ECC 6.0 EHP 7.

Those business processes require an entire re-engineering analysis to transform

Blueprint – Design – Realize – Implement

The business process transformation is heavily impacted by the possibilities to re-create the User Experience SAP FIORI.

Analysis of current business process (re-engineering)

Analysis of Business Process Flows

Analysis and enablement of new processes that combine one or several transactions in a single one.

Design , truly from the Art point of view the new look and fill of the system.  (open development via SAP Fiori)

The major functional change so far , is around SAP FI, where it is no longer required the use of two Financial objects

CO – Documents and the PA documents are now in a single document.  SAP Smart Finance concept)

The major benefit for you adapting this new technology.

It is not in the speed.  OLTP transactions are not improved by better performance but rather by a better Business Processes based on smart software due to the advantages of SAP HANA as a platform.

Significant improvement in OLAP processes where now truly the SAP Business Suite on HANA can leverage the User BI experience at all levels, from operation, to higher Strategic Business Intelligence.

Integration + Integration + Integration – Finally you will be able to reduce your diverse Vendors footprint that your were collecting in the past 10 or 15 years. Don’t forget the rule of thumb.  It will cost you 20% to 30% of your implementation and further maintenance costs to maintain connectivity, like for example Process Integration Software, at the same time SAP HANA new and flexible Smart Data Access offers you new possibilities to store Big data using smart tools like Hadoop, federating Data from several other systems and allowing you for a better and safer Business too Business interaction.

The fact that SAP will no longer support SAP ECC on traditional relational database management systems by 2020.


SAP HANA from the Amazon Cloud: Secure and Reliable on SUSE Linux Enterprise Server

$
0
0

300_suse_logo_color.png

“SAP CEO Bill McDermott gets software group fit for the cloud,” was the title in the German magazine Computerwoche, summing up this year’s SAPPHIRE NOW, which ran from June 3 to 5 in Orlando, Florida. Following in the same vein was the presentation given at the SAP customer event by Peter Mauel and Steven Jones from Amazon Web Services (AWS). Here, the audience learned about the benefits of obtaining SAP HANA from the AWS cloud based on SUSE Linux Enterprise Server.


Customized Service Packages

 

“SAP, AWS, and SUSE Linux have been working together successfully since 2008. This has resulted in a range of customized service packages that provide customers with the necessary SAP applications as part of Linux-based leasing models,” explained Steven Jones, Senior Manager of Global Alliance Solutions Architecture at AWS. “Naturally, there are also specific offerings for SAP HANA users who want to leverage the benefits of AWS cloud services, such as reducing costs and complexity.” 


As Steven Jones explained, companies currently have three options for using the SAP HANA in-memory database on an AWS and SUSE Linux basis:


  1. Infrastructure subscription: “Bring Your Own License”
    1. This means that although customers purchase the SAP HANA license directly from SAP, the implementation itself is in the AWS cloud. With this model, all SAP HANA use cases are supported, including SAP Business Suite and SAP NetWeaver Business Warehouse on SAP HANA.
    2. Benefits:
      1. Immediate provisioning of SAP HANA licenses in the cloud
      2. No long-term capital tie-up for hardware resources
      3. Enterprise support
  2. SAP HANA One
    1. Customers obtain SAP HANA applications entirely from the cloud. Support is provided for real-time analyses, data merging, temporary and event-based analyses, self-service BI, as well as pilot and test models.
    2. Benefits:
      1. Instant, self-service access – system up and running in 10 minutes
      2. Start and stop when needed, thus reducing license and infrastructure costs
      3. Community support
      4. On-demand SAP HANA license fees: USD 0.99 per hour
  3. Offering for developers
    1. SAP offers developers a free AWS license for SAP HANA to help create a community that deals with all aspects of the high-speed database. The aim of this is to help customers put SAP HANA to the test and try out their first application scenarios.
    2. Benefits:
      1. Free SAP HANA developer licenses
      2. Easily accessible and rapidly deployable
      3. Pay-per-use AWS infrastructure costs


Maximum-Performance Computer Clusters in Use


“For SAP HANA, we use our biggest and most powerful computer clusters,” emphasized Peter Mauel, SAP Global Alliance Leader at AWS, at the SAPPHIRE NOW 2014 presentation. With SUSE Linux, AWS and SAP are making use of an operating system that ensures high availability, improved system performance, and cost savings in terms of operating the in-memory database. 

For more information: Youtube Video "Leveraging SUSE Linux to run SAP HANA on the AMAZON Web Services Cloud"

SAP HANA operation expert summit

$
0
0

A win-win situation for SAP & SAP HANA customers.


That's how I can easily describe the HANA operation expert summit in one sentence. My blog is late (some months) but that doesn't matter, the message it brings out stays relevant and important. I hope this event becomes an annual appointment on my agenda.

 

The event was concentrated around the operations part of SAP HANA and since many SAP experts are in or near SAP Walldorf, SAP gathered them up and delivered a two day event including a keynote, networking dinner, roadmap sessions and group discussions with the experts from SAP.

 

I've told this before and I really had this impression: All the customers running SAP HANA who were present where happy about the fact they are running on SAP HANA. That's an important pointer. I hope all customers who have it and leverage it are happy about it. If not, more reason why you should be at this type of event as it provides the opportunity to give direct feedback and discuss issues with SAP. Merely being there and giving feedback might already solve your problem.

 

The topics were picked with the help of surveys done by SAP (organizer Kathrin Henkel) up front to check what attendees were looking for in terms of information and around which topics they wanted to discuss. Unfortunately I missed most of the keynote because I had to do a workshop presentation at customer side, in Belgium still. I arrived late in Walldorf and I walked in near the end of the keynote (like last 10 minutes) but I could still get a sense of what was shown during the keynote. I saw some examples of non-traditional SAP HANA use. With that I mean, non SAP BW or SAP ERP based scenarios.

 

After the keynote, the networking dinner started and it was organized in a way that each table had two SAP HANA experts present to provide an entry point for discussion and allow participants and experts to get to know each other. The concept was good and it was an enjoyable evening. One of my Belgian colleagues was there with me so we ended up furthering the discussion in a local pub near the center of Walldorf.

 

The next day, presentations were on the agenda where the experts explain the current status and roadmap for the different topics related to SAP HANA. Again, well organized and pretty interesting from a participant point of view.

 

After the presentations, break-out sessions were planned in to discuss topics with the relevant experts, network and exchange knowledge. The discussions were interesting and most of them brought interesting information and insights. Notes were being taken by SAP to ensure follow-up.

 

Networking was left mostly to the participants because of rules / regulation (sharing personal information) and therefore I do believe there is room for improvement here. Perhaps participants could be allowed to opt-in up front to share their contact details with other participants early on or create a SAP JAM group for longer lasting social contact around the topic.

 

Participants received (optionally) a SAP HANA operation expert polo (check the video) which I personally like a lot and a doggy bag to have food for the road back home. I really liked both.  Provide me with (good looking) sponsored clothing like that and I wear it proudly. Why? Because I'm proud to be part of SAP's ecosystem and I believe in SAP HANA. I enjoy spending time on SAP HANA, its as simple as that. Its exciting, new technology that has already started to make an impact on the world around us.

 

You can have a look at the overview video to get an idea of what the event was about:

hana_expert_summit.jpg

 

An introduction to HANA’s Except Set operator function

$
0
0

In this blog, I would like to provide a basic introduction to the Except set operator function which has been introduced with HANA 1.0 SPS07. This blog provides basic understanding of what is Except set operator function and how to write a simple Except set operator function. On following this blog, I feel any reader would be able to write simple Except set operator function.

 

 

Let me first try to explain the use of the SQL EXCEPT clause/operator -  the Except set operator function  is used to combine two SELECT statements and returns rows from the first SELECT statement that are not returned by the second SELECT statement. In other words, it only returns rows from the first SELECT, which are not available in the second SELECT statement.

 

The syntax of Except set operator function is:

   

     SELECT column1 [, column2] FROM table1 [, table2] [WHERE condition]

     EXCEPT

     SELECT column1 [, column2] FROM table1 [, table2] [WHERE condition]

 

For Example:

 

Except.png

 

 

The above SQL returns all artnr except the artnr for which kndnr = 255.

 

I feel after reading this blog, the readers would be able to use EXCEPT in situations, where ‘minus’ operation needs to be performed. I would encourage the readers to try out EXCEPT set operator.  The readers could stay tuned for my upcoming blog as I introduce GROUPING SET function and how to use it in HANA system.

 

 

 

Test yourself again, or Do you really know JavaScript in SAP HANA XS 2?

$
0
0

This article is a continuation of the first partthat is about javascript in SAP HANA XS. 
The examples of new opportunities will be discussed here, as well as standard options, that allows the article be interesting for the beginners. The difference between the first part is that here we reveal no code execution results. Why should we demonstrate it if something interesting worth a trying by ourselves, while the obvious things are understandable by itself?

 

Code, description, so on..

The first example is an opportunity to observe the object. This method allows to track any changes in the properties. The code will explain my point better than me:

var o = { p: 1 };
var temp='';

o.watch("p", function (what, oldVal,newVal) {
    temp = temp + "o." + what + " changed from " + oldVal + " to "+ newVal +"<br>";    return newVal;
});

o.p = 2;
o.p = 3;
delete o.p;

o.p = 4;
o.unwatch('p');
o.p = 5;
$.response.setBody(temp);    
$.response.contentType = "text/html";

This example is an alternative function declaration. After all you couldn't need it:

var a = "return "+ "x*function() {return y}()";
var multiply = new Function("x", "y", a);
$.response.setBody(JSON.stringify({test:multiply(2,4)}));
$.response.contentType = "application/json";

The field of view is not always obvious for javascript beginners. And this example perfectly demonstrates that:

var a = 1;
function b() {    a=10;    function a() {return 5};
}
b()
var g = a;
$.response.setBody(g);    
$.response.contentType = "text/html";

 

 

But here the <let> comes for help. Could you guess what the result will be here?

var m=0;
var x=1;
var y=2;
let (x = x+10, y = 12) {  m=x+y;
}
m=m-(x+y);
$.response.setBody(m);    
$.response.contentType = "text/html";

 

 

In this example I compare the performance of the array elements filling level. What do you think will work faster, the standard method "push" or writing a value to a nonexistent index? It seems that push and [<name>.length] works the same way ... And that is not entirely correct:

var res1=[];
function times() {
var a = [];
var time1=Date.now();
for (var i=1;i<10000000;i++){    a.push(i);//ex1
 a[a.length]=I; //ex2
}
var time2 = Date.now();
return (time2-time1)/1000;
}
for (var i=0;i<10;i++){
 res1.push(times());
}
$.response.setBody(uneval(res1));    
$.response.contentType = "text/html";

 

[2.035, 1.918, 1.939, 1.935, 1.933, 1.924, 1.945, 1.94, 1.948, 1.934] - push

[1.595, 1.564, 1.571, 1.556, 1.57, 1.554, 1.567, 1.57, 1.57, 1.574]- length

Collections - support the uniqueness and therefore sometimes could be more useful than arrays:

var tem = new Set([1,2,'3']);
$.response.setBody(tem.has('3'));    
$.response.contentType = "text/html";

 

Default values for functions:

function av(a=1) {return a};
$.response.setBody(av());    
$.response.contentType = "text/html";

When I attended the first job interview in my life, I had this question: "How do you change the values ​​of two variables without using a third one"

Then I used only two ways: math way and Boolean “or”. I did not know then that it is possible to do like that:

var foo=1,bar=2;
[ foo, bar ] = [ bar, foo ];
$.response.setBody(‘foo - ’+foo+’bar - ’+bar);    
$.response.contentType = "text/html";

Is there any difference between “in” and “of” in an iteration? Of course it is, and here's an example:

var arry=[1,2];

arry.someprop = 123;
var t=[];
for(var x in arry) {  // for(var x of arry)
 t.push(x);
}
$.response.setBody(uneval(t));    
$.response.contentType = "text/html";

If you are interested in the problem of using the multiple parameters with the usual named parameters, here's an example for you:

function mult(m, ...th) {  return th.map(function (x) {    return m * x;  });
}
var arr = mult(4, 1, 2, 3); 
$.response.setBody(uneval(arr));    
$.response.contentType = "text/html";

This is one of the options to define getter – it is nothing new, but for somebody it could be useful:

var o = {a: 7, get b() {return this.a + 1;},set b(a) {this.c=a}};

o.a=2;
o.b=1;
$.response.setBody(o.b);    
$.response.contentType = "text/html";

Function parameter is the object. And this is possible:

var names = function({n1:n1,n2:n2}) { 
 return n1+' '+n2;
}
$.response.setBody(names({n1:1,n2:2}));    
$.response.contentType = "text/html";

What do you think about the result of this function?

var a=1;
var b = (254,function() {return a+1}());
$.response.setBody(b+' a- '+a);    
$.response.contentType = "text/html";

Some labels:

var a=1;
xxx: {        a=2;        break xxx;
 a=3;
}
$.response.setBody(a);    
$.response.contentType = "text/html";

It is not obvious for everyone that there is also finally, isn’t it?

var a=0;
try {    a+=1;
} 
catch(e) {    a+=2;
}
finally {    a+=3;
}
$.response.setBody(a);    
$.response.contentType = "text/html";

This example is a little quiz, because three lines of code are missed. The returned result is “a = 2”. We can’t assign the value directly to a variable. What kind of lines are here? What do you think? I would like to note immediately that there is no error. Neither parameters nor brackets <kill_my_mind> doesn’t have!

var a=0;………
kill_my_mind;
kill_my_mind;
$.response.setBody(‘a=’+a);    
$.response.contentType = "text/html";

Сonclusion:

Thx for your time.

 

P.S. The number of likes and followers encourages authors to write more;)

Too Busy to Innovate

$
0
0

It has been a collection of events that lead me to finally blog again here on SCN, apologies for the absence!. In correct order was a nice mail from Mark Finnern which helped me to find the right subject and angle. Then I came across this photo which I found on Linkedin and I thought it was simply brilliant since it described a reality in such direct beauty that it was almost brutal.

too busy tu improve?.jpg

What you see is the reality of many managers in IT. They are too busy to "keep the lights on" that they cannot focus on innovation. I come across those situations almost everyday at customers. In a former job I used to say that I will write the book "1001 reasons to not do anything" in reference to an attitude of people who were not willing to think outside of the box or maybe even not capable. Just in case somebody feels this is a Rant, wrong!!! Simply when we talk to customers or partners we find often times motivations on their side which leads them to say "No" and it is important to understand what those motivations could be and what could be "goodies" we can offer in order to drive the motivation in the right direction.

Hint: There is not Penicillin at this point in time. Most customers have different motivations and triggers which will lead them to drive change in their organisation, for sure this will change over the time as adoption is growing.

I saw yesterday on Twitter a link to the following ASUG Survey: ASUG Member Survey Reveals Successes, Challenges of SAP HANA Adoption Thought it is just the preview but I did find some things that I were really interesting.

  • 3/4 of the respondents who said that they have not purchased yet SAP HANA said it is because they have not found the right business case yet for it
  • 65% of the respondents started their SAP HANA journey with BW on HANA

Please take the time to read the full document in the link provided. Whilst I have seen already comments that those numbers are "not good" I would be more positive and say well we have some points on which to work and there must be a starting point somwhere.

 

The first point to me is not really a surprise which does not mean that it is not an area that deserves much more focus. In a recent conversation with an IT Director of a Retailer he told me "You know, HANA is really expensive and I do not think that we need it". This is a very standard answer that I hear, yet it is the moment when the emotions rise and I like to ask some questions. Especially in a retailer who have many times 60-90.000 cost centers, how do you measure the profit of your sku? Can you tell me at what profit you are selling for example a 1.5l Water Bottle of Brand X in your stores, differentiated by store. The answer is in 99.9999% of the case "No". Taking this a step further it means that an IT Department today is not able to respond to the business with one of the que KPI for a retailer (profit of good sold). Yet he says that he does not need it. Where am I going?

 

I agree that customers need more guidance in order to understand what are the fundamental differences he / she can achieve with HANA. There are many and this is actually the beauty of it. Cost is an important factor? For sure but if you look at how customers are operating today with many disperse systems, ETL etc there is huge cost in there as well which after all delivers very little to no added value. Being able to drive down cost is very important and, yes we are doing it!

In most of my customer engagements we are doing a HANA journey and use the DesignThinking in order to help them identify the areas of where HANA would be driving value for them. It is a very important step in a sales cycle since this moves us out of pure IT but talks to business.

 

Screen Shot 2014-08-08 at 11.58.56.png

What I like about HANA is the fact that allows you to take the journey. It is your decision on how much you get out of it. Just like you can take a sports car to just drive in the city or on a speed limit highway at 100km/h, but you can take it much further and this is when you really get to the most of it.

 

Most of my customer have started the conversation with Cost Reduction and Increased Productivity. By reducing the IT Stack significantly we are helping to lower the overall cost. Productivity is being increased by use cases like BW. If a BW System is slow the tendency of the users is to use it only if there is not other way around or not at all. This makes the investment even more expensive since there is no ROI!

I am very critical on using the speedfactor of HANA as an argument. But yes it is also an argument but by far not the only one! If the BW is fast and has a simplier structure (allowing more drill down to the user) this will increment their satisfaction level = usage level!

 

These two points alone already justify the move towards HANA by themselves. But then we come to the areas of Innovation and Innovation (DataDriven - BigData) and Transformation where you do really disruptive things. Remember the phrase of Henry Ford "If I had asked people what they wanted, they would have said faster horses" yet he drove the revolution!

 

Screen Shot 2014-08-08 at 11.58.10.png

 

With traditional solutions most people try to answer the three dark squares. The real value however lies in the area of "I don't know that I don't know". Many times this is related to IT. Coming back to my example of the retailer and the profit calculation. Why do they not have this on their #1 priority list? Mainly because it was not thinkable to do such complex and data intensive operations in a timely and cost-efficiently manner, though it is a core question of retail!

 

There is a lot more todo and even more to explain and educate but it is really on us.

 

Last but not least: This might be a good analogy

 

35db59ca-1e71-11e4-beac-22000ab82dd9-original.jpeg

Of course this should not be done by one person alone!

Is this the gym you pay for but never actually show up?

$
0
0

Seth Godin put it so nicely: Seth's Blog: Analytics without action

 

     "If you're not prepared to change your diet or your workouts, don't get on the scale."

 

meaning that if you don't want to actually do something with the insight you gain with analytics then better don't bother doing them.

 

Yet, here we are, working mainly on technicalities of yet another platform that will revolutionize business as if we hadn't have that often enough yet (The &quot;Mad Men&quot; Computer, Explained By Harvard Business Review In 1969 | Fast Company | Business + Innovation).

 

Carsten Nitschke just reminded us withToo Busy to Innovate that we're focusing on the wrong stuff.

 

If there really should be a major difference for how your organization does business it won't help to just migrate to a new platform or tool.

Maybe funny to realize, but if the migration to the new technology platform is everything your team wants to do, then it actually doesn't matter what platform you choose. You may as well stick with your old one.

 

Looking at it from the vendor point of view (and that is the view I have to have of course), every sold license is a good and generates a stream of revenue.

For vendors it's perfectly fine to focus on speed, features and shiny UIs. That's what we all sell.

 

However, that's not the whole story. And it's the easy part of the story, too.

 

The hard part: mainly on your side, as you have to change.

Frighteningly similar to having a session with your personal trainer, ain't it?

How to gather requirements and Implement for NON-SAP sources data in HANA

$
0
0

Hi HANA Experts,

 

In this blog, I want to share my experience and approach to gather requirements and implement for NON-SAP source data in HANA.

 

HANA has the interoperability strength for various NON-SAP sources like ORACLE, MSSQL, and DB2 by supporting those data types.

 

Majority of HANA folks are traditionally from SAP background like ABAP, BW would have strong insights of tables and their relationships between those tables.

 

In case, if we don’t know the table names and relationship in SAP, still there is SD11 T.code for providing the information. 

 

Problem arises, when there is requirement to report/model on NON-SAP source.

 

How do we gather requirements from Business and Typical IT Non-SAP super users?

 

Below are the few points, which may help in our implementations:

 

Initial and most crucial step during the implementation is determination the type of data replication methodology to be used.

 

We know that there are several ways to data replicate like SLT, DXC, SAP data services and Sybase replicator.  I will not get into the best options and procedure of this various replications. 

 

DXC is not possible for Non-SAP sources systems.  Depending upon on various factors, we choose either of one option SLT, SAP Data services and Sybase replicator.

 

Once the data replicator is decided, next major steps are to be worked with NON-SAP source team:

 

     1. Identify the required tables, fields and joins between various tables. (very crucial step)

     2. Identify the measures and key attributes.

     3. In case of real-time reporting, either SLT or Sybase replicator will be opted.

 

Once the tables are in HANA, then next important step is to identify the JOINS between the tables.

 

Join type like Inner, left outer, right outer, full join will have different result sets. So it is next very crucial step in the modeling the HANA objects.

 

After the identification Tables, attributes, key attributes, measures, next step is data modeling in HANA, based on the requirement design the attribute, analytical and calculation models. There after reporting using some reporting tool like BO.

 

Looks simple, but many problems arise during implementation and also want to share common issues faced and checks to applied for NON-SAP source data.


Common Issues faced with NON-SAP source data:

  1. Identification of Primary keys in different data sources.

  •       Identify the primary key and convert them into proper data type like string, date , numeric . example Account number, sales order might be different size and type. 

  1. Challenge to synchronize data types.     
    • Date format of Oracle, GDW were different formats when compare to SAP and they were appearing as text.
  1. Make proper, common formats/types for fields like currency , amount and date.

 

CHECKS to any for NON-SAP source:


COLUMN TABLE CHECK: Ensure that every table created for NON-SAP source system should be COLUMN table type.


FIELD CONSISTENCY CHECK: Ensure every field created in the table from NON-SAP Source system, which is used to merge with SAP system field should be same and common data type. As best practice convert into SAP field format.


SCHEMA CONSISTENCY CHECK: Ensure Schema names across the different HANA systems (Like PRODUCTION, DEV and QUALITY) are same and it will be helpful for the easy maintenance of the models.

 

I hope you had good reading and please provide comments on this blog. In my next blog, I’m planning to brief about the best practice and naming standards.

 

Regards,

Santosh.


Introduction to SAP HANA Cloud Platform

$
0
0

I just completed the Introduction to SAP HANA Cloud Platform
in https://open.sap.com/. This is a great
course to provide an introduction to the SAP HANA world and how it works. It
gives an overview of SAP HANA Cloud Platform. The course details how to create
an account on the SAP HANA Cloud Platform and how applications work within an
account.

 

It provides the basics in Eclipse, how to use the Eclipse
IDE, debugging and logging and how to set up and use the Console Client. As
well as watching the videos and reading the documents I was able to install
Eclipse IDE and do all the configuration that is detailed in the course. This
provided me with a better understanding of how it works.

 

Each week is quite detailed and brings you through connecting
and using multiple databases, sharing applications, user authentication and
security and the services provided.

 

I would recommend it as a starting point for everyone who is
interested in finding out more about SAP HANA Cloud Platform.

 

Thanks to Rui Nogueira and the OpenSAP Team for providing
this brilliant course.

Quantum mechanics in SAP HANA?

$
0
0
based on SAP HANA rev. 81

 

Just shortly before my vacation starts I thought I leave you with another pearl of knowledge... *cough*cough*

Don't expect suspense or a proper three act structure - it's just one of those techie blogs that you might put on your "read later" list and then forget about it...

 

Anyway, that's how I tell this story:

 

Last week a colleague reached out to me and presented the following case:

 

"We have a data warehouse system with fact tables and master data tables.

Between fact and master data tables, foreign key constraints have been set up to ensure data consistency.

Now, whenever we load master data, the transaction (sic!) tables grow in size, while the number of records stays the same."

 

What could be going on here?

Quantum entanglement effects on SAP HANA column store tables?

(and this really is all I come up with to rectify the super-cheesy title... )

 

When I read this, I first thought this likely was a misobservation.

But, alas, sometimes you just have to try things out.

 

And so I did this:

 

1. Setup the tables

CREATE COLUMN TABLE masterdata (id INTEGER PRIMARY KEY, md_data NVARCHAR(20));

 

CREATE COLUMN TABLE transactions (id INTEGER PRIMARY KEY, data NVARCHAR(20)

                                , md_id INTEGER

                                , FOREIGN KEY  (md_id) REFERENCES masterdata ON UPDATE CASCADE);

 

2. Load some dummy data

-- load some masterdata

INSERT INTO masterdata VALUES (1, 'MD1');

INSERT INTO masterdata VALUES (2, 'MD2');

INSERT INTO masterdata VALUES (3, 'MD3');


-- load some transactions

insert into transactions values (1, 'TX1', 1);

insert into transactions values (2, 'TX2', 2);

insert into transactions values (3, 'TX3', 3);

insert into transactions values (4, 'TX4', 1);


-- do some storage cleanup

UPDATE masterdata WITH PARAMETERS ('OPTIMIZE_COMPRESSION' = 'FORCE');

UPDATE transactions WITH PARAMETERS ('OPTIMIZE_COMPRESSION' = 'FORCE');


MERGE DELTA OF masterdata WITH PARAMETERS ('FORCED_MERGE'='ON');

MERGE DELTA OF transactions WITH PARAMETERS ('FORCED_MERGE'='ON');

 

3. Check the table storage

SELECT table_name, memory_size_in_total,

       record_count rec_cnt,

       raw_record_count_in_main rec_cnt_main,

       raw_record_count_in_delta rec_cnt_delta

FROM   m_cs_tables

WHERE

    table_name IN ('MASTERDATA', 'TRANSACTIONS')

AND schema_name=current_schema

ORDER BY table_name;

 

TABLE_NAMEMEMORY_SIZE_IN_TOTALREC_CNTREC_CNT_MAINREC_CNT_DELTA
MASTERDATA12295330
TRANSACTIONS14863440

 

4. Check the column storage for TRANSACTIONS table

 

SELECT column_name, count, distinct_count

FROM m_cs_columns

WHERE

    table_name='TRANSACTIONS'

AND schema_name=current_schema

ORDER BY column_name;


COLUMN_NAMECOUNTDISTINCT_COUNT
DATA44
ID44
MD_ID43



So, up to here everything is normal and as expected.

 

Now, we want to load some new master data.

 

A common approach is to run a full update and that's what I will do here as well.

 

To make things a little more handy, I set up a second table with our new master data, called MD_STAGING.

It contains the same records that are already present in table MASTERDATA, except for one updated record, plus two "new" records.

 

CREATE COLUMN TABLE md_staging (id INTEGER PRIMARY KEY, md_data NVARCHAR(20));


INSERT INTO md_staging VALUES (1, 'MD1');

INSERT INTO md_staging VALUES (2, 'MD2');

INSERT INTO md_staging VALUES (3, 'MD3_NEW');


-- the "new" data

INSERT INTO md_staging VALUES (4, 'MD4');

INSERT INTO md_staging VALUES (5, 'MD5');

 

5. Now let's "load" the new data

Loading the new master data basically consists of two steps:

 

  1. INSERT any actually new records and
  2. UPDATE the ones that we already have with the current data.

 

A well known ETL software (Data Services and Data Quality) would probably do something similar to this:

 

UPDATE masterdata SET  id = new.id,

                       md_data = new.md_data

                  FROM

                      md_staging new

                  WHERE masterdata.id = new.id;


INSERT INTO masterdata

        (SELECT is, md_data FROM md_staging

         WHERE id NOT IN (SELECT id FROM MASTERDATA));

 

 

So, let's do this...

 

Statement 'UPDATE masterdata SET id = new.id, md_data = new.md_data FROM md_staging new WHERE masterdata.id = ...'

successfully executed in 134 ms 456 µs  (server processing time: 97 ms 711 µs) - Rows Affected: 3

 

 

Statement 'INSERT INTO masterdata (SELECT id, md_data FROM md_staging WHERE id NOT IN (SELECT id FROM ...'

successfully executed in 97 ms 91 µs  (server processing time: 58 ms 243 µs) - Rows Affected: 2

 

 

Checking the numbers for the affected rows we see that 3 existing records have been UPDATED, although only one of them had actually been changed and 2 records have been INSERTed.

 

Looks OK to me, I'd say (for now)...

 

Next, let's check the table storage again:

 

TABLE_NAMEMEMORY_SIZE_IN_TOTALREC_CNTREC_CNT_MAINREC_CNT_DELTA
MASTERDATA34349535
TRANSACTIONS38205444

 

Compare that with what we had before:

 

TABLE_NAMEMEMORY_SIZE_IN_TOTALREC_CNTREC_CNT_MAINREC_CNT_DELTA
MASTERDATA12295330
TRANSACTIONS14863440

 

No surprise for table MASTERDATA, but look what happened on the TRANSACTIONS table!

SHOCK, AWE and WONDER!

There are four records in the delta store now, although we didn't actually changed any referenced data.

 

Checking on the column statistics for table TRANSACTIONS we find this: 

 

COLUMN_NAMECOUNTDISTINCT_COUNT
DATA84
ID84
MD_ID83

 

Now there are 8 entries for every column, although we only have 4 distinct ID values and, as we know, only 4 records in total.

 

What is going on here?   

 

This actually is the combined effect of two features in SAP HANA.

  1. UPDATEs are stored row-wide in the delta store and performed regardless if any data was actually changed.

    Whenever we issue an UPDATE command, SAP HANA has to identify/find the record(s) to be updated first.
    Once this is done, the whole record is copied, all SET-parts of the UPDATE command are applied to the copied record and the record is stored in the delta store. Finally the old record gets marked as invalid and the new record becomes the new valid record.
    This is commonly called insert only database storage.

    For our blog what's interesting is that SAP HANA does not check whether anything actually changes.
    Even if the SET-part of the UPDATE command sets the exact same values this change gets executed and stored in the delta store (and of course also in the redo log).

  2. The UPDATE action for the referential constraint is set to CASCADE.
    So every update on a referenced column will lead to an update on the referencing table as well.

 

Alright then.

So far we've learned that performing a full update on the MASTERDATA table could lead to a lot more records to be touched then what we would intuitively think.

 

Now you should be asking: "What could be done to prevent this"?

 

There's a couple of options:

a) Go without foreign key constraints for your data warehouse.

That's what most DW vendors do, since FKs really tend to complicate things with data loading once more than a few tables use the same master data.

E.g. SAP BW does it that way.

 

b) Drop and recreate the foreign key constraints before/after data loading.

SAP HANA does currently not allow to disable FK constraints or to re-validate them.

This however is a nonsense option as exactly during the time of data modification - the time when you want the constraint to be active - it would just not be there.

 

c) You ensure that the referring column(s) - ID in our example - does not get updated.

This is actually not too difficult to achieve.

 

A small change in the UPDATE command we used above already would do the trick:

UPDATE masterdata SET  md_data = new.md_data                 

                  FROM

                      md_staging new

                  where masterdata.id = new.id;

 

The downside is that the otherwise practical UPSERT statement won't work here since it needs to have the values for ALL columns in any case.


That's it again.

 

I bet you didn't expect this or did you?

 

Cheers,
Lars

View and WITH GRANT OPTION

$
0
0

In this blog, I will show some examples of granting privileges on views to others and explain in what situation we need "WITH GRANT OPTION".

 

Motivation

The motivation of writing this blog comes from this question Re: insufficient privilege to select from database view The scenario in that thread is kind of complex. I will not explain that scenario in details here. If you are interested, you can take a look there.

 

Problem

Here is a simpler scenario/problem with the following steps.

1. There are three user A, B, C and each user has his/her own schema.

2. User A creates "table A" in schema A and grants the select privilege on "table A" to user B.

3. User B creates "view B" in schema B and "view B" is based on "table A".

4. Now here comes the question. Can user B grant the select privilege on "view B" to user C? Can user C select data from "view B"?

 

To answer the questions, let's first do some tests in SAP HANA. I am using SAP HANA SPS 08 Rev. 80.

Example 1

Step 1: SYSTEM creates three users, USER_A, USER_B and USER_C.

CREATE USER USER_A PASSWORD Initial1;
CREATE USER USER_B PASSWORD Initial1;
CREATE USER USER_C PASSWORD Initial1;

 

Step 2: USER_A creates TABLE_A under schema USER_A and grants the select privilege on that table to USER_B.

CREATE COLUMN TABLE USER_A.TABLE_A (ID INTEGER);
GRANT SELECT ON USER_A.TABLE_A TO USER_B;

 

Step 3: USER_B creates VIEW_B under schema USER_B and VIEW_B is based on TABLE_A.

CREATE VIEW USER_B.VIEW_B AS SELECT * FROM USER_A.TABLE_A;

 

Step 4: USER_B tries to grant the select privilege on VIEW_B to USER_C but fails.

GRANT SELECT ON USER_B.VIEW_B TO USER_C;

 

1.PNG

 

So why can USER_B not grant the select privilege on VIEW_B (which is created by himself/herself) to USER_C???

 

The reason is very obvious. Although VIEW_B is created by USER_B, VIEW_B is based on TABLE_A which USER_C has no privilege to select. Imagine if USER_B managed to execute the Grant SQL, privileges would be nothing. Users (e.g. USER_C) could use this "workaround" to get everything (e.g. TABLE_A) through others (e.g. USER_B).

 

The solution is also very simple. We just need to let USER_A "say something" to USER_B, something like:


"Hey buddy, you can play my basketball (TABLE_A) yourself and if you have a game (VIEW_B) with others (USER_C) you can also use my basketball (which means you can let others (USER_C) to touch my basketball (TABLE_A) in your game (VIEW_B))".

 

Hope you can understand this sentence well. It took me some time to create it.Now "WITH GRANT OPTION" can play a role here which can let grantee to grant the privilege to others further or something like "cascade connection" in this view scenario. So, let's try it.

 

Step 5: USER_A grants the select privilege on TABLE_A to USER_B WITH GRANT OPTION.

GRANT SELECT ON USER_A.TABLE_A TO USER_B WITH GRANT OPTION;

 

Step 6: USER_C can select VIEW_B successfully.

SELECT * FROM USER_B.VIEW_B;

 

Example 2

Now let's try another example which is similar with the scenario in Re: insufficient privilege to select from database view In this example, we will let USER_A grant select privilege on TABLE_A to USER_C first.

 

Step 1: SYSTEM creates three users, USER_A, USER_B and USER_C.

CREATE USER USER_A PASSWORD Initial1;
CREATE USER USER_B PASSWORD Initial1;
CREATE USER USER_C PASSWORD Initial1;

 

Step 2: USER_A creates TABLE_A under schema USER_A and grants the select privilege on that table to USER_B and USER_C. Notice: There is no WITH GRANT OPTION in this step.

CREATE COLUMN TABLE USER_A.TABLE_A (ID INTEGER);
GRANT SELECT ON USER_A.TABLE_A TO USER_B;
GRANT SELECT ON USER_A.TABLE_A TO USER_C;

 

Step 3: USER_B creates VIEW_B under schema USER_B based on TABLE_A and grants the select privilege on the whole schema USER_B to USER_C.

CREATE VIEW USER_B.VIEW_B AS SELECT * FROM USER_A.TABLE_A;
GRANT SELECT ON SCHEMA USER_B TO USER_C;

 

Step 4: USER_C tries to select VIEW_B but fails.

SELECT * FROM USER_B.VIEW_B;

 

2.PNG

 

Again why??? Maybe you are confused now as follows.

1. Since USER_A grants select privilege on TABLE_A to USER_C, USER_C can select TABLE_A. It's true. USER_C can run the following SQL successfully.

SELECT * FROM USER_A.TABLE_A;

 

2. Since USER_B grants select privilege on the whole schema USER_B to USER_C, USER_C should be enabled to select everything under schema USER_B. But is it true? From the error message, point 2 is not true. But why???

 

We can still use the basketball example. Imagine the following.

1. USER_A says to USER_B "Hey USER_B, you can play my basketball yourself."

2. USER_A says to USER_C "Hey USER_C, you can play my basketball yourself."

3. USER_B says to USER_C "Hey USER_C, you can always play basketball with me."

 

There is no problem if USER_C joins USER_B's games in which USER_B uses his own basketball. But if USER_B uses USER_A's basketball in a game, can USER_C join this game? Nope, since USER_A does not say to USER_B "If you have a game (VIEW_B) with others (USER_C) you can also use my basketball (which means you can let others (USER_C) to touch my basketball (TABLE_A) in your game (VIEW_B))". That's the reason. Hope you can also understand it well.

 

If you do not understand the reason. Here is another reason for you. Imagine the following if you still think there should be no error in step 4.

1. If there were no error in step 4, USER_B would know USER_C could select TABLE_A.

2. If there were error in step 4, USER_B would know USER_C could not selct TABLE_A.


Users (e.g. USER_B) could use this "method/workaround" to know/infer some privileges of others (e.g. USER_C).

 

But why can USER_B know/infer this??? Does USER_A tell him? Nope. Does USER_C tell him? Nope. The privileges of USER_C should be a secret to USER_B!!! That's why USER_C cannot select VIEW_B so far. So, we still need "WITH GRANT OPTION" to solve the problem.

 

Step 5: USER_A grants the select privilege on TABLE_A to USER_B WITH GRANT OPTION.

GRANT SELECT ON USER_A.TABLE_A TO USER_B WITH GRANT OPTION;

 

Step 6: USER_C can select VIEW_B successfully now.

SELECT * FROM USER_B.VIEW_B;

 

Example 3

If we say there is USER_D now. USER_C wants to create VIEW_C based on VIEW_B under schema USER_C and let USER_D select VIEW_C. What will happen and how does the SQL look like? I will not explain more about this example. You can take this as an exercise.

 

I just pasted my code here.

--SYSTEM
CREATE USER USER_A PASSWORD Initial1;
CREATE USER USER_B PASSWORD Initial1;
CREATE USER USER_C PASSWORD Initial1;
CREATE USER USER_D PASSWORD Initial1;
--USER_A
CREATE COLUMN TABLE USER_A.TABLE_A (ID INTEGER);
GRANT SELECT ON USER_A.TABLE_A TO USER_B WITH GRANT OPTION;
--USER_B
CREATE VIEW USER_B.VIEW_B AS SELECT * FROM USER_A.TABLE_A;
GRANT SELECT ON USER_B.VIEW_B TO USER_C WITH GRANT OPTION;
--USER_C
CREATE VIEW USER_C.VIEW_C AS SELECT * FROM USER_B.VIEW_B;
GRANT SELECT ON USER_C.VIEW_C TO USER_D;
--USER_D
SELECT * FROM USER_C.VIEW_C;

 

Conclusion

Based on the above examples, we can answer the question at the beginning.

1. If your view is based on other objects which is not created by you and you want to let others read your view, you need "WITH GRANT OPTION" from the owner of your dependent objects.

2. In addition, you have the select privilege on the whole schema does not mean you can select everything under the schema.

 

You can also find it from SAP HANA Developer Guide Object Privileges - SAP HANA Developer Guide - SAP Library

"Some database objects depend on other objects. Views, for example, are defined as queries on other tables and views. The authorization for an operation on the dependent object (the queried tables and views) requires privileges for the dependent object and the underlying object. In case of views, the SAP HANA database implements the standard SQL behavior. A user has the authorization for an operation on a view if the following is true:

  • The privilege for operations on the view has been granted to the user or a role assigned to the user.
  • The owner of the view has the corresponding privileges on the underlying objects with the option to grant them to others."

 

NOTICE: This mechanism/principle should be applied not only in SAP HANA but in other databases as well, e.g. Oracle.

 

Hope you enjoyed reading my blog and doing the exercise.

SAP, Intel & VMware experts @ VMworld 2014 (Aug 24th-28th)

$
0
0

VMware has been an SAP global technology partner for a few years and we have had a lot of co-innovation, joint go to market activities and events in the past. The biggest area of co-innovation has been Virtualization of SAP applications leveraging VMware. But over the past 2 years we have expanded our partnership dramatically especially around SAP HANA & its simplification.

 

SAP HANA & VMware:

VMware has become an important SAP HANA ecosystem partner with the ability to virtualize SAP HANA to create a lower cost, higher flexibility SAP HANA instance. Leveraging the two together customers can innovate and simplify their data centers by achieving faster time-to-value, higher service levels and lower total cost of ownership (TCO).

This started out in Nov 2012 when SAP & VMware announced the capability of vSphere 5.1 to virtualize SAP HANA for test & dev purposes. Over the next 2 years we worked together very closely leading to the announcement of controlled availability of Virtualized SAP HANA for productive use in May 2014. Very soon after this Pat Gelsinger (VMware CEO) announced in Bernd Leukert’s keynote at SAPPHIRE 2014 the GA for SAP HANA virtualization in production environments using VMware vSphere 5.5.

This development helps enable IT to run at the speed of business and let the overall business focus on leveraging the immense power of SAP HANA & Intel to create true competitive advantage with simplicity and flexibility of Virtualization.

 

SAP @ VMworld 2014:

VMworld is VMware’s annual conference which has over the years become a mecca of virtualization learning & news. It’s the place to explore VMware’s complete portfolio of tools and technologies for automating virtualized data centers and extending them to the cloud. Discover how you can deliver apps efficiently and provide secure virtual workspaces. Gain insights from organizations like yours and a vibrant ecosystem of partners and industry experts on how you can redefine IT with software.

This year, SAP will be a part of the VMworld 2014(Aug 24th-28th) together with Intel, VMware by bringing in experts from the 3 companies to help answer all your questions and share the latest and greatest around SAP HANA, Intel E7 chipset which powers SAP HANA & VMware Virtualization.  Please visit the SAP Booth #1641.

 

We will have SAP speakers share more details around this at the following sessions:

60 Min breakout session: “Architecture for a Real-time Business in an era of big data” (Monday, Aug 25, 4:00 PM - 5:00 PM – Moscone West, Room 2024) https://vmworld2014.activeevents.com/connect/sessionDetail.ww?SESSION_ID=3526

 

20 Min Theatre session: “Innovating the Modern Data Center with SAP HANA” (Monday, Aug 25, 11:50 AM - 12:10 PM – Solutions Exchange Theater Booth 1901)

https://vmworld2014.activeevents.com/connect/sessionDetail.ww?SESSION_ID=3571

 

If you need to setup a 1:1 meeting with some of our experts to discuss your specific case please reach out to Diane McSweeney: diane@bootstrap-mktg.com

 

Apart from this there are a number of SAP-VMware ecosystem partners who have additional sessions around SAP products & solutions, which will be a great opportunity to get even more details around our offerings and their implementation. You could visit the SAP booth to get details on all those sessions too.

SAP Landscape Transformation (LT) Software: How to Successfully Switch to SAP HANA

$
0
0

hanaLT.png

More and more SAP customers want to migrate their applications to the in-memory database SAP HANA – but they don’t know how. They were advised to watch the presentation that Bernd Noll, a member of SAP Active Global Support, held at the beginning of July in Orlando at the SAPPHIRE conference. Together with SUSE, the SAP transformation specialist invited experts to hear an overview of the current SAP HANA migration options – “powered by SUSE and driven by SAP Landscape Transformation (LT) Software.”


It is no wonder that SAP appeared together with SUSE at this event, especially since SAP recommends and supports the SUSE Linux Enterprise Server operating system for optimal use of SAP HANA. “SAP has already registered thousands of satisfied SAP HANA customers – which means there are also thousands of satisfied SUSE Linux customers – and this number is increasing every day,” stated Bernd Noll while summing up this close partnership.


Complex System Landscapes, Huge Data Volumes


For most companies, switching to SAP HANA presents the challenge of transforming complex system landscapes with huge data volumes. There are three approaches to this:


  1. “Lift and Shift”: This is regarded as the standard approach, whereby all master data and transaction data from one system is migrated to SAP HANA.
  2. “Carve Out”: Only selected data from one system is migrated.
  3. “Consolidation”: Only selected data from multiple systems is migrated.

Several Birds with One Stone

“Both the carve-out and the consolidation approach offer companies an advantage in that they migrate only the data that is actually required to SAP HANA, without having to migrate superfluous data,” emphasized Bernd Noll in his presentation. “Both approaches are optimally supported by the SAP Landscape Transformation (LT) tool, most notably the SAP Landscape Transformation Server.”

By using the SAP LT tools, customers can:

  • Combine multiple activities into one step, such as selective migration, data harmonization, system consolidation, etc.
  • Ensure process continuity
  • Retain flexibility by combining this migration with operating system and database migration, upgrades, and Unicode migrations.
  • Standardize and consolidate business processes    
  • Minimize downtime
  • Accelerate project success
  • Reduce TCO
  • Minimize risks


Watch the YouTube video.

Viewing all 927 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>