Hana specific code to data Flashcards
Are keywords case sensitive in HANA native or Open SQL?
No
In HANA native SQL are table and column names converted to uppercase?
Only if they are not enclosed in double quotes
If I need to access a data source not defined in the ABAP data dictionary, what must I use?
HANA native SQL
In HANA native SQL where must the element list be placed?
After the FROM clauses
What is the source/field separator in HNSql?
a period
table.field
What is the difference in Schema handling between HNSql and OSql?
HNSql uses the default implicit (user) schema or schema name before table name
OSql can only use the default schema
In Hana Native SQL how is the client handled?
It must be specified, there is no implicit client handling
What is the difference in the syntax of HNSql and OSql when it comes to limiting the number of rows selected?
In HNSql it is the keyword TOP In OSql it is the phrase UP TO # ROWS e.g TOP 50 UP TO 50 ROWS
Does HANA Native SQL have access to CDS views?
Yes and no, it won’t have access to the CDS as defined in the data dictionary but it will have access to the underlying SQL view created by the CDS
What are two common Open SQL clauses that are not supported in HANA native SQL?
FOR ALL ENTRIES
CORRESPONDING FIELDS
There is no syntax check for HANA Native SQL in ABAP. How can a syntax check be carried out?
In Eclipse, use SQL Console to test the statements
What is difference between dats_days_between and days_between
the dats_ are used in open sql because dates are stored as numeric strings yyyymmdd
In hana dates are stored based on the sql standard of yyyy-mm-dd and can use standard sql functions like days_between
What are the advantages of AMDPs?
AMDPs allow database procedures to be fully maintained and managed in ABAP.
All SQLscript syntax checking, debugging, transporting..
How are AMDPs created?
As a method in a class where the method definition includes the keywords BY DATABASE PROCEDURE in the implementation. This method then contains SQLscript instead of ABAP commands. e.g. METHOD my_method BY DATABASE PROCEDURE. ...sqlscript ...sqlscript ENDMETHOD.
If an AMDP method will be part of a class, what interface must be present in the public section of the class.
IF_AMDP_MARKER_HDB
What types must be used for parameters of AMDP methods?
Scalar types. These are SQL-92 compliant types
Or table types with scalar columns
AMPD methods can have all types of paramters; Import export changing returning?
No, returning is not available
Parameters of AMDP can refer to ABAP dictionary structures as long as the structure only contains elementary components?
False. You cannot use ABAP dictionary structure type regardless of their components
Table types can be used as parameters in AMDPs?
Yes, but the line of the table must be simple. Nothing nested is allowed. All fields must be scalar.
Can the parameters of the AMDP have default values?
Yes
The AMDP method must be in the public section of the class?
Incorrect, it can be public, protected, or private
Write an example of method that calls a AMDP
Method my_amdp BY DATABASE PROCEDURE FOR hdb LANGUAGE sqlscript OPTIONS read-only -- not required USING bkpf vbak ...sqlscript starts here
AMDP methods are instance methods?
Yes and no. They are defined in as methods, not class-methods, but they are executed as static methods
If the AMPD uses ABAP tables or other objects, or calls other AMDPs, these must be listed in the USING clause of the method implementation
True
SQLScript statements are ended with a…?
Semi-colon ;
How are comments added in SQLScript?
two dashes –
or a * in column 1
In SQLScript, the host variables of SQL statements is escaped with …..
: a colon
In SQLscript, there is no INTO addition for the select clause. How are records stored
The left hand side of the statement is the receiver structure or table. IT DOES NOT NEED TO BE DECLARED IN ADVANCE e.g. my_results = SELECT myfld1, myfld2 FROM thetable WHERE fld3 = :import_param
In SQL script, how are system fields such as client accessed?
Using SESSION_CONTEXT('syfld') e.g. MANDT = SEESION_CONTEXT('CLIENT')
within an AMPD, how would I call an existing AMPD?
Remember that even though they are defined as instance, they are global. So within a AMDP we would call an AMDP as CALL ‘{the class name the amdp is in}=>{ampd_method}
e.g
CALL “CL_BOB=>BOBS_AMDP( )”
From ABAP, a AMDP is called like any other global method?
This is true
Call CL_CLASS=>METHOD( )
AMDPs can be enhanced by…
A BADI if it was provided by the developer. In this case the BADI must be referenced in the USING clause of the BY DATABASE PROCEDURE clause
What is ADBC used for?
Connecting to secondary databases
What are the 7 steps of using an ADBC
1) Choose the database connection
2) Instantiate class CL_SQL_STATEMENT
3) Fill a string with the SQL
4) Call EXECUTE_QUERY of CL_SQL_STATEMENT
5) Assign a target variable for the result set calling CL_SQL_RESULT_SET method SET_PARAM or SET_PARAM_TABLE
6) Retrieve the result set calling CL_SQL_RESULT_SET method NEXT_PACKAGE
7) Close all by calling CL_SQL_RESULT_SET method CLOSE