Quantcast
Channel: SCN : All Content - ABAP for SAP HANA
Viewing all 831 articles
Browse latest View live

Execute HANA stored procedure with input parameters from ECC

$
0
0

Hello HANA Experts,

 

I have been reading some discussions and I am not able to visualize/understand the following scenario.

 

Small Description: I have a Report in ECC with a Selection Screen that is executed at runtime. This report will be run by many people with different values. These values will be use as filters and sortings on my Analytic Views in HANA.

 

I was planning to create a table that stores these values at runtime and replicate via SLT to HANA but I am not sure if this is an efficient way.

 

Can anyone please suggest or advice how can we pass these values to HANA? Also, can you please let me know how these values can become the trigger point of execution?

 

Thanks


Adding ABAP plugins in HANA Studio

$
0
0

Hi Experts,

 

I already have a HANA studio installed in my system (Version 58), now I want to add the ABAP development and UI5 plugins. I tried to do that by going to Help->Add new software and giving the URL as https://tools.hana.ondemand.com/juno. Though I can see the plug-ins but when I add them and go to the next screen, I see an error message.

 

The error message is:

“Software being installed: ABAP Connectivity And Integration Development Tools (Developer Edition) 1.0.4 (com.sap.adt.pitools.tlf.devedition.feature.group 1.0.4).

  Missing requirement: ABAP Connectivity And Integration Development Tools (Developer Edition) 1.0.4 (com.sap.adt.pitools.tlf.devedition.feature.group 1.0.4) requires 'org.eclipse.emf.query.feature.group [1.5.0,2.0.0)' but it could not be found”.

 

 

As I already have HANA studio which is also eclipse based, so I think we do not need to install one more eclipse for ABAP. Please help me in getting started to work on ABAP in HANA, the Eclipse way.

sap hana

$
0
0

Hello guys,

 

I have completed my sap abap certification and searching for a job since 5 months but there are no openings for sap freshers. So I am looking forward for an additional supplementary field like abap hr or abap webdynpro or sap pi or hana . Can anyone suggest which field would be better to opt especially is HANA advised for freshers. For your informattion I am BE.

Hands-On with the SQL Monitor Part 2: Top Statements and Empty FOR ALL ENTRIES Tables

$
0
0

Welcome to the third post in my blog series on the SQL Monitor. Last time I showed you how to use the SQL Monitor to find and analyze your system’s most time-consuming requests – that means business processes. In addition to this request-based approach, it can also be useful to perform an analysis on the SQL statement level. This is owing to the fact that an SQL statement might be triggered by several different requests. Hence, if such a statement exhibits a particularly poor performance, this can affect multiple business processes.

 

One of the common reasons for miserable performance is reading unnecessary database records. Therefore, today we will scan our demo system for SQL statements that are expensive due to the huge amount of accessed data. In particular, we want to answer the following questions:

 

  1. Which SQL statements have read or modified the most database records?
  2. Which requests trigger the top SQL statement in terms of accessed database records?
  3. How can we improve this statement’s performance?

 

Question 1

 

"Which SQL statements have read or modified the most database records?"

 

As before, the starting point of our analysis is the SQL Monitor’s data display transaction SQLMD. To answer the first question, we need an overview of the SQL statements executed in our system ordered by the total number of accessed database records. The first requirement – that is grouping the data by SQL statement – can easily be met by selecting to aggregate by source position on the selection screen (section “Aggregation”). Establishing the appropriate ordering, however, requires some manual steps on our Netweaver 7.40 SP3 demo system. This is because below Netweaver 7.40 SP5 there is no option to sort the data by the total number of accessed database records in section “Order By”. The workaround is to clear the field “Maximal Number of Records” which will cause all available monitoring records to be displayed. Afterwards we can manually sort the result list in the ALV.

 

Note that if you have a large number of monitoring records in your system, SQLMD might require a substantial amount of time to build the result list. In such a case you may be able to speed up the process by setting a high number (for instance 10,000) in the field “Maximal Number of Records” instead of clearing it completely.

 

Altogether, the configured selection screen looks like this:

Capture1.PNG

Screenshot 1: Configuration of the selection screen in transaction SQLMD.

 

After hitting F8 we are then presented the list of all SQL statements that were executed in our system. To obtain the desired ordering, all we need to do is locate the column “Total Records” and sort it in descending order. A word of advice: Be careful not to confuse the columns “Records” and “Total Records”. As explained in my last post, the former denotes the number of available detail records while the latter indicates the number of accessed database records. For our demo system the final result is depicted in the following screenshot.

Capture2.PNG

Screenshot 2: List of SQL statements ordered by the total number of accessed database records.

 

This list provides an overview of SQL statements that have caused a large amount of data to be transferred between the database and the application server. As you can see, all of these statements are located in custom code. The two dominating statements are at the top of the list and in total each has accessed more than a billion database records. Hence, question number one is answered.

 

Question 2

 

"Which requests trigger the top SQL statement in terms of accessed database records?"

 

Turning to the second question, we now focus on the statement at the very top of the list which is located in include ZSQLM_TEST11 line number 34. We are interested to know which request entry points have caused the statement to be executed. If you have worked through my previous post, you might already guess that this information is just a single click away. Remember the column “Records”? As explained in the aforementioned post, this is a generic column which denotes the number of available detail records. Since we have chosen to aggregate the data by the source position, in our case the detail records are the requests that have triggered the SQL statement. To drill down into these detail records, all you have to do is click the hotspot link in the “Records” column. It couldn’t be any easier, could it?

 

For the SQL statement at the top of the list, the “Records” column indicates that there are three different driving requests – that means business processes. In particular, clicking the hotspot link takes us to the following list:

Capture3.PNG

Screenshot 3: List of request entry points that have caused the top SQL statement to be executed.

 

As you can see, all of the driving entry points caused our statement to access an average of about 25,000 database records on each execution (column “Mean Recs.”). The majority of executions – and thereby the majority of accessed database records – were caused by the report ZSQLM_TEST11. In addition, the statement was also triggered by an RFC module and a transaction both of which are, however, almost negligible due to their low number of executions. Thus, if we optimized our top statement’s performance, the request that would benefit most is the report ZSQLM_TEST11. These observations answer the second of our questions.

 

Question 3

 

"How can we improve this statement’s performance?"

 

Focusing on the last question, let us now turn back to the SQL statement itself and think about how we could speed it up a little. Your first impulse might be to investigate the code but hold on a second since before digging through the ABAP sources the SQL Monitor may already provide you with valuable insights!

 

When dealing with SQL statements that process an immense number of database records, it is advisable to check the maximum and minimum number of accessed records in the columns “Max. Records” and “Min. Records”, respectively. As you can see from the second screenshot, for our top statement the maximum amounts to 75,000 records while the minimum is 0. Moreover, the third screenshot indicates that the statement accessed the database table ZSQLM_TEST_USERS (column “Table Names”). Checking the table contents with transaction SE16, we realize that it contains exactly 75,000 records.Capture5.PNG

Screenshot 4: Number of records contained in the table accessed by the top SQL statement.

 

Hence, sometimes our top statement accessed all the contents of the database table while other times it accessed nothing. This is very suspicious and especially the fact that at times the whole content of the database table was accessed indicates that our top statement may involve an empty FOR ALL ENTRIES table. To check this assumption we can navigate to the source code by performing a double click either on the top statement itself in the overview (second screenshot) or on one of its driving requests in the detail view (third screenshot).

Capture4.PNG

Screenshot 5: Source code for the top statement.

 

Just as suspected the statement is a SELECT FOR ALL ENTRIES without any prior content check on the FOR ALL ENTRIES table. When the FOR ALL ENTRIES table is empty, the SELECT yields all the records contained in the database table. What’s particularly important is that an empty FOR ALL ENTRIES table invalidates the WHERE clause completely even if it contains additional conditions. In the majority of cases this is, however, not what the developer intended, especially when the database table contains even more records than in our case. To put it straight, this is not just a statement with room for performance optimization – it’s a bug. To fix it, all you need to do is wrap the SELECT in an IF statement to make sure it is never executed with an empty FOR ALL ENTRIES table. If you really want to access all database records for an empty FOR ALL ENTRIES table, add an ELSE branch and use a plain SELECT without any WHERE clause. This makes your code much more robust and readable and, finally, answers the third and last question.

 

Wrap-Up

Stepping through today’s scenario, I showed you how to analyze the SQL Monitor data starting from the SQL statement level. For this purpose we generated a list of all SQL statements executed in our system and sorted the results by the total number of accessed database records. Focusing on the top statement we used a simple one-click drill-down operation to obtain the list of requests (business processes) that caused the statement to be executed. Furthermore, we leveraged the monitoring data to reveal that the top statement involves an empty FOR ALL ENTRIES table.

 

One final remark: In view of SAP HANA, sorting the SQL Monitor data by the total number of accessed database records can also be useful when using aggregation by request. This allows you to locate data-intense requests which might significantly benefit from a code push-down onto the database.

 

That’s it for today. If you still feel like walking through another hands-on scenario (I hope you do), don’t miss my next post in ABAP for SAP HANA.

Execute ABAP Reports on HANA

$
0
0

Hello Experts,

 

Can we execute Existing ABAP reports directly on HANA.

Any method that can execute SQL Queries in ABAP reports on HANA without creating Secondary DB connection.

 

We are using HANA as sidecar approach. Do we need to follow any other approach for this?

Can HANA be set as primary database for ABAP, if yes then how?

 

 

Thanks and Regards

Jitin Kharbanda

Role of COMMIT WORK statement

$
0
0

Hello Experts,

 

I have a question regarding the COMMIT WORK statement when the underlying database is HANA.

 

My observation has been - when the underlying DB is MS-SQL, a statement like - INSERT dbtab FROM wa does not need a COMMIT WORK statement after the INSERT. The contents of wa are inserted into the dbtab immediately after the execution of the INSERT statement. On the other hand, this is not the case, when the underlying database is HANA. On an A4H (ABAP for HANA) system, the execution of INSERT dbtab FROM wa does NOT immediately insert the contents of wa to dbtab. Only when a COMMIT WORK statement is used after the INSERT, the insertion of the new record takes place.

 

Could you please help me understand why this is happening? Thanks for your time and effort.

Execute Procedure with i/o parameters from ABAP

$
0
0

Hello,

 

We are using HANA as secondary database and I need to execute HANA Procedures from ABAP.

 

I have created a procedure in HANA with a parameter as input and table as output.

 

I executed it in HANA as

 

CALL "_SYS_BIC"."xxx/RETREIVE_ZHMARA"('MT02',?)

 

and it worked fine.

 

 

but I'm not able to execute it from ABAP.

 

My need is to pass parameter as input and get the result in a internal table.

 

 

Following is my code:-

 

 

 

DATAstmt_ref    TYPE REF TO cl_sql_statement,

        con_ref     TYPE REF TO cl_sql_connection,

        res_ref     TYPE REF TO cl_sql_result_set,

        d_ref       TYPE REF TO data,

        d_ref1      TYPE REF TO data,

        lv_mtart    TYPE zhmara-mtart,

        output      TYPE i.

 

 

 

lv_mtart = 'MT02'.

 

     con_ref = cl_sql_connection=>get_connection( 'ABC' ).

     stmt_ref = con_ref->create_statement( ).

 

GET REFERENCE OF lv_mtart INTO d_ref.

 

         stmt_ref->set_param( data_ref = d_ref

                              inout    = cl_sql_statement=>c_param_in ).

 

        stmt_ref->execute_procedure( proc_name =

                                '"_SYS_BIC"."xxx/RETREIVE_ZHMARA"' ).


 

 

GET REFERENCE OF lt_zhmara INTO d_ref1.

                                           res_ref->set_param_table( d_ref1 ).


* Get the complete result set in the internal table

         output = res_ref->next_package( ).

 

         LOOP AT lt_zhmara INTO ls_zhmara.

           WRITE : /, ls_zhmara-mandt,

                      ls_zhmara-matnr,

                      ls_zhmara-ersda,

                      ls_zhmara-ernam,

                      ls_zhmara-laeda,

                      ls_zhmara-mtart,

                      ls_zhmara-matkl,

                      ls_zhmara-meins.

         ENDLOOP.


 

This works fine till  stmt_ref->execute_procedure   , sy-subrc = 0.

 

but gives a dump later as  'res_ref' is not initialized hence has ZERO value.

 

How can I set this?

 

** set_param_table for output parameter is only available in class cl_sql_result_set  but what should be the reference for its object res_ref??

 

 

Kindly suggest...

SAP TechEd 2013 - applications based on ABAP and SAP HANA, part 2

$
0
0

Disclaimer: This blog partly covers features of ABAP 7.4 which are not available yet for customers and partners, but are only planned to be made available with the next support package.


In my last blog I wrote about 'bottom-up' and 'top-down' approaches to leverage SAP HANA capabilities from ABAP. In this blog I want to give you a glimpse on new features planned for the next support package of ABAP 7.4.

 

Advanced Open SQL

As you probably know Open SQL is our database independent interface to connect the ABAP application server to the underlying database. The big advantage is that code making use of Open SQL runs on all database platforms supported by SAP NetWeaver AS ABAP.

 

The big disadvantage is that the feature set of Open SQL is quite restricted. Take a look at the following examples:

  • You want to sum up the costs of 12 periods which are stored in 12 different attributes of a record? Read all 12 attributes and sum them up in ABAP.
  • You want to concatenate the product ID and name? Read both and concatenate them in ABAP.
  • You want to calculate freight costs based on the maximum of the weight and the volume weight of a material? Read weight and volume weight and use an IF-clause in ABAP.

 

Is there really no better way? In the future there will be!

 

We plan to enrich the feature set of Open SQL. This will allow you to push down calculations to the database layer that could not be pushed down by means of Open SQL in the past. With the next support package of ABAP 7.4 we, for example, plan to support:

  • string expressions (concatenation of attributes)
  • usage of ABAP constants and variables in the projection list
  • CASE expressions ('simple CASE')
  • certain arithmetic expressions for integral, decimal and floating point calculations
  • certain built-in SQL functions (e.g. CAST, COALESCE)

 

The following example shows how advanced Open SQL can look like:

"product ID and product category are concatenated using a string expression

SELECT product_id && ',' &&@space && category AS product,

       "the price including the VAT is calculated in the database by means of

       "a CASE statement

       CASE tax_tarif_code

         WHEN 1 THEN price * @lc_factor_1

         WHEN 2 THEN price * @lc_factor_2

         WHEN 3 THEN price * @lc_factor_3

       END AS price_vat,"projection list needs to be separated by comma

       currency_code AS currency

       FROM snwd_pd

       INTO CORRESPONDING FIELDS OF @ls_result."variables have to be escaped by @

  WRITE: / ls_result-product,

           ls_result-price_vat CURRENCY ls_result-currency,

           ls_result-currency.

ENDSELECT.

 

Advanced view building

What I have written about Open SQL is basically also true for the view building capabilities of the ABAP Dictionary. In line with Advanced Open SQL we also plan to introduce features for advanced view building. These features will ease code pushdown and simplify the consumption of relational data models.

 

In the future we plan to allow you to create views by means of a new Eclipse-based editor (integrated into the Eclipse-based ABAP development environment). The following screenshot shows how this editor will look like.

Eclipse_DDL_Source.png

 

And the following two snippets illustrate how you will define views in the new editor. Views can be nested (i.e. a view consumes another view) and they can be linked with associations.

 

  • In the given example the view Z_DEMO_REVENUES reads certain attributes from table SNWD_SO. It summarizes and groups the data.

@AbapCatalog.sqlViewName: 'Z_DEMO_R'

define view z_demo_revenues as select from snwd_so

{

  snwd_so.buyer_guid,

  sum(snwd_so.gross_amount) as gross_amount,

  sum(snwd_so.net_amount) as net_amount,

  sum(snwd_so.tax_amount) as tax_amount,

  snwd_so.currency_code as currency

} group by snwd_so.buyer_guid, snwd_so.currency_code

  • The view Z_DEMO_CUSTOMER reads data from tables SNWD_BPA and SNWD_AD. It also defines an association to the first view.

@AbapCatalog.sqlViewName: 'Z_DEMO_C'

define view z_demo_customer as select from snwd_bpa

  inner join snwd_ad on

    snwd_ad.node_key = snwd_bpa.address_guid

  association[*] to z_demo_revenues as revenues on

    revenues.buyer_guid = snwd_bpa.node_key

{

  snwd_bpa.node_key, snwd_bpa.bp_id,

  snwd_bpa.company_name,

  snwd_ad.country,

  snwd_ad.postal_code,

  snwd_ad.city,

  revenues.gross_amount,

  revenues.currency

}

ABAP-managed database procedures

The last planned feature are ABAP-managed database procedures. You might have heard about database procedures already. They can be used to implement complex calculations by means of SQLScript (including Calculation Engine Functions). With the next support package of AS ABAP 7.4 we plan to support database procedures which are managed by the ABAP application server.

 

The following example shows how ABAP methods can be used as container for database procedures (you might notice that the code inside the method body is not ABAP, but SQLScript).

CLASS zcl_demo_amdp DEFINITION

  ...

  "marker interface (e.g. for where-used list)

  INTERFACES: if_amdp_marker_hdb.

  METHODS: determine_sales_volume

             IMPORTING VALUE(iv_client)TYPE mandt

             EXPORTING VALUE(et_sales_volume) TYPE tt_sales_volume.

  ...

ENDCLASS.

 


CLASS zcl_demo_amdp IMPLEMENTATION.

                                "additions for implementation

  METHOD determine_sales_volume BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT

                                "forward declaration of used artifacts

                                USING snwd_so_i snwd_so_sl snwd_pd.

 

    lt_sales_volume = SELECT product_guid,SUM(quantity) AS quantity,

                             quantity_unit

                             FROM snwd_so_i AS i

                             INNER JOIN snwd_so_sl AS sl

                                ON sl.client = i.client

                             AND sl.parent_key = i.node_key

                             WHERE i.client = :iv_client

                             GROUP BY product_guid, quantity_unit;

 

    et_sales_volume = SELECT product_id, quantity, quantity_unit

                             FROM snwd_pd AS pd

                             LEFT OUTER JOIN :lt_sales_volume AS sv

                               ON sv.product_guid = pd.node_key

                             WHERE pd.client = :iv_client

                             ORDER BY product_id;

 

  ENDMETHOD.

ENDCLASS.

 

Now you know which new features are planned to ease code pushdown and to simplify consumption of relational data models.


The remaining question for my last blog will be: how can optimized infrastructure components help you to benefit from SAP HANA. If you like to learn about fuzzy-enabled value helps or evaluation of business rules in SAP HANA, you will soon be able to read more... but most likely only after Christmas .


in sap hana sp6..we have abap development persecptive,abap profiling,abap integeration...does this persective play an major role...as we have many other persecptive?

$
0
0

actually ...i am abaper...so in sap hana ...there have an intoduced the topic abap on sap hana.....does in coming years does abap will completely run on sap hana..or just as an secondary database...i mean busness suite runs on sap hana or not?

SAP HANA Studio won't load after software installation failure

$
0
0

Hi,

I've been trying to follow the End to End Development Example for ABAP with HANA at End to End Development Example with SAP NetWeaver 7.4 & SAP HANA

However I have now come to a dead-end as my HANA studio won't load after trying to install the required plug-ins for the SAP Gateway Product Accelerator and the UI Development Toolkit for HTML5 (I already had the ABAP Development tools successfully installed).  When I installed these from https://tools.hana.ondemand.com/juno I got messages about registry errors and when I tried to exit it just got into a loop repeating the error messages.  I eventually had to cancel the application using Task Manager.

 

Since this error I am unable to load the HANA studio.  When I open it it starts to load - I see messages such as Loading Workbench, and I see very fast message mentioning eclipse (which is so fast I can't read it), but then it just closes down.

 

I have tried:

Uninstalling & re-installing the studio - the re-installation seems to be successful (clean log, no error messages), but no joy

Uninstalling & re-installing the studio and hana client- no joy

Doing a Windows system restore to about one week prior to this installation - no joy

Doing a system restore with uninstall and re-install- no joy

 

Prior to this I had a working version of the studio with which I could access my HANA on AWS and was able to browse around the abap development objects and the HANA database procedures etc.  But the End to End Development Example mentioned that these extra plug-ins were required so I tried installing them.

 

I am on Windows 7 and the HANA studio and client I was using were Win 64 Rev 68.

Also I had been advised NOT to install my HANA studio in C:\Program Files, so it was installed in a folder C:\SAP\hdbstudio

 

I am stumped at the moment, so would really appreciate some advice on how to move forward.

Thanks

Andy

anybody tried ABAP 7.4 with HANA Trial on AWS ?

$
0
0

ABAP 7.4 with HANA , pls help me to complete,.

How do we handle translation in HANA when calling from ABAP

$
0
0

Hi

I call the HANA procedures/views from ABAP and I would like to send the locale language as parameter. But I couldn't achieve this unless i do a language select from each and every table and compare to the parameter.

Here's what I observed, In HANA, there's a text join and you choose the language under the language column. It always picks up the locale which is set in the logon screen. But there's no way to pass the language from ABAP.

 

Your help is appreciated.

Regads, Chaitanya

How to get hands on netweaver 7.4 running on HANA

$
0
0

Hey Guys,

 

Well, Let me start by wishing you all. Hope all are rocking.

 

For some time i have been following developments and revolutionary things happening in SAP world with HANA and new UI technologies. After going through few blogs and example tutorials able to understand SAP vision for their business suit and a lighting fast in-memory computing data base.

 

I would like to get my hands on Netweaver 7.4 running on HANA, SAP UI5, Netweaver gateway, Hana Studio. would love to get few questions answered.

 

1) Can i install 7.4 on a local PC. I have gone through all the setup methodologies given for installing 7.4 none actually discuss about installing on PC.

2) Can we see 7.4 with HANA as a downloadable version(Like Mini SAP offerings) in future.

3) Can hana studio be used to fetch and update data from  business suit running on hana instead of going via ABAP.

4) What extend does SAP River may influence ABAP development over HANA. Can SAP river be used in-case of hana and 7.4 situation.

5) I wonder After All technical changes, can we really expect a new kind of GUI or a new methodology to access SAP transactions at front end(For end users).

 

Appreciate if some one can clarify my doubts.

Custom code and SAP HANA

$
0
0
When you plan to migrate to SAP HANA, the amount of custom code in your system will have an impact on total cost, time and the quality of the end result. In this article, we look at the potential impact of that custom code, and discuss how to tune your custom code to perform optimal on SAP HANA. By using the tips and tools mentioned here, you will be able to boost your ROI and smoothen the migration process.

Incentive

Even though system owners, software manufacturers and consultants do not like to admit to it, custom code is a central part of the business functionality. In fact, in some processes custom code is a requirement in order to make the standard functionality work with the business requirements. With that in mind, we can expect that all SAP installation, small or large, will have some elements of custom code.
When migrating to SAP HANA, we must therefore answer the following questions:
  1. Which parts of my custom code must be changed in order to make the code compile and avoid potential functional issues?
  2. Which parts of my code shall be optimized to achieve the performance expected with SAP HANA?
  3. How can I identify which of my main business processes have the potential to be massively accelerated with SAP HANA?
[Ref. 1: Bresch, Beghardt& co.]  
   
The answer to the first of these questions will provide insight into potential hurdles in the process of migration, while the answers to the two latter will be essential parts of your ROI estimates.

Part 1 – The code cleansing

In general, all the code that runs on your existing platform will continue to run as before on SAP HANA. That is the case for standard SAP code, as the migration will be based on the requirement of application enhancement pack levels in combination with the compulsory
NetWeaver stack level, We can expect that SAP has replaced potential troublesome code, and even optimised it in several areas.
That leaves you with your custom code. The general rule goes for these parts as well, and you can anticipate that most parts of your custom code still do what you would expect. However, as some of the fundamental characteristics in the underlying database changes when you replace your old database with HANA, the code needs a thorough check.
First of all, we need to find and replace any parts of the code that rely on database specific features. Examples are native SQL statements, and the use of DB hints in Open SQL statements. Take the code from example 1 in consideration.
EXECSQL PERFORMING loop_output.
SELECT connid, cityfrom, cityto
INTO :wa
FROM spfli
WHERE carrid = :c1
ENDEXEC.
Example 1: Native SQL.
This notation uses native SQL. It relies on the database to accept that exact syntax. The example is not very advanced. However, in order to eliminate the possibility of compatibility errors, a level of transparent abstraction should be introduced. This is done with a database independent statement set called Open SQL. By using Open SQL, the programmer makes sure that the code runs on any database chosen for your SAP installation or migration.
Secondly, we need to identify, examine and possibly replace code that relies on implicit sorting done by the database. The reason for this is that the migration to SAP HANA includes a change from row based to column based architecture. Before the migration, your row based database returned your result set in implicit primary key sequence if the SQL didn’t request otherwise. After conversion to the column based database, the implicit sort sequence is no longer returned. We can expect that programmers have based code on the previously existing features of implicit index sorting. When building and testing their code, they will have seen this feature in the debugger or in the final result set, and therefore omitted placing sorting in their own code. After migration to HANA, the code will still compile, but may not provide the correct result to the enduser. Therefore we need to place sorting in the custom code. This can be done by one of the following actions:
  • Adding “order by” in the select statement. This is the preferred choice if indexed fields should determine sort order.
  • Adding a “sort by” on the result set. The statement should follow immediately after the select statement in order to prevent processing duplication.
The third important issue with migration to a column based database is the conversion of pool and cluster tables. Cluster tables and some of the pool tables will be transformed into transparent tables and the relation between them is broken [Ref. 2, SAP Note 1785057]. Here is an example:
Before migration, a delete statement on a table cluster would delete from multiple clustered tables. After migration, the delete will only remove data from the table named in the SQL, not from tables that made up the cluster.
Example 2: Cluster and pool tables.
 
The code must be altered in order to cope with how cluster and pool tables are transformed into transparent tables. Legacy code should be adjusted with separate SQL calls to all tables that previously were in the cluster or pool.
Rewriting the code in accordance with the recommendations above does not sound so complicated. Finding the code that must be changed, however, may seem like an overwhelming task. No doubt, the amount of custom code will be a factor in estimating the effort. Luckily though, the vast majority of code lines that makes up your applications are made by SAP – and not you. Hence, SAP has had the use of tools to correct their own code. Some of the tools are now made available for the customers to use in their optimising work, and will be of great value in the process of migrating to SAP HANA.
In particular, the ABAP Code Inspector is essential in this work. In this tool you can define variants of which elements you want to analyze. In particular, the following categories will provide good help in identifying problematic code:

 

 

  • Critical statements: Find native SQL and DB hints.
  • Use of ADBC Interface: Find native SQL and DB administrative statements.
  • SELECT/OPEN CURSOR without ORDER BY: Finds problematic statements where database tables are read without order or sorting before read, search or delete.
  • Search ABAP Statement Patterns: Lets you search for index specific code.
To support the process of generally lifting the quality of the code, the code inspector is part of the ABAP Test Cockpit (ATC). Here, the code quality manager can schedule periodic runs, add quality gates with priorities, and publish the results back to developers. Even though you have no immediate plans to migrate to HANA, this tool should catch your interest. Putting your programming standards into a benchmarking regime will result in better quality and in the end better running business processes.

Part 2 – Boost you custom code

In part one we made the code run on SAP HANA and we eliminated potential code problems that may occur in the migration process. In this third part, we will look at how we can boost custom code so that you achieve the “HANA effect”.
Now that your custom code will compile and run on SAP HANA, you can already expect better response times on your SQLs without putting in any additional work. This will certainly be the case for database intensive programs where the programmers have followed best practice. In processes where programmers have not been focused towards efficient running code, the switch to SAP HANA will not result in massively reduced runtime.
So what are these golden rules of SQL, and what is their importance in terms of HANA? Bresch, Beghardt & co [ref .1] have made an overview of the most critical concepts:

Golden Rule

Detail / example

HANA relevance

Keep the result sets small.
  • Do not retrieve rows from the database and discard them on the application server using CHECK or EXIT, e.g. in SELECT loops.
  • Make the WHERE clause as specific as possible.

This rule is as important as before when migrating to HANA.

Minimise the amount of transferred data.
  • Use SELECT with a field list instead of SELECT * in order to transfer just the columns you really need.
  • Use aggregate functions (COUNT, MIN, MAX, SUM, AVG) instead of transferring all the rows to the application server.

When shifting to a column based database, this becomes more important. Reason being that the whole columns must be read by the database in order to fetch the returned result set.
Minimise the number of data transfers.
  • Use JOINs and or sub-queries instead of nested SELECT loops.
  • Use SELECT.. FOR ALL ENTRIES instead of lots of SELECTs or SELECT SINGLEs.
  • Use array variants of INSERT, UPDATE, MODIFY, and DELETE.
Arrays will be more efficient with column based architecture. Nested SELECTs will be causing more inefficiency (relatively speaking) then with row based databases.
Minimise the search overhead.
  • Define and use appropriate secondary indexes.
As secondary indexes are not required by SAP HANA, this rule has lost some of its importance.
Keep load away from the database.
  • Avoid reading data redundantly.
  • Use table buffering where possible and do not bypass it.
  • Sort data in your programs (unless ordering is with the primary table key).
In terms of HANA, you still want to keep unnecessary load away from the database. You DO however want to give the database your most data-intensive calculations to the database. This could be achieved by heavy SQL called from the application side or code pushdown to SAP HANA.
In example three there is a case of SQL code that produces a correct result set, but not in an optimized way.
SELECT *

FROM ekko INTO TABLE it_ekko

WHERE ebeln = lv_ebeln.

SELECT *

FROM ekpo INTO TABLE it_ekpo

FOR ALL ENTRIES IN it_ekko

WHERE ebeln EQ it_ekko-ebeln.

Example 3: Inefficient SQL.

There are three main problems with these statements. First of all, it triggers two separate roundtrips to the database. Secondly, the second SQL may result in unnecessary large result set that may never be used, as there is no check for an empty FOR ALL ENTRIES IN from the first SQL. Thirdly, the complete field list is fetched for both tables – which should only be the case if all fields will be used in the subsequent application logic.

 

As with the replacement of malfunctioning code in the first chapter, adopting these best practices should not be programmatically challenging – but the code bits worth changing may be difficult to locate. With that in mind, SAP has extended the previously discussed Code Inspector for this purpose. In the tool, you will find analysis of WHERE conditions, buffer bypass checks, nested SELECTs, unsecure FOR ALL ENTRIES checks and more.

Part 3 – Identify business processes

As the custom code potentially contains hundreds or even thousands of SQL statements, knowing where to start optimising can be a challenge. Trying to validate and correct all hits returned by the Code Inspector would be time consuming and not provide an immediate boost to the processes that have the most to gain. As most systems have some amount of dead code, some of the effort would be time wasted. Somehow, you would like to find processes that are time consuming in terms of SQL, high frequent or data intensive. Subsequently, you would want to combine those results with potential code optimising from the Code Inspector.
Most systems have large amounts of code that is unused (dead). Getting rid of dead code will be beneficial in terms of reducing maintenance effort of your system. SAP Usage and Procedure Logging is a tool that can help identify the code you can delete from your system. The tool integrates with the Custom Code Lifecycle Management in Solution Manager.

Dead code, SAP UP Logging

[SAP Active Global Support, Ref. 3]

In order to find and prioritize processes that are expensive in terms of database calls or volume, SAP has provided the New SQL Monitor. The tool can be activated in your SAP environment without disturbing the business processes, and could be executed even before migrating to HANA. It will provide performance data on all OPEN SQL statement executed in the system [Ref. 1: Bresch, Beghardt & co.].

By letting the tool run in your production environment, you will be provided with valuable logs that can be sorted and filtered in several ways and dimensions. It will tell you which SQLs have the highest frequencies of use within the timeframe, and which ones are the most expensive in terms of runtime and load. Starting your optimizing efforts with basis in this result set would make sense. That would certainly be the case if you can identify some extreme cases of high frequent SQLs or processes that stand out by their high execution time. However, it is likely that you will be faced with a long list of SQLs that are both frequent, data intensive and time consuming.

 

As a result of this we would want to find the areas that both have the potential for optimization and are showing up high on your SQL monitor log. This can be done with the SQL Performance Tuning Worklist. It combines findings from bode the Code Inspector and the New SQL Monitor. It syndicates execution time, amount of data involved and potential code deficits and then point to the exact bits of code where you should place your effort.

Summary

In order to prepare your custom code for the migration to SAP HANA, you need to make sure that your code still will work and not result in functional errors. After that step the focus will shift towards optimising your processes. There are several tools that are suggested in order to achieve this, and a set of rules and best practises that should be in focus for quality management and programmers. The end result should be smooth migration of your custom code along with the SAP standard code, and a notable performance boost on your prioritised business processes.

References

Ref 1: “CD200: Tune Your Custom ABAP Code - Get Ready for SAP HANA” by Stefan Bresch, Boris Gebhardt, Jens Lieberum, Johannes Marbach, as presented at SAP TechEd in Amsterdam, November 2013.

 

Ref 2: “Recommendations for migrating suite systems to SAP HANA”, by SAP, SAP Note 1785057 v7, found at https://websmp209.sap-ag.de/sap/support/notes/1785057 November 2013.

 

Ref 3: “ITM114: Real Software Utilization with Usage and Procedure Logging” by SAP Active Global Support, as presented at SAP TechEd in Amsterdam, November 2013.

 

 

Consuming HANA Views, Procedures, External Views in ABAP 7.40 Syntax - Part 1

$
0
0

Tried to document my learning on ABAP 7.4 and ABAP for HANA.

 

 

Topics:

 

1. ABAP Report with new data declaration syntaxes on 7.40

2. ABAP Report on HANA using ADBC

3. Consuming Attribute View using External View.

4. Consuming Attribute View using Native SQL

5. Consuming Analytic View/Calculation View in ABAP

6. Consuming HANA artifact Stored Procedure using ABAP Proxy Procedure.

7. Consume HANA artifact Stored Procedure by Calling it in ABAP Code.

 


Part 1: http://scn.sap.com/community/abap/hana/blog/2014/01/08/consuming-hana-views-procedures-external-views-in-abap-740-syntax--part-1


  • ABAP Report with new data declaration syntaxes on 7.40
  • ABAP Report on HANA using ADBC


Part 2:http://scn.sap.com/community/abap/hana/blog/2014/01/08/consuming-hana-views-procedures-external-views-in-abap-740-syntax--part-2


  • Consuming Attribute View using External View.
  • Consuming Attribute View using Native SQL
  • Consuming Analytic View/Calculation View in ABAP


Part 3: http://scn.sap.com/community/abap/hana/blog/2014/01/08/as

  • Consuming HANA artifact Stored Procedure using ABAP Proxy Procedure.
  • Consume HANA artifact Stored Procedure by Calling it in ABAP Code.


 

T1. ABAP Report with new data declaration syntaxes on 7.40

* Open SQL, Native SQL, Defining native SQL with String Templates & Expressions

 

REPORT zabap_for_hana.

 

* Declarations

* ADBC Objects and variables

 

DATA:  lo_sql_stmt TYPE REF TO cl_sql_statement,

             lr_data     TYPE REF TO data.

 

* Exception handling

 

DATA:  lx_sql_exc TYPE REF TO cx_sql_exception,

lv_text TYPE string,

           lo_alv  TYPE REF TO cl_salv_table,

           lx_msg  TYPE REF TO cx_salv_msg.

 

* Data objects

DATA: gt_pernr     TYPE ztt_emp_bill,

           lv_start     TYPE timestampl,

           lv_end       TYPE timestampl,

           lv_message   TYPE string.

 

* Hello World Program with new syntaxs available for data declaration in 7.40

 

*DATA: lv_name TYPE string VALUE 'Hello World'.  // old syntax

DATA(lv_name) = 'Hello World'.             " New Syntax

 

DATA: lr_conn TYPE REF TO cl_sql_connection,

            lt_emp_info TYPE TABLE OF dtab_emp_info.

 

WRITE: lv_name.

SKIP.

 

CREATE OBJECT lr_conn.

lr_conn->ping( ).

 

* Select

SELECT * UP TO 5 ROWS

  INTO TABLE lt_emp_info

  FROM dtab_emp_info.

SKIP.

 

* Read Syntax

 

*DATA: LS_EMP_INFO_2    TYPE DTAB_EMP_INFO.

*DATA: LS_EMP_INFO_READ TYPE DTAB_EMP_INFO.

*READ TABLE DTAB_EMP_INFO INTO LS_EMP_INFO_2 INDEX 2.

*READ TABLE DTAB_EMP_INFO INTO LS_EMP_INFO_READ WITH KEY PERNR = '00000005' DEPARTMENT = 'SUPPORT'.

 

* Above Code can be replaced like following

 

DATA(ls_emp_info_2) = lt_emp_info[ 2 ].

WRITE: 'Read Statement for Index 2:-',ls_emp_info_2-pernr.

SKIP.

 

* Reading the internal table with a condition

DATA(ls_emp_info_read) = lt_emp_info[ pernr = '00000005' department = 'SUPPORT' ].

WRITE: 'Read Statement with condition:-',ls_emp_info_read-pernr.

SKIP.

 

 

*READ TABLE DTAB_EMP_INFO TRANSPORTING NO FIELDS WITH KEY PERNR = '00000005' DEPARTMENT = 'SUPPORT'.

* Same can be written as below with new syntax

IF line_exists( lt_emp_info[ pernr = '00000005' department = 'SUPPORT' ] ).

  WRITE: 'Condition Satisfied'.

ENDIF.

 

* Defining the work area in the Loop Statement

LOOP AT lt_emp_info INTO DATA(ls_emp_info).

  WRITE: ls_emp_info-pernr.

ENDLOOP.

SKIP.

 

* Field symbols can also be assinged in the same fashion

LOOP AT lt_emp_info ASSIGNING FIELD-SYMBOL(<fs_emp_info>).

  WRITE: <fs_emp_info>-pernr.

ENDLOOP.

SKIP.

 

* Data Declaration when calling a method

CALL METHOD zcl_test=>get_pernr

  EXPORTING

    iv_location = 'BANGALORE'

    iv_country = 'IN'

  IMPORTING

    et_emp_info = DATA(lt_emp_info_tab).

 

DESCRIBE TABLE lt_emp_info_tab LINES DATA(lv_lines).

WRITE: 'Number of Records', lv_lines.

SKIP.

1.jpg

 

 

T2. ABAP Report on HANA using ADBC


TRY.

    CLEAR gt_pernr.

 

 

* Open SQL

*     SELECT empinfo~mandt empinfo~pernr empbill~bill_rate

*       FROM DTAB_EMP_INFO AS empinfo INNER JOIN DTAB_EMP_BILL AS empbill ON empinfo~pernr = empbill~pernr

*       into table gt_pernr

*      GROUP BY empinfo~mandt empinfo~pernr empbill~bill_rate

*       ORDER BY empinfo~pernr.

 

 

* Difference between Open and Native SQL are Comma separated field list, explicit client handling , NO 'INTO' clause

 

* Defining native SQL

 

data(lv_sql) = | SELECT empinfo.mandt, empinfo.pernr, empbill.bill_rate, |

**           use HANA built-in function

&& | sum( DAYS_BETWEEN(empbill.BILL_DATE,CURRENT_UTCDATE) ) AS LAST_BILL_REV

**    && | AVG( DAYS_BETWEEN(empbill.BILL_DATE,CURRENT_UTCDATE) ) AS LAST_BILL_REV |

&& |   FROM DTAB_EMP_INFO AS empinfo INNER JOIN DTAB_EMP_BILL AS empbill ON empinfo.pernr = empbill.pernr |

            && |  WHERE empbill.mandt = { sy-mandt } |

            && |  GROUP BY empinfo.mandt, empinfo.pernr, empbill.bill_rate |

            && |  ORDER BY empinfo.pernr |.

 

* Defining native SQL with String Templates & Expressions

 

    CONCATENATE ` SELECT empinfo.mandt, empinfo.pernr, empbill.bill_rate, `

*           use HANA built-in function

      ` DAYS_BETWEEN(empbill.BILL_DATE,CURRENT_UTCDATE) AS LAST_BILL_REV `

                ` FROM DTAB_EMP_INFO AS empinfo INNER JOIN DTAB_EMP_BILL AS empbill ON empinfo.pernr = empbill.pernr `

                ` WHERE empbill.mandt =  ` sy-mandt

                ` GROUP BY empinfo.mandt, empinfo.pernr, empbill.bill_rate, empbill.bill_date `

                ` ORDER BY empinfo.pernr `

                INTO DATA(lv_sql)

                SEPARATED BY space.

 

*     Create an SQL statement to be executed via default secondary DB connection

    CREATE OBJECT lo_sql_stmt EXPORTING con_ref = cl_sql_connection=>get_connection( ).

 

*     execute the native SQL query/ SQL Call

    DATA(lo_result) = NEW cl_sql_statement( )->execute_query( lv_sql ).   " new syntax

 

*     read the result into the internal table lt_partner

    GET REFERENCE OF gt_pernr INTO lr_data.

    lo_result->set_param_table( lr_data ).  "Retrieve result of native SQL call

    lo_result->next_package( ).

    lo_result->close( ).

 

  CATCH cx_sql_exception INTO lx_sql_exc.

    lv_text = lx_sql_exc->get_text( ).

    MESSAGE lv_text TYPE 'E'.

 

ENDTRY.

 

* display

TRY.

      cl_salv_table=>factory(

          IMPORTING

            r_salv_table = lo_alv

          CHANGING

            t_table      = gt_pernr ).

 

      lo_alv->display( ).

 

    CATCH cx_salv_msg INTO lx_msg.

      lv_text = lx_msg->get_text( ).

      MESSAGE lv_text TYPE 'E'.

ENDTRY.

 

2.jpg


Consuming HANA Views, Procedures, External Views in ABAP 7.40 Syntax - Part 2

$
0
0

Part 1: http://scn.sap.com/community/abap/hana/blog/2014/01/08/consuming-hana-views-procedures-external-views-in-abap-740-syntax--part-1


  • ABAP Report with new data declaration syntaxes on 7.40
  • ABAP Report on HANA using ADBC


Part 2:http://scn.sap.com/community/abap/hana/blog/2014/01/08/consuming-hana-views-procedures-external-views-in-abap-740-syntax--part-2

  • Consuming Attribute View using External View.
  • Consuming Attribute View using Native SQL
  • Consuming Analytic View/Calculation View in ABAP


Part 3: http://scn.sap.com/community/abap/hana/blog/2014/01/08/as

  • Consuming HANA artifact Stored Procedure using ABAP Proxy Procedure.
  • Consume HANA artifact Stored Procedure by Calling it in ABAP Code.

 

 

T3. Consuming Attribute View using External View.


Step 1:  Create HANA Attribute view :


1.jpg

2.jpg



Step 2: Save and Activate the view and check the data by using ‘Data Preview’ option.


Steps to create external view:


Step 1: Go to ‘ABAP’ prospective.

 

3.jpg

Step 2:  Right click on ABAP package under which you want to create this external view. Under ‘New’ click on ‘Other ABAP Repository Object’

 

4.jpg.png

 

Step 3: Expand ‘Dictionary’ folder and click on ‘Dictionary View’.

 

5.jpg

 

 

Step 4: Enter name and description of view and select ‘External View’ radio button and browse and select your HANA view.

 

6.jpg

 

Step 5: Click on Next, Finish and then activate the view, this will create your external view in you ABAP system, you can cross check in SE11.‘Synchronize’ button should be used if any changes are made in HANA view

 

7.jpg8.jpg

Source Code to consume the above created external View:


* External View
DATAlt_tab TYPE TABLE OF external_view.

SELECT *
INTO TABLE lt_tab
FROM external_view.

LOOP AT lt_tab ASSIGNING FIELD-SYMBOL(<fs>).
WRITE: / 'Pernr:' ,<fs>-pernr.
WRITE: '=', <fs>-last_rev_bill_date, /.
ENDLOOP.


Output:


9.jpg

 


T4. Consuming Attribute View using Native SQL


  DATA:  lt_tab2 TYPE TABLE OF external_view.

* consuming attribute view

  TRY.

 

      lv_sql = | SELECT bill_rate, emp_name, bill_date, pernr, |

*           use HANA built-in function

            && | DAYS_BETWEEN(BILL_DATE,CURRENT_UTCDATE) AS LAST_BILL_REV |

            && |   FROM _SYS_BIC."mohas97_ha5/AT_EMP_BILL" |.

 

*     Create an SQL statement to be executed via default secondary DB connection

      CREATE OBJECT lo_sql_stmt EXPORTING con_ref = cl_sql_connection=>get_connection( ).

 

*     execute the native SQL query/ SQL Call

      lo_result = NEW cl_sql_statement( )->execute_query( lv_sql ).   " new syntax

 

*     read the result into the internal table lt_partner

      GET REFERENCE OF lt_tab2 INTO lr_data.

lo_result->set_param_table( lr_data ).  "Retrieve result of native SQL call

lo_result->next_package( ).

lo_result->close( ).

 

    CATCH cx_sql_exception INTO lx_sql_exc.

      lv_text = lx_sql_exc->get_text( ).

      MESSAGE lv_text TYPE 'E'.

 

  ENDTRY.

 

  LOOP AT lt_tab2 ASSIGNING FIELD-SYMBOL(<fs>).

    WRITE: / 'Pernr:' ,<fs>-pernr.

    WRITE: '=', <fs>-last_rev_bill_date, /.

  ENDLOOP.

 

10.jpg

 

T5. Consuming Analytic View/Calculation View in ABAP


Calculation view can also be consumed in the same way.


Step 1:  Create HANA Analytic view

11.jpg


Step 2: Save and Activate the view and check the data by using ‘Data Preview’ option.


Source Code to consume the above Analytic View:


* consuming analytic view with input parameter

  DATA: LT_PROJ TYPE ZTT_EMP_PROJ.

 

  TRY.

 

      lv_sql = | SELECT mandt, PERNR, PROJ_NAME, RESOURCE_NO |

             && |   FROM _SYS_BIC."mohas97_ha5/AN_EMP_PROJ" |

*            && |  ('PLACEHOLDER'=('$$IP_PERNR$$', ' { lv_pernr } ' ) ) |

            && |  WHERE mandt = { sy-mandt } |.

*            && |  ORDER BY bill_rate |.

 

Source Code for Using Input Parameter

 

*      lv_sql = | SELECT mandt, PERNR, BILL_RATE, BILL_DATE |

*             && |   FROM _SYS_BIC."mohas97_ha5/AN_BILL_DATE" |

*            && |  ('PLACEHOLDER' = ('$$BILL_DATE$$', ' { SY-DATUM } ' )) |

*            && |  WHERE mandt = { sy-mandt }    GROUP BY mandt, pernr, bill_rate, bill_date |.

 

 

 

*     Create an SQL statement to be executed via default secondary DB connection

      CREATE OBJECT lo_sql_stmt EXPORTING con_ref = cl_sql_connection=>get_connection( ).

 

*     execute the native SQL query/ SQL Call

      lo_result = NEW cl_sql_statement( )->execute_query( lv_sql ).   " new syntax

 

*     read the result into the internal table lt_partner

*      GET REFERENCE OF lt_PROJ INTO lr_data.

      GET REFERENCE OF lt_proj INTO lr_data.

lo_result->set_param_table( lr_data ).  "Retrieve result of native SQL call

      lo_result->next_package( ).

      lo_result->close( ).

 

    CATCH cx_sql_exception INTO lx_sql_exc.

      lv_text = lx_sql_exc->get_text( ).

      MESSAGE lv_text TYPE 'E'.

 

  ENDTRY.

    LOOP AT lt_PROJ ASSIGNING FIELD-SYMBOL(<fs_PROJ>).

    WRITE: / 'Employee Proj Info' ,<fs_proj>-pernr.

    WRITE: '=', <fs_proj>-proj_name , /.

  ENDLOOP.

 

 

Output:

12.jpg

Consuming HANA Views, Procedures, External Views in ABAP 7.40 Syntax - Part 3

$
0
0

Part 1: http://scn.sap.com/community/abap/hana/blog/2014/01/08/consuming-hana-views-procedures-external-views-in-abap-740-syntax--part-1


  • ABAP Report with new data declaration syntaxes on 7.40
  • ABAP Report on HANA using ADBC


Part 2:http://scn.sap.com/community/abap/hana/blog/2014/01/08/consuming-hana-views-procedures-external-views-in-abap-740-syntax--part-2

  • Consuming Attribute View using External View.
  • Consuming Attribute View using Native SQL
  • Consuming Analytic View/Calculation View in ABAP


Part 3: http://scn.sap.com/community/abap/hana/blog/2014/01/08/as

  • Consuming HANA artifact Stored Procedure using ABAP Proxy Procedure.
  • Consume HANA artifact Stored Procedure by Calling it in ABAP Code.



T6. Consuming HANA artifact Stored Procedure using ABAP Proxy Procedure.


Steps to create Stored Procedure:

Step 1: Go to ‘Modeler’ or ‘SAP HANA Development ‘prospective and right click on your package and create a new procedure.

 

Step 2:  Enter name and description, select the ‘Default Schema’ (SAP-SID) and Run With as ‘Invoker’s Right’ and click on finish.

 

1.jpg

 

Step 3: Add ‘Output’ and ‘Input’ parameters by right clicking on the respective folders

2.jpg

Step 4: Place the code in the procedure editor

 

BEGIN

 

et_last_rev_bill = SELECT empinfo.pernr as PERNR, DAYS_BETWEEN(empbill.BILL_DATE,CURRENT_UTCDATE) AS LAST_REV_BILL

                     FROM DTAB_EMP_INFO AS empinfo INNERJOIN DTAB_EMP_BILL AS empbill

                       ON empinfo.pernr = empbill.pernr

                    WHERE empbill.mandt = empinfo.mandt

                    GROUPBY empinfo.pernr, empbill.bill_date ;

 

END;

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


3.jpg

Step5: Save and activate the procedure. Execute the procedure in ‘SQL Console’.

 

Call"_SYS_BIC"."mohas97_ha5/ZEMP_BILL_PP"(?) WITH OVERVIEW;


Call"_SYS_BIC"."mohas97_ha5/ZEMP_BILL_PP"(?);

 

4.jpg

 

 

Now create a Proxy Procedure in ABAP:

Step 1: Go to ‘ABAP’ prospective.

5.jpg

 

Step 2:  Right click on ABAP package under which you want to create this Proxy Procedure. Under ‘New’ click on ‘Other ABAP Repository Object’

6.jpg

 

Step 3: Choose ‘Database Procedure Proxy’.

 

7.jpg

 

Step 4: Enter name, description, HANA s procedure name
8.jpg

 

Step 5: Now your proxy procedure is created just activate the object.

9.jpg

 

Source code to Consume the ‘Proxy Procedure’  in ABAP:

 

  DATA: lt_bill_rev_days TYPE TABLE OF if_emp_bill_proxy_procedure=>et_last_rev_bill,

        lv_count     TYPE i.

  CALL DATABASE PROCEDURE emp_bill_proxy_procedure

IMPORTING et_last_rev_bill = lt_bill_rev_days.

 

  LOOP AT lt_bill_rev_days ASSIGNING FIELD-SYMBOL(<fs_bill_rev_days>).

    WRITE: / 'Days Since Bill Rate is changed' ,<fs_bill_rev_days>-pernr.

    WRITE: '=', <fs_bill_rev_days>-last_rev_bill , /.

  ENDLOOP.

 

Output:

10.jpg

 

 

T7. Consume HANA artifact Stored Procedure by Calling it in ABAP Code.

 

Source Code


* Calling hana procedure in ABAP
TYPES: BEGIN OF lty_s_overview,
param
TYPE string,
value TYPE string,
END OF  lty_s_overview.

DATA: lt_overview TYPE  TABLE OF lty_s_overview.
DATA: ls_overview TYPE  lty_s_overview.

TRY.


lv_sql
= | CALL _SYS_BIC."mohas97_ha5/ZEMP_BILL_PP"  | &&
|
( null ) WITH OVERVIEW |.

*     execute the native SQL query/ SQL Call
lo_result
= NEW cl_sql_statement( )->execute_query( lv_sql ).   " new syntax

*     read the result into the internal table lt_partner
GET REFERENCE OF lt_overview INTO lr_data.
lo_result
->set_param_table( lr_data ).  "Retrieve result of native SQL call
lo_result
->next_package( ).
lo_result
->close( ).

* Read internal table
READ TABLE lt_overview INTO ls_overview WITH KEY param = 'ET_LAST_REV_BILL'.
lv_sql
= ` select * from ` && ls_overview-value.
*     execute the native SQL query/ SQL Call
lo_result
= NEW cl_sql_statement( )->execute_query( lv_sql ).   " new syntax

*     read the result into the internal table lt_partner
GET REFERENCE OF lt_bill_rev_days  INTO lr_data.
lo_result
->set_param_table( lr_data ).  "Retrieve result of native SQL call
lo_result
->next_package( ).
lo_result
->close( ).

CATCH cx_sql_exception INTO lx_sql_exc.
lv_text
= lx_sql_exc->get_text( ).
MESSAGE lv_text TYPE 'E'.

ENDTRY.

LOOP AT lt_bill_rev_days ASSIGNING FIELD-SYMBOL(<fs_bill_rev_days>).
WRITE: / 'Days Since Bill Rate is changed::' ,<fs_bill_rev_days>-pernr.
WRITE: '::', <fs_bill_rev_days>-last_rev_bill , /.
ENDLOOP.

11.jpg

ABAP and SAP HANA : Combination

$
0
0

Hi All,

 

I believe it would help lot of people who are in 2 minds  

 

I have few questions regarding SAP HANA...

 

I have been working as SAP ABAP Consultant for 7 years and learned SAP HANA(sp4) and got certified in SAP HANA way in 2012

 

When i learned SAP HANA , it was all about moving data from ECC system tables using BODS and creating procedures,views etc...

 

When i look for job posting there are no requirements for HANA with data movement from ECC...

 

All clients are looking for BW on HANA.......

 

So now i'm thinking of learning on ABAP on SAP HANA....

 

So my questions are

 

1) I'm in right direction in going ABAP on SAP HANA or Should i keep looking for SAP HANA Developer (Just Creating views jobs which i doubt exist ) without any BW

 

2)If your answer is to go for ABAP on SAP HANA - is it good without any BW exp and how difficult it would be for some like me with both SAP ABAP experience and SAP HANA knowledge

 

3)If your answer is to go for ABAP on SAP HANA - Do you suggest to attend course HA400 course that SAP is offering or is there any way that i can learn my self

 

4)How are job prospects with ABAP on SAP HANA

I have already invested plenty of time and money , i would appreciate if you could give some honest advice

Thanks in advance

Featured Content for ABAP for SAP HANA

$
0
0

Cookbook SAP Business Suite on SAP HANA

Recently we have published a new version of the SAP Business Suite powered by SAP HANA Cookbook.You find it here. It includes a lot of interesting information for developers. You find interesting information related to code migration and optimization there. Moreover you find also nice overview videos. January 13, 2014


SQL Monitor Unleashed

Have you heard about the SQL Monitor already? It can be used to detect custom code which can be optimized (in the context of the migration to SAP HANA, but also independent of that). If you like to learn more, read Johannes Marbach's blog series. You find the first blog here. November 18, 2013

 

SAP ICC: Readiness Assessment for ABAP Add-Ons

As software solution provider you can get help from the SAP Integration and Certification Center (SAP ICC) for making your add-on ready for SAP HANA. If you are interested, you can find more details here. November 18, 2013


 


 

 

 

 

End to End Development Example with SAP NetWeaver 7.4 & SAP HANA

$
0
0

This document will show you step by step how to leverage the power of SAP NetWeaver AS ABAP 7.4 powered by SAP HANA.

 

The Guide consists of an overview about different business figures based on open invoices. Including the average number of days the invoices of a customer are open, the sum of the amount of these open invoices (including currency conversion) and a flag set by customization values to identify critical customers.

 

In this tutorial you will optimize an existing classical ABAP implementation leveraging HANA Column Views and new ABAP capabilities to easily consume HANA entities and expose the retrieved data with an SAP Gateway Service and SAPUI5.

 

Important Information: If you have already a ADT or HANA Studio installed - please don't try to use it for this guide, but follow the installation instructions given in the guide and put it in another folder then your existing Eclipse installation.


Thanks Jens

 

View this Document

Viewing all 831 articles
Browse latest View live


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