Quantcast
Channel: SCN : All Content - SAP HANA Developer Center
Viewing all 6745 articles
Browse latest View live

Order of calculations

$
0
0

If you have calculations in a calcuation or analytic view and you use procedures, which get executed first?  Is there a best practice document that discusses order of calculation?


Sql trace

$
0
0

Hi everyone,

 

I was wondering if there was any way to setup sql trace directly through sql without having to go through Hana studio or modifying the config file.

Also, is there any way to restrict directly this trace to a single schema, instead of having to retrieve every table/view in this schema and add them one by one?

 

Thanks,

Benjamin.

Reverse Replication

$
0
0

Hello Guys,

 

Can Hana DB write back in ECC in reverse ways how it replicate from ecc to ECC Database? If yes what need to be donein ordere to achieve these ?

 

Please suggest

Not able to create root package for workspace after upgrade to REV 56

$
0
0

Hi,

 

I upgraded by AWS instance to rev 56 but after that, I am not able to create a workspace.

I have confirmed the following are correct :-

 

Ports 30015 and 8000 are open for inbound in the security group that is assigned to my instance.

Elastic IP is associated to my instance

SYSTEM user's password is correct

HDBSQL is working.

Version is 1.00.56.377318

REGI location is updated correctly

All the services in HANA instance is running successfully.

 

PFA screenshots for the same

 

Ping does not work.

I have also attached the exception. One thing i noticed is that the JDBC ip address is not the same as my Elastic IP address.

Can this be the reason of the problem?

 

Any help or guidance would be much appreciated.

 

Thanks,

Aashrith.

 

I have added the screenshots for the same in the attachement. I have changed the extension to .txt. Please change it back to .zip and unzip to view the .png images.

 

@ Moderators : request some leeway as I am unable to attach the screenshots to this post.

Real-time sentiment rating of movies on SAP HANA One

$
0
0

I am an intern visiting Palo Alto from SAP’s Shanghai office for a month-long project. It’s my first trip to the bay area so I am soaking up all the sun and all the excitement here. Last weekend, I found myself wanting to watch a movie. I searched the internet and found all the new releases listed on rottentomatoes and imdb but it was hard to pick one. I wanted to get a pulse of the movie before I watch it not from the critics but actual movie goers like me. Also, I wanted one which had high buzz not only in US but also in China. So I decided, why don’t I build one myself, after all I am in the heart of Silicon Valley.

 

I decided to pick SAP HANA One to power my app not just because I got the db & application server in the cloud but also because the platform would support sentiment analysis for English & Simplified Chinese right out-of-the-box! I used the Rotten Tomatoes API to find newly released movies and twitter & Sina Weibo APIs for sentiment for US & China respectively.

 

I did most of my work in the HANA Studio which is based on the eclipse IDE so very familiar for Java and other open-source developers.

1.jpg

 

Schema

 

First, I created a schema and full text index for all the movie metadata, including title, rating, running time, release data, synopsis, etc. Then I used the JTomato (https://github.com/geeordanoh/JTomato) to populate the table.

 

MOVIE: Stores movie metadata, including the title, rating, runtime, release date, etc.

2.jpg

Then I used Twitter4J (http://twitter4j.org) to search the movie keywords on Twitter. I found that twitter, given just the keyword, did a good job pulling all combinations of the movie name: fast and furious, fast & furious.

 

TWEET: Stores crawled tweets from Twitter, including ID, time, location, content, etc.

3.jpg

However, I ran into problems while crawling Sina Weibo because they have a strict process for usage of their API. So I decided to use Tencent Weibo instead.

 

TWEET_ZH: Stores crawled tweets from Tencent Weibo

4.jpg

Next I created a fulltext index and sentiment tables (called VoiceOfCustomer) using the following SQL. Voila! I now have sentiment analysis for all twitter and tencent weibo data!

 

CREATE FULLTEXT INDEX TWEET_I ON TWEET (CONTENT) CONFIGURATION 'EXTRACTION_CORE_VOICEOFCUSTOMER' ASYNC FLUSH EVERY 1 MINUTESLANGUAGE DETECTION ('EN') TEXT ANALYSIS ON;


CREATE FULLTEXT INDEX TWEET_ZH_I ON TWEET_ZH (CONTENT) CONFIGURATION 'EXTRACTION_CORE_VOICEOFCUSTOMER' ASYNC FLUSH EVERY 1 MINUTESLANGUAGE DETECTION ('ZH') TEXT ANALYSIS ON;

 

TWEET_I: Used to perform sentiment analysis for the table TWEET

5.jpg

TWEET_ZH_I: Used to perform sentiment analysis for the table TWEET_ZH

6.jpg

In addition to the tables in SAP HANA and the full text index to perform sentiment analysis, I also wrote stored procedures to wrap complex SQL making it easy for XS (HANA’s application server) to consume.

 

Architecture

 

The final architecture looks like this:

7.jpg

 

Rating


Now, I had to create a formula to quantify rating. I used a very simple formula for this:

 

Score = (# of strong positive sentiment * 5 + # of weak positive sentiment * 4 + # of neutral sentiment * 3 + # of weak negative sentiment * 2 + # of strong negative sentiment *1) / # of total sentiments

 

This score would be helpful to rank movies so I could easily pick the top one.

 

Additionally, I showed a distribution of the sentiments, positive vs. negative vs. neutral, so I could better understand how strong or weak people’s opinion was on the movie both in US & in China.

 

XS Application

 

The application should be built on XS Engine to prevent data transfer latency between the database and the web application server so users can access the website directly. The application was built in the following steps:

 

Step 1: Create stored procedures for rating and sentiment analysis

Currently, there are two stored procedures in the app. One is for rating and the other is for sentiment analysis:

 

1. Rating

We can use the following SQLs to create the type and the stored procedure:

 

CREATETYPE MOVIEINFO ASTABLE (

      POSTER NVARCHAR(100),

      TITLE NVARCHAR(100),

      RATING DECIMAL(5, 2),

      NUM INTEGER,

      TITLE_ZH NVARCHAR(100),

      RATING_ZH DECIMAL(5, 2),

      NUM_ZH INTEGER,

      YEARINTEGER,

      MPAA_RATING NVARCHAR(100),

      RUNTIME NVARCHAR(100),

      CRITICS_CONSENSUS NVARCHAR(2000),

      RELEASE_DATE DATE,

      SYNOPSIS NVARCHAR(2000),

      ID INTEGER

);

 

CREATEPROCEDURE GETMOVIEINFO(OUT RESULT MOVIEINFO) LANGUAGE SQLSCRIPT READS SQL DATA AS

BEGIN

RESULT =

SELECT A.POSTER, A.TITLE, B.RATING, B.NUM, A.TITLE_ZH, C.RATING_ZH, C.NUM_ZH, A.YEAR, A.MPAA_RATING, A.RUNTIME, A.CRITICS_CONSENSUS, A.RELEASE_DATE, A.SYNOPSIS, A.ID

FROM MOVIE A

 

INNERJOIN

 

(SELECT ID, CASESUM(NUM) WHEN 0 THEN 0 ELSETO_DECIMAL(SUM(TOTAL) / SUM(NUM), 5, 2) ENDAS RATING, SUM(NUM) AS NUM FROM

(SELECT

  1. A.ID,
  2. C.TA_TYPE,

COUNT(C.TA_TYPE) AS NUM,

CASE C.TA_TYPE

      WHEN'StrongPositiveSentiment'THENCOUNT(C.TA_TYPE) * 5

      WHEN'WeakPositiveSentiment'THENCOUNT(C.TA_TYPE) * 4

      WHEN'NeutralSentiment'THENCOUNT(C.TA_TYPE) * 3

      WHEN'WeakNegativeSentiment'THENCOUNT(C.TA_TYPE) * 2

      WHEN'StrongNegativeSentiment'THENCOUNT(C.TA_TYPE) * 1

ENDAS TOTAL

FROM MOVIE A

LEFTJOIN TWEET B

ON A.ID = B.MOVIEID

LEFTJOIN"$TA_TWEET_I" C

ON B.ID = C.ID AND C.TA_TYPE IN ('StrongPositiveSentiment', 'WeakPositiveSentiment', 'NeutralSentiment', 'WeakNegativeSentiment', 'StrongNegativeSentiment')

GROUPBY

  1. A.ID,
  2. C.TA_TYPE) A

GROUPBY ID) B ON A.ID = B.ID

 

INNERJOIN

 

(SELECT ID, CASESUM(NUM) WHEN 0 THEN 0 ELSETO_DECIMAL(SUM(TOTAL) / SUM(NUM), 5, 2) ENDAS RATING_ZH, SUM(NUM) AS NUM_ZH FROM

(SELECT

  1. A.ID,
  2. C.TA_TYPE,

COUNT(C.TA_TYPE) AS NUM,

CASE C.TA_TYPE

      WHEN'StrongPositiveSentiment'THENCOUNT(C.TA_TYPE) * 5

      WHEN'WeakPositiveSentiment'THENCOUNT(C.TA_TYPE) * 4

      WHEN'NeutralSentiment'THENCOUNT(C.TA_TYPE) * 3

      WHEN'WeakNegativeSentiment'THENCOUNT(C.TA_TYPE) * 2

      WHEN'StrongNegativeSentiment'THENCOUNT(C.TA_TYPE) * 1

ENDAS TOTAL

FROM MOVIE A

LEFTJOIN TWEET_ZH B

ON A.ID = B.MOVIEID

LEFTJOIN"$TA_TWEET_ZH_I" C

ON B.ID = C.ID AND C.TA_TYPE IN ('StrongPositiveSentiment', 'WeakPositiveSentiment', 'NeutralSentiment', 'WeakNegativeSentiment', 'StrongNegativeSentiment')

GROUPBY

  1. A.ID,
  2. C.TA_TYPE) A

GROUPBY ID) C ON A.ID = C.ID

ORDERBY B.RATING DESC

;

END;


After creating the type and the stored procedure successfully, we can use the following SQL to test:

 

CALL GETMOVIEINFO(?);

8.jpg

From the column “RATING” and “RATING_ZH”, we can show the score on the main page.

 

2. Sentiment analysis

We can use the following SQLs to create the type and the stored procedure:

 

CREATETYPE SENTIMENT ASTABLE (SENTIMENT NVARCHAR(100), NUM INTEGER);

 

CREATEPROCEDURE GETSENTIMENT(IN ID INTEGER, IN LANG VARCHAR(2), OUT RESULT SENTIMENT) LANGUAGE SQLSCRIPT READS SQL DATA AS

BEGIN

      IF LANG = 'EN'THEN

      RESULT = SELECT'Strong Positive'AS SENTIMENT, COUNT(*) AS NUM FROM"$TA_TWEET_I" A

            INNERJOIN (SELECT ID FROM TWEET WHERE MOVIEID = :ID) B

            ON A.ID = B.ID

            WHERE A.TA_TYPE = 'StrongPositiveSentiment'

            UNIONALL

            SELECT'Weak Positive'AS SENTIMENT, COUNT(*) AS NUM FROM"$TA_TWEET_I" A

            INNERJOIN (SELECT ID FROM TWEET WHERE MOVIEID = :ID) B

            ON A.ID = B.ID

            WHERE A.TA_TYPE = 'WeakPositiveSentiment'

            UNIONALL

            SELECT'Neutral'AS SENTIMENT, COUNT(*) AS NUM FROM"$TA_TWEET_I" A

            INNERJOIN (SELECT ID FROM TWEET WHERE MOVIEID = :ID) B

            ON A.ID = B.ID

            WHERE A.TA_TYPE = 'NeutralSentiment'

            UNIONALL

            SELECT'Weak Negative'AS SENTIMENT, COUNT(*) AS NUM FROM"$TA_TWEET_I" A

            INNERJOIN (SELECT ID FROM TWEET WHERE MOVIEID = :ID) B

            ON A.ID = B.ID

            WHERE A.TA_TYPE = 'WeakNegativeSentiment'

            UNIONALL

            SELECT'Strong Negative'AS SENTIMENT, COUNT(*) AS NUM FROM"$TA_TWEET_I" A

            INNERJOIN (SELECT ID FROM TWEET WHERE MOVIEID = :ID) B

            ON A.ID = B.ID

            WHERE A.TA_TYPE = 'StrongNegativeSentiment';

      ELSEIF LANG = 'ZH'THEN

      RESULT = SELECT'很好'AS SENTIMENT, COUNT(*) AS NUM FROM"$TA_TWEET_ZH_I" A

            INNERJOIN (SELECT ID FROM TWEET_ZH WHERE MOVIEID = :ID) B

            ON A.ID = B.ID

            WHERE A.TA_TYPE = 'StrongPositiveSentiment'

            UNIONALL

            SELECT''AS SENTIMENT, COUNT(*) AS NUM FROM"$TA_TWEET_ZH_I" A

            INNERJOIN (SELECT ID FROM TWEET_ZH WHERE MOVIEID = :ID) B

            ON A.ID = B.ID

            WHERE A.TA_TYPE = 'WeakPositiveSentiment'

            UNIONALL

            SELECT'一般'AS SENTIMENT, COUNT(*) AS NUM FROM"$TA_TWEET_ZH_I" A

            INNERJOIN (SELECT ID FROM TWEET_ZH WHERE MOVIEID = :ID) B

            ON A.ID = B.ID

            WHERE A.TA_TYPE = 'NeutralSentiment'

            UNIONALL

            SELECT''AS SENTIMENT, COUNT(*) AS NUM FROM"$TA_TWEET_ZH_I" A

            INNERJOIN (SELECT ID FROM TWEET_ZH WHERE MOVIEID = :ID) B

            ON A.ID = B.ID

            WHERE A.TA_TYPE = 'WeakNegativeSentiment'

            UNIONALL

            SELECT'很差'AS SENTIMENT, COUNT(*) AS NUM FROM"$TA_TWEET_ZH_I" A

            INNERJOIN (SELECT ID FROM TWEET_ZH WHERE MOVIEID = :ID) B

            ON A.ID = B.ID

            WHERE A.TA_TYPE = 'StrongNegativeSentiment';

      ENDIF;

END;


After creating the type and the stored procedure successfully, we can use the following SQLs to test:

 

CALL GETSENTIMENT(771313125, 'EN', ?);

9.jpg

CALL GETSENTIMENT(771313125, 'ZH', ?);

10.jpg

Step 2: Build the application based on XS Engine

Till now, we can access the tables, indexes, data and stored procedures directly from the XS Engine. To build the application, follow the following steps:

 

1. Create .xsaccess, .xsapp and .xsprivileges to do the access control.


2. Create getMovies.xsjs to call the stored procedure “GETMOVIEINFO

 

function createEntry(rs) {

      return {

            "poster" : rs.getNString(1),

            "title" : rs.getNString(2),

            "rating": rs.getDecimal(3),

            "num": rs.getInteger(4),

            "title_zh" : rs.getNString(5),

            "rating_zh": rs.getDecimal(6),

            "num_zh": rs.getInteger(7),

            "year": rs.getInteger(8),

            "mpaa_rating": rs.getNString(9),

            "runtime": rs.getNString(10),

            "critics_consensus": rs.getNString(11),

            "release_date": rs.getDate(12),

            "synopsis": rs.getNString(13),

            "id": rs.getInteger(14)

      };

}

 

try {

      var body = '';

      var list = [];

 

      var query = "{CALL SMARTAPP.GETMOVIEINFO(?)}";

      $.trace.debug(query);

      var conn = $.db.getConnection();

      var pcall = conn.prepareCall(query);

      pcall.execute();

      var rs = pcall.getResultSet();

 

      while (rs.next()) {

            list.push(createEntry(rs));

      }

 

      rs.close();

      pcall.close();

      conn.close();

 

      body = JSON.stringify({

            "entries" : list

      });

 

      $.response.contentType = 'application/json; charset=UTF-8';

      $.response.setBody(body);

      $.response.status = $.net.http.OK;

} catch (e) {

      $.response.status = $.net.http.INTERNAL_SERVER_ERROR;

      $.response.setBody(e.message);

}

 

3. Create getSentiment.xsjs to call the stored procedure “GETSENTIMENT”

 

function createEntry(rs) {

      return {

            "sentiment" : rs.getString(1),

            "num" : rs.getInteger(2)

      };

}

 

try {

      var id = parseInt($.request.parameters.get("id"));

      var lang = $.request.parameters.get("lang");

 

      var body = '';

      var list = [];

 

      var query = "{CALL SMARTAPP.GETSENTIMENT(?, ?, ?)}";

      $.trace.debug(query);

      var conn = $.db.getConnection();

      var pcall = conn.prepareCall(query);

      pcall.setInteger(1, id);

      pcall.setString(2, lang);

      pcall.execute();

      var rs = pcall.getResultSet();

 

      while (rs.next()) {

            list.push(createEntry(rs));

      }

 

      rs.close();

      pcall.close();

      conn.close();

 

      body = JSON.stringify({

            "entries" : list

      });

 

      $.response.contentType = 'application/json; charset=UTF-8';

      $.response.setBody(body);

      $.response.status = $.net.http.OK;

} catch (e) {

      $.response.status = $.net.http.INTERNAL_SERVER_ERROR;

      $.response.setBody(e.message);

}

 

4. Create index.html and code the HTML part.

 

<!DOCTYPEHTML>

<html>

      <head>

            <metahttp-equiv="X-UA-Compatible"content="IE=edge">

            <title>Real-Time Movie Rating</title>

            <scriptsrc="/sap/ui5/1/resources/sap-ui-core.js"

                        id="sap-ui-bootstrap"

                        data-sap-ui-libs="sap.ui.commons,sap.ui.ux3,sap.viz"

                        data-sap-ui-theme="sap_goldreflection">

            </script>

            <!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->

 

            <script>

                        sap.ui.localResources("movieui");

                        var view = sap.ui.view({id:"idMovieMatrix1", viewName:"movieui.MovieMatrix", type:sap.ui.core.mvc.ViewType.JS});

                        view.placeAt("content");

            </script>

 

      </head>

      <bodyclass="sapUiBody"role="application">

            <h1>Real-Time Movie Rating</h1>

            <divid="content"></div>

      </body>

</html>

 

5. Create some views and controllers to use native SAP UI 5 to accelerate building the application.

 

Website

 

The live webapp is available at (http://107.20.137.184:8000/workshop/sessionx/00/ui/MovieUI/WebContent/index.html) but I bring down the AWS instance to reduce the billing cost. I have captured screenshots and a brief video if you find the server is down.

 

 

Real-time movie rating homepage

The following screenshot is the app’s main page. For each movie, there are two scores: the upper score is from Twitter and the lower score from Tencent Weibo.

 

11.jpg

I heard a lot of buzz about “Man of Steel” but it is currently ranked No. 7 so I was really curious. “Man of Steel” had a 3.72 rating but “20 Feet from Stardom” had a 4.54 rating. Interesting! Looking closer I discovered that this was because “20 Feet” had only 351 mentions but “Man of Steel” had more than 20K, meaning that a popular movie may not necessarily be the one with the highest score but could also be one which has the most buzz.         

 

I then created a page with detailed breakdown of the sentiments of the Movie’s sentiments for both Twitter and Tencent Weibo. Looks like “Man of Steel” has a higher positive sentiment in China compared to the US. Well not surprising, we like superhero movies and Superman is our favorite.

 

Sentiment/Social Media

Twitter

Tencent Weibo

#

%age

#

%age

Strong Positive

9,986

44%

528

34%

Weak Positive

5,903

26%

723

47%

Neutral

839

4%

12

1%

Weak Negative

2,067

9%

123

8%

Strong Negative

3,757

17%

166

11%

 

12.jpg

Let's see what the score on Rotten Tomatoes looks like. The critics have given it a meager 56% but 82% of the audience liked it. That number is compares well with 70% positive sentiment rating from my real-time rating app. 

13.jpg

"20 Feet from stardom" has 97% rating from critics and 100% from the audience on rottentomatoes. So my real-time rating app was able to successfully identify this hit from social sentiment on twitter. Looks like the movie is a sleeper hit!

15.jpg

14.jpg

 

This application is just a prototype now and I hope to make more enhancements to the drill-down page. For the next version, I want to use the predictive libraries in SAP HANA to create a recommendation engine for movie based on a user’s interests, something like a “Pandora for movies”. Hope you enjoyed reading my blog.

Not able to create root package for workspace after upgrade to REV 56

$
0
0

Hi,

 

I upgraded by AWS instance to rev 56 but after that, I am not able to create a workspace.

I have confirmed the following are correct :-

 

Ports 30015 and 8000 are open for inbound in the security group that is assigned to my instance.

Elastic IP is associated to my instance

SYSTEM user's password is correct

HDBSQL is working.

Version is 1.00.56.377318

REGI location is updated correctly

All the services in HANA instance is running successfully.

 

PFA screenshots for the same

 

Ping does not work.

I have also attached the error log. One thing i noticed is that the JDBC ip address is not the same as my Elastic IP address.

Can this be the reason of the problem?

 

Any help or guidance would be much appreciated.

 

Thanks,

Aashrith.

Blank screen in HANA Studio

$
0
0

Hello Gurus,

 

I have upgraded HANA studio to 1.0.56 from older version, since then I lost the capability to create attribute/analytic/calculation views, I have Amazon aws HANA instance of the same version i.e. 1.0.56.

 

When I tried to create attribute view from quick launch - it is giving me blank screen as shown in the following screenshot.

 

Could you please help?

 

 

 

blankscreen.png

 

Regards,

Abhi

HANA Certification, some doubts in these simple questions

$
0
0

Hi all,

 

I was in the HANA Cerfication last week and I finished with some doubts in some questions.

 

Which of the following can you set up to enable the extraction of data
from SAP Business Warehouse (BW) into SAP HANA? (Choose three)
A. SAP System Landscape Directory (SLD)
B. SAP BusinessObjects Data Services
C. SAP Landscape Transformation (SLT)
D. Open hub
E. SAP HANA Direct Extractor Connection (DXC)

 

My answer was B,D,E.

 

How can you restrict SAP HANA modeling users from viewing sensitive data?
A. Use scrambled source data.
B. Remove SAP_DATA_ADMIN in the SQL privileges for the modeling users.
C. Use the pre-delivered MODELER role.
D. Remove ALTER SYSTEM in the system privileges for the modeling users.

 

My answer was A.

 

You created a model on a table XYZ.PRODUCTS. You successfully activated
the model. When you run the data preview you receive an error message
"Insufficient privilege. Not authorized". Which of the following 4
statements do you execute to resolve the error before you reactivate the model?
A. GRANT SELECT on SCHEMA XYZ to _SYS_REPO
B. GRANT SELECT on PRODUCTS to _SYS_REPO WITH GRANT OPTION
C. GRANT SELECT on SCHEMA XYZ to _SYS_BIC WITH GRANT OPTION
D. GRANT SELECT on PRODUCTS to _SYS_BIC

 

My answer was B.

 

Could you help to solve my doubts?

 

Thanks in advance,


Internal error while upgrading hana to rev56 on AWS

$
0
0

Hello Everyone,

 

I am currently enrolled in the sap hana developer course provided by opensap team and I need to resolve the following issue in order to

work on my hana server in AWS.

 

while following document http://scn.sap.com/docs/DOC-30980   in order to upgrade hana instance in AWS to version 56, i got this error:

an internal error ocurred while creating a volume to upgrade hana to version 56

Do you have any idea? is it a temporary error?

I have tried several times, and also got a reply from Amazon support, but did not find any suitable solution.

Refer to attached image to check the error

thank you

Store procedure with BFL

$
0
0

HI Experts!

 

I want to create a store procedure to call a BFL Function, but when I try to execute the procedure sends the next error.

 

**********************************

Repository: info message;finished generate for OID {tenant: , package: TESTJC, name: SP_CAL_TIRR, suffix: procedure}; number of checkResults: 3; last error code 40103

 

**********************************

 

The store procedure has the next code:

 

/********* Begin Procedure Script ************/
BEGIN

--CREACIÓN DE LAS TABLAS DE CONFIGURACIÓN EN MEMORIA
DROP TABLE VALUES_TAB;
CREATE TABLE VALUES_TAB ("VALUE" DOUBLE);
DROP TABLE FLAG_TAB;
CREATE TABLE FLAG_TAB( "FLAG" DOUBLE);
DROP TABLE USERDATE_TAB;
CREATE TABLE USERDATE_TAB( "PAYDATE" VARCHAR(255));
DROP TABLE ESTIMATE_TAB;
CREATE TABLE ESTIMATE_TAB( "ESTIMATE" DOUBLE);
DROP TABLE METHOD_TAB;
CREATE TABLE METHOD_TAB( "METHOD" DOUBLE);
DROP TABLE DAYS_TAB;
CREATE TABLE DAYS_TAB( "DAYS" DOUBLE);

-- INICIALIZACIÓN DE LOS PARAMETROS DEL TIRR
INSERT INTO VALUES_TAB VALUES ('$$PRESTAMO$$'*-1);
INSERT INTO FLAG_TAB VALUES (4);
INSERT INTO USERDATE_TAB VALUES ('12/10/00');
INSERT INTO ESTIMATE_TAB VALUES (0.3);
INSERT INTO METHOD_TAB VALUES(0);
INSERT INTO DAYS_TAB VALUES(365);


-- CREACIÓN DE LOS REGISTROS PARA EL CALCULO DEL TIRR
BEGIN
DECLARE NO_PAGOS DOUBLE;
NO_PAGOS := '$$NO_PAGO$$';
WHILE NO_PAGOS > 0 DO
  INSERT INTO VALUES_TAB VALUES('$$PAGO$$');
  INSERT INTO FLAG_TAB VALUES(3);
  INSERT INTO METHOD_TAB VALUES(1);
  INSERT INTO DAYS_TAB VALUES(365);
  NO_PAGOS := :NO_PAGOS-1;
END WHILE;
END;

--INCIALIZACIÓN DE LA TABLA DE RESULTADOS
DROP TABLE RESULT_TAB;
CREATE TABLE RESULT_TAB( "INTERNALRATE" DOUBLE);


-- LLAMADO AL BLF DEL TIRR
CALL _SYS_AFL.AFLBFL_INTERNALRATE_PROC(VALUES_TAB, FLAG_TAB, USERDATE_TAB, ESTIMATE_TAB, METHOD_TAB, DAYS_TAB, RESULT_TAB) WITH OVERVIEW;
SELECT "INTERNALRATE" FROM RESULT_TAB;

END;

/********* End Procedure Script ************/

 

 

Any help will be appreciate

 

Regards

SAP QUERY SQ03- SQ01 Issue

$
0
0

Dear All

 

Like to share a problem.

Created Query with the table combination of VBAK, VBAP and MBEW.

When executing the report, an order for single line item is showing 2 line items in report or some time three line items,

 

Your help will be highly appreciated

 

Regards

"Error when connecting to system" or "Invalid Username or Password" with HANA Studio

$
0
0

If you are getting error message(s) with the HANA Studio (on Cloudshare desktop image) to the HANA DB after you enter the correct username or password:

a. "Error when connecting to system":

     ErrorWhenConnecting.JPG

b. "Invalid Username or Password":

     InvalidUser.JPG

 

The issue seems to be caused by a corrupted secure storage file.

As a workaround, please follow the following steps:

1. Delete your HANA connection on the Navigator tab in HANA Studio, and then close the HANA Studio.

2. Open windows explorer, and navigate to C:\Users\Administrator folder on your Cloudshare desktop.

3. Find the folder ".eclipse" and rename it to "OLD.eclipse":

     eclipse_folder.jpg

4. Open your HANA Studio and set your HANA DB Connection again. You will be prompted to set the password reminder for secure storage file. You can choose "No".

5. After that, the new ".eclipse" folder and the new secure storage file will be recreated.

6. Close and re-open your HANA Studio, to verify that the workaround fixed the connection issue.

 

Regards,

Ferry

Sap Hana db import and export

$
0
0

Hi,

 

We want to export a schema and import that into a different schema. We have to do this with command prompt not from hana-studio.

 

 

Please provide a information with example.

 

Regards,

Gopalakrishnan.V

Old Announcement

$
0
0

Hi,

 

How can I access old announcement? Couple of days back there was announcement about "Upgrading HANA server from revision 48 to 56 on AWS" and it had a link to very informative blog. Now I can not find it.

 

Thanks,

AWS Hana: possible to change hostname?

$
0
0

We changed the hostname on the AWS Hana instance from hanaserver to something else and got this error later:

[20263]{0}[0] 2013-06-19 14:24:32.608019 e TrexNet   

 

Communication.cpp(00966) : failed to resolve hanaserver. reason: host unknown

 

[20263]{0}[0] 2013-06-19 14:24:32.608076 e TNS          TNSClient.cpp(00695) : sendRequest setactive to hanaserver:30001 failed with NetException. data=(S)host=hanaserver|port=30002|tenant=|(I)type=2|(B)watchdog=0|(N)node=|pid=20263|activated_at=2013-06-19 14:24:27.574|...|

[20263]{0}[0] 2013-06-19 14:24:32.608086 e TNS          TNSClient.cpp(00637) : nameserver hanaserver:30001 not responding. retry in 5 sec...

 

We changed the hostname back to resolve the issue. If it possible to change the hostname? It doesn't seem to make sense if we have multiple Hana instances and they all have the same hostname.

 

Thanks!


Getting all table names from a Schema???

$
0
0

Hello,

I am new to SAP HANA, Just learning.

Today i got a task in which i have to find a specific term in the DB. But for this i have to search all tables .

So can anyone please help me in that?

 

I just want to know how to get ALL TABLE NAME by passing a SQL query??? and how to search a perticular term in that?

Just imagine my Schema name is 'KHAN' and i want to search 'skin cancer' in that. I have details about this in two tables so how to get this from passing a single query???

Help me please !!!

Calling XSJS Service using SAP UI5

$
0
0

Hi Everyone,

 

In the blog SAP HANA Extended Application Services( http://scn.sap.com/community/developer-center/hana/blog/2012/11/29/sap-hana-extended-application-services) by Thomas Jung, he showed us lots of things about XS development and one of them was how to create and extend Server Side JavaScript and it was explained beautifully in the video :

http://www.youtube.com/watch?v=ckw_bhagvdU

 

At the end in the above video, Thomas told us about Calling the XSJS Service From the User Interface :

 

Here i would like to tell how to create the UI files and then call xsjs service step by step

 

1. We will go to Project Explorer tab in SAP HANA Development perspective and then R-Click and select Other:

 

1.jpg

 

2. Select SAP UI5 Application Development and then select Application Project:

 

2.jpg

 

3. We will enter project name and select Desktop for rendering the ui on our desktop and also select create an initial view so that wizard creates a view for us

 

3.jpg

 

4. Enter the name of the View that we need to create Select JavaScript rendering for our purpose

 

4.jpg

 

5. We found that wizard created three objects for us:

index.html

XSUI.controller.js

XSUI.view.js

In index.html file we will enter the full path of Source as

src="/sap/ui5/1/resources/sap-ui-core.js"

 

5.jpg

 

6. After that enter the following code in XSUI.controller.js file :

 

sap.ui.controller("xsui.XSUI", {          onLiveChangeV1: function(oEvent,oVal2){                    var aUrl = '../../../Services/Func.xsjs?cmd=multiply'+'&num1='+escape(oEvent.getParameters().liveValue)+'&num2='+escape(oVal2.getValue());                    jQuery.ajax({                              url: aUrl,                              method: 'GET',                              dataType: 'json',                              success: this.onCompleteMultiply,                              error: this.onErrorCall });          },          onLiveChangeV2: function(oEvent,oVal1){                    var aUrl = '../../../services/Func.xsjs?cmd=multiply'+'&num1='+escape(oVal1.getValue())+'&num2='+escape(oEvent.getParameters().liveValue);                    jQuery.ajax({                              url: aUrl,                              method: 'GET',                              dataType: 'json',                              success: this.onCompleteMultiply,                              error: this.onErrorCall });          },          onCompleteMultiply: function(myTxt){                    var oResult = sap.ui.getCore().byId("result");                     if(myTxt==undefined){ oResult.setText(0); }                     else{                       jQuery.sap.require("sap.ui.core.format.NumberFormat");                       var oNumberFormat = sap.ui.core.format.NumberFormat.getIntegerInstance({                          maxFractionDigits: 12,                          minFractionDigits: 0,                          groupingEnabled: true });                       oResult.setText(oNumberFormat.format(myTxt)); }          },          onErrorCall: function(jqXHR, textStatus, errorThrown){                     sap.ui.commons.MessageBox.show(jqXHR.responseText,                                          "ERROR",                                         "Service Call Error" );                     return;           }
});

 

7. After that enter the following code in XSUI.view.js file

 

sap.ui.jsview("xsui.XSUI", {      getControllerName : function() {         return "xsui.XSUI";      },      createContent : function(oController) {                var multiplyPanel = new sap.ui.commons.Panel().setText("XS Service Test - Multiplication");                multiplyPanel.setAreaDesign(sap.ui.commons.enums.AreaDesign.Fill);                multiplyPanel.setBorderDesign(sap.ui.commons.enums.BorderDesign.Box);                  var layoutNew = new sap.ui.commons.layout.MatrixLayout({width:"auto"});                multiplyPanel.addContent(layoutNew);                var oVal1 = new sap.ui.commons.TextField("val1",{tooltip: "Value #1", editable:true});                var oVal2 = new sap.ui.commons.TextField("val2",{tooltip: "Value #2", editable:true});                var oResult = new sap.ui.commons.TextView("result",{tooltip: "Results"});                var oEqual = new sap.ui.commons.TextView("equal",{tooltip: "Equals", text: " = "});                                var oMult = new sap.ui.commons.TextView("mult",{tooltip: "Multiply by", text: " * "});                 //Attach a controller event handler to Value 1 Input Field                      oVal1.attachEvent("liveChange", function(oEvent){                            oController.onLiveChangeV1(oEvent,oVal2); });                  //Attach a controller event handler to Value 2 Input Field                      oVal2.attachEvent("liveChange", function(oEvent){                            oController.onLiveChangeV2(oEvent,oVal1); });                              layoutNew.createRow(oVal1, oMult, oVal2, oEqual, oResult );                   return multiplyPanel;      }


});

 

8. Now we will save all the files and share the project

 

10.jpg

 

9. Now Select SAP HANA Repository:

 

11.jpg

 

10. Inside the repository select the folder where you would like to share it : I selected UI5 folder here

 

12.jpg

 

11. Now we will commit and activate our UI5 project :

 

13.jpg

 

12. As we share our XSUI project in UI5 folder in the repository, so now we can see that in our project explorer also :

 

15.jpg

 

13. Now in Services folder we will create Func.xsjs file that we have used in our Controller and View in XSUI project.

 

16.jpg

 

14. Now enter the following code in Func.xsjs file :

 

function performMultiply() 
{          var body = '';         var num1 = $.request.getParameter('num1');          var num2 = $.request.getParameter('num2');          var answer;          answer = num1*num2;          body = answer.toString();          $.response.addBody(body);          $.response.setReturnCode($.net.http.OK);
}


var aCmd = $.getParameter('cmd');
switch(aCmd)
{
          case "Multiply": performMultiply();          break;          default:                     $.response.setReturnCode($.net.http.INTERNAL_SERVER_ERROR);                    $.response.addBody("Invalid Choice" +aCmd);
}

 

15. In the browser enter address :  http://ipaddress:8000/path/index.html

 

f.jpg

 

As in the aboveexample we have used JavaScript, JSON, Ajax and JQuery, so i would also like to tell you some basics about them

 

First i will start with JavaScript

 

JavaScript is a Object based Scripting language. It is not a Object Oriented language.

• Client-side JavaScript allows an application to place elements on an HTML form and respond to user events such as mouse clicks, form input, and page navigation.

• Server-side JavaScript allows an application to communicate with a relational database, provide continuity of information from one invocation to another of the application, or perform file manipulations on a server.

 

Features:

JavaScript is very light language

JavaScript supports only supports data type but doesn't support variable type.

For Example:

In Java or C++, if we define a variable of integer type we will define it as :

int a; // so 'a' cannot hold anything other than integer

 

 

But in case of JavaScript, we only define:

var a; // here 'a' can be a string an integer or anything else
a = hello; // 'a' becomes string
a = '10'; // here 'a' becomes an integer

 

JavaScript doesn't have Keywords like Class, Private, Public but there are different ways through which we can make an object Public or Private and we can even use Inheritance concept in JavaScript through the use of prototype and inherit from.

To learn more about JavaScript, please visit http://www.w3schools.com/js/ or http://www.javascriptkit.com/

 

SAP HANA has JavaScript editor that includes the JSLint open-source library, which helps to validate JavaScript code.

For debugging purpose:

We can use SPA HANA debug perspective or any browser like Chrome and Mozilla Firefox.

Chrome has default JavaScript debugger and for Mozilla, we can download a plugin called Firebug.

There is also a free online tool called jsfiddle that can be used to create, debug and run your JavaScript code along with HTML and CSS.

jsfiddle : http://jsfiddle.net/

 

jsfiddle.jpg

 

Now moving on to JQuery :

 

JQuery is a JavaScript Library and it simplifies our JavaScript Coding as we don't need to write many lengthy codes.

In the OPenSAP course in Week 4 Unit 3 example a JQuery function fadeout() was used on Button.

 

To learn more about JQuery, visit http://www.w3schools.com/jquery/ or http://learn.jquery.com/

 

Now about JSON :

 

Well JSON stands for JavaScript Object Notation.

It is a light weight data interchange format and it is preferred over XML because:

In XML, Parsing is difficult and XML doesn't support rich data type( everything is written in the form of string )

Other benefits of JSON are that :

Data is typeless and values can be assigned dynamically.

Its Syntax is written in key and value pair

For Example => User(Key) : Name(Value)

 

We can use eval  and JSON.parse functions to convert JSON String into JavaScript string.

JSON.parse is preferref over eval because of the following reason :

When we use eval to parse JSON data, eval is always active and it might be used to create malicious data that can be harmful to our sources.

For learning JSON visit : http://www.w3schools.com/json/default.asp

 

Finally AJAX :

 

AJAX stands for Ashynchronous JavaScript and XML

It is one of the Web 2.0 standards and is used by web applications to send data to and retrieve  data from a server asynchrously without interfering in the display and beahaviour of the existing page.

It runs completely independent of the browser and no plugins are required.

Google Suggest was the very first example of using AJAX.

In most of the payment sites we generally see " Please Wait! Your Order is being processed" - this is done through the help of AJAX only.

One of the sites from where we can download those moving GIFs for our web design is : http://ajaxload.info/

For learning AJAX visit : http://www.w3schools.com/ajax/

 

Thank You for reading the Blog.

As this is my very first Blog so i would like to get feedback

SAP HANA Repository does not show the folders as shown in tutorial Video

$
0
0

Hi,

 

I just followed the steps to configure the SAP HANA Studio.

 

However, the folders in the SAP HANA Repository are different from the one shown in the tutorial video. Week 1 Unit 5.

 

HANA Repository.JPG

 

Please help me resolve this issue

OData for Calc. view - Parameter problems

$
0
0

Hi,

 

i need some help with the input parameters of an OData service. I'm trying to consume a calculation view via a OData service which has three parameters.

- P_DATEFROM (Date)

- P_DATETO   (Date)

- P_REGION (String)

 

I used a similiar definition like here: http://scn.sap.com/community/developer-center/hana/blog/2013/01/22/rest-your-models-on-sap-hana-xs

The definition of the service works fine, but if i try to open it with some parameters i receive an error:

 

http://server:port/path/service.xsodata/InputParams(P_DATEFROM='2012-01-11',P_DATETO='2012-01-15',P_REGION='BIN')/Results?$select=NAME,REGION

=> Illegal query syntax.

 

I'm not sure what is wrong, but i think the date format is not 100% right and i can't figure out what.

 

Thanks and best regards.

Manu

Problem concerning upgrade of HANA AWS edition

$
0
0

Hi folks,

I was following the upgrade guide from Juergen Schneider but I am getting this user/password error.

I changed already the password of the root user and I also changed already the password of the dbuser SYSTEM.

I am a bit lost here, anyone any idea what I can do?

Thanks+Regards, Thomas

 

 

 

 

Checking installation...

Preparing package "AFL"...

Installing SAP Application Function Libraries to /usr/sap/HDB/exe/linuxx86_64/plugins/afl_1.00.56.377318_1097292...

Installation done

Log file written to '/var/tmp/hdb_afl_2013-06-17_08.27.02/hdbinst_afl.log'.

 

 

SAP HANA Database Installation Manager - Database Upgrade 1.00.56.377318

************************************************************************

 

 

  Upgrade failed

    Unknown user password combination

 

 

 

 

 

08:25:52.663 - INFO:   New link '/usr/sap/HDB/exe/linuxx86_64/plugins/afl_new' already po

ints to the right version

08:25:52.665 - INFO: Server version not compatible with plugin, skipping activation of pl

ugin

08:25:52.665 - INFO:   ---------------------------------------------------------

08:25:52.665 - INFO:   END: Installing SAP Application Function Libraries  start: 08:25:52.64

8 duration: 00:00:00.016

08:25:52.665 - INFO:   ---------------------------------------------------------

08:25:52.665 - INFO:   Installation done

imdbhdb:~/update #

imdbhdb:~/update #

imdbhdb:~/update #

Viewing all 6745 articles
Browse latest View live


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