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

Usage patterns of ABAP SELECT-OPTIONS while consuming SAP HANA artifacts

$
0
0

What's in this document

This document explains the different usage patterns of SELECT-OPTIONS while consuming SAP HANA artifacts from within ABAP.

 

Introduction

      ABAP reports generally have SELECT-OPTIONS to enable end users to provide the selection inputs. This input is later used in the implementation of the ABAP business logic as per the needs of the end user to:

  • restrict data fetched from the database.
  • process data fetched from the database.

     In the context of ABAP on HANA, to fully utilize SAP HANA capabilities, there could be use-cases where the data fetching and data processing logic of the report has been pushed down to the SAP HANA layer to accelerate the ABAP report.

     This document outlines some of the means by which the SELECT-OPTIONS can be used while consuming SAP HANA artifacts from within ABAP code with simple examples.

 

Data Model

    This document contains sample scenario of Open Items Analysis to illustrate the different means of using SELECT-OPTIONS to consume HANA artifacts. Consider an ABAP report fetching the list of closed invoices for business partners and the possibility to fetch the list of closed invoices only for specific business partners chosen from the selection screen of the report.

     The sample scenario uses the ABAP Dictionary View, SEPMAPPS_CLSDINV– an external view created for HANA Calculation view, CA_CLOSED_INVOICES. You can find this Calculation view and the corresponding Dictionary View in all SAP NetWeaver AS ABAP 7.4 SP5 systems.


Note: From SAP NetWeaver AS ABAP 7.4 SP2, you can create ABAP Dictionary representation in ABAP for SAP HANA views. For instance,  SEPMAPPS_CLSDINV is the Dictionary view of underlying SAP HANA Calculation View CA_CLOSED_INVOICES, which is based on the open item analysis scenario. The SAP HANA Calculation view CA_CLOSED_INVOICES fetches all the closed invoices of business partners.

 

SELECT-OPTIONS

     In ABAP, it is a common practice to use SELECT-OPTIONS while creating selection screens. The statements SELECT-OPTIONS and PARAMETERS determine the technical interface and the user interface. The parameters and select-options you specify are displayed on the selection screen for the end users to enter values.

     Now, define one selection screen using the statement SELECT-OPTIONS [bupa_id], and then use this in all the further scenarios. In order to define the selection screen, use the dictionary view SEPMAPPS_CLSDINV.

DATA ls_sepmapps_clsdinv TYPE SEPMAPPS_CLSDINV.

 

DATA lt_sepmapps_clsdinv TYPE table of SEPMAPPS_CLSDINV.

 

SELECT-OPTIONS bupa_id FOR ls_sepmapps_clsdinv-BUPA_ID.

 

Options with SELECT-OPTIONS

      The rest of the document will assist you to explore the different options of using SELECT-OPTIONS in SQL queries. The subsequent sections contain examples to explain how to apply SELECT-OPTIONS while consuming the following:

  1. SAP HANA View [as DDIC View] using Open SQL
  2. SAP HANA View using Native SQL [ADBC]
  3. SAP HANA Database Procedure [as DB Procedure Proxy] using Open SQL

 

1. Usage of SELECT-OPTIONS in Open SQL

     Using SELECT-OPTIONS is simple and straightforward in Open SQL queries. As an example, the query below fetches the closed invoices for one or more business partners defined in the SELECT-OPTIONS, bupa_id.

SELECT * FROM SEPMAPPS_CLSDINV INTO CORRESPONDING FIELDS OF TABLE

 

lt_sepmapps_clsdinv WHERE BUPA_ID in ( bupa_id ). " bupa_id is a SELECT-OPTIONS variable

 

2. SELECT-OPTIONS and SAP HANA View using Native SQL (ADBC)

2.1 Convert SELECT-OPTIONS to WHERE clause

     SELECT-OPTIONS is an ABAP language construct/statement. Hence while using SELECT-OPTIONS in the Native SQL query, it is necessary to transform the data of the SELECT-OPTIONS appropriately. As described earlier, SELECT-OPTIONS is used to define selection criteria – used to filter data
fetched from the database. This means the data of the SELECT-OPTIONS ideally form the WHERE condition of the SQL query.

     As shown in the code snippet below, using the ABAP API, it is possible to construct the WHERE clause string from SELECT-OPTIONS.

DATA(lv_sel_tab) = cl_lib_seltab=>new( it_sel = bupa_id[] ).

 

DATA(lv_where_clause) = lv_sel_tab->sql_where_condition( iv_field = 'BUPA_ID' ).

 

2.2 Use SELECT-OPTIONS as a WHERE clause in Native SQL using ADBC

     The code snippet below uses the SELECT-OPTIONS in the Native SQL query. The WHERE clause string, that was constructed from the SELECT-OPTIONS [in the previous step – 2.1] is used in the query.

DATA: LO_SQL_STMT TYPE REF TO CL_SQL_STATEMENT,

      LO_CONN     TYPE REF TO CL_SQL_CONNECTION,

      LO_RESULT   TYPE REF TO CL_SQL_RESULT_SET,

      LV_SQL      TYPE STRING,
      LR_DATA     TYPE REF TO DATA.

DATA: LX_SQL_EXC           TYPE REF TO CX_SQL_EXCEPTION,

      LT_SEPMAPPS_CLSDINV  TYPE TABLE OF SEPMAPPS_CLSDINV,

      LV_TEXT              TYPE STRING.

 

TRY.       

     LV_SQL = | SELECT * |

               && |FROM "_SYS_BIC"."sap.bc.epm.oia.apps/CA_CLOSED_INVOICES" |

                && |WHERE bupa_id = { LV_WHERE_CLAUSE }  |.

    

     LO_CONN = CL_SQL_CONNECTION=>GET_CONNECTION( ).

     "Create an SQL statement to be executed via the connection

          LO_SQL_STMT = LO_CONN->CREATE_STATEMENT( ).

          "Execute the native SQL query

     LO_RESULT = LO_SQL_STMT->EXECUTE_QUERY( LV_SQL ).

 

          "Read the result into the internal table lt_sepmapps_clsdinv

          GET REFERENCE OF LT_SEPMAPPS_CLSDINV INTO LR_DATA.

          LO_RESULT->SET_PARAM_TABLE( LR_DATA ).
     LO_RESULT->NEXT_
PACKAGE( ).
     LO_RESULT->
CLOSE( ).


     LO_CONN->
CLOSE( ).


CATCH CX_SQL_EXCEPTION INTO LX_SQL_EXC.

     LV_TEXT = LX_SQL_EXC->GET_
TEXT( ).
     MESSAGE LV_TEXT TYPE 'E'.

ENDTRY.

 

3. SELECT-OPTIONS and SAP HANA Database Procedures using Open SQL

 

Apply_Filter - HANA SQL Function

     From SAP HANA SPS06 onwards it is possible to express the WHERE clause in a dynamic way using the function APPLY_FILTER. APPLY_FILTER consists of two parameters. The first parameter is the data source and the second parameter is the filter condition that needs to be passed as a string value. This filter condition can also be applied on data source such as SAP HANA views and database procedures.

 

3.1 Convert SELECT-OPTOINS to WHERE clause

     Similar to section 2.1, the code snippet below is used to construct the WHERE clause string from the SELECT-OPTIONS.

 

DATA(lv_sel_tab) = cl_lib_seltab=>new( it_sel = bupa_id[] ).

 

DATA(lv_where_clause) = lv_sel_tab->sql_where_condition( iv_field = 'BUPA_ID' ).

3.2 Use SELECT-OPTIONS as a WHERE clause in SAP HANA Database Procedure

     The next step is to consume the transformed WHERE condition within the Database Procedure using SQL Script.

  1. Create a Database Procedure, DP_CLOSED_INVOICES, with one scalar input parameter [iv_where_clause] of type string and an output parameter [OUT_PARAM] with the structure similar to output structure of the Calculation view, CA_CLOSED_INVOICES
  2. The logic of the database procedure is to read the closed invoices from the Calculation view, CA_CLOSED_INVOICES and apply a filter [using APPLY_FILTER], which is passed as an input parameter.

DatabaseProc.png

 

 

3.3 Create Database Procedure Proxy in ABAP

     In order to consume SAP HANA Database Procedure in ABAP using Open SQL, Database Procedure Proxy must be created in ABAP Dictionary. Create a database procedure proxy, named as ZDP_CLOSED_INVOICESfor the procedure created in step 3.2. Refer to the how-to guide for a step-by-step approach on how to create database procedure proxy in ABAP.

 

3.4 SELECT-OPTIONS as Input Parameter to Database Procedure Proxy

     The code snippet displayed below calls the Database Procedure Proxy from ABAP. In this code snippet, the WHERE condition, is passed to the database procedure as an input parameter.

 

" ZIF_ZDP_CLOSED_INVOICES is an ABAP interface which holds parameter definitions

DATA : lt_closed_invoices type table of ZIF_ZDP_CLOSED_INVOICES=>out_param.

 

" ZDP_CLOSED_INVOICES is Database Procedure Proxy

CALL DATABASE PROCEDURE ZDP_CLOSED_INVOICES

     EXPORTING
          IV_WHERE_CLAUSE =
lv_where_clause
     IMPORTING

          OUT_PARAM       =
lt_closed_invoices.

 


AMDP in ABAP report

$
0
0

Hi all

 

Is it possible to implement AMDP inside a ABAP report?

As of now i have been doing it in a class implementing the marker interface if_amdp_marker_hdb

 

Regards,

Maqsood

Avoid a glitch with an outdated HANA client when installing ERP on the latest version of HANA

$
0
0

When downloading SAP Enhancement Package 7 for SAP ERP 6.0 from Service Marketplace for an installation on HANA the included version of the HANA client is 60. When your SAP HANA version is newer, the ERP on HANA installation would fail in phase Import ABAP as follows, if you had not updated the HANA client accordingly:

abap import.png

R3load exits with return code 1.073.741.819:

import_monitor.png

The data file that failed import, in this case SAPAPPL2.STR:

SAPAPPL2.png

If you could not update the HANA client upfront and therefore already ran into this issue then you would have to:

  1. Update the HANA client to the version of your HANA database
  2. Follow note 1637120 and note 455195 with in it (note 1637120 is about Oracle but besides updating the HANA client rather than the Oracle client the steps remain the same)
  3. Have the Software Delivery Tool retry the failed step

Retry.png

With this the installation should proceed.

Fine-Tune the Execution of SADL-Based Gateway Services

$
0
0

SADL (Service Adaptation Definition Language) enables fast read access to data for scenarios on mobile and desktop applications based on HANA, by means of a query push-down. As part of the query push-down, the user's input and the application parameters are collected through consumer APIs and used to configure the request for the database. The SADL engine adds the resulting restriction to the condition for the database select (WHERE-clause). This document provides a detailed guide on how to use the query options in order to parameterize and fine-tune the execution of your SADL-based SAP Gateway Services.

View this SAP How-to Guide

How To Model a Gateway Service based on CDS View for ABAP using SADL

$
0
0

Overview - This tutorial explains how to model read-only Gateway Service based on Core Data Services (CDS) View for ABAP, using SADL. This guide shows a model-based approach of creating the service which significantly reduces the development efforts. This feature is available from SAP NetWeaver AS ABAP 7.40 SP5 onwards.

View this SAP How-to Guide

How To Create FPM Application Consuming CDS view using ACT

$
0
0

Overview - This tutorial explains how to create a Floorplan Manager (FPM) application consuming Core Data Services (CDS) View for ABAP. The application will be created using Application Creation Tool (ACT). ACT allows you to create the complete application declaratively, i.e., zero coding, thereby significantly reducing the efforts. This feature is available from SAP NetWeaver AS ABAP 7.40 SP5 onwards.

View this SAP How-to Guide

ABAP for SAP HANA Reference Scenario: Open Items Analysis FPM Application created using Application Creation Tool (ACT)

$
0
0

Overview - This document gives a brief overview of the reference application Open Items Analytics (OIA) developed using Application Creation Tool (ACT). The application is based on some of the key features of SAP NetWeaver 7.4 SP5 such as CDS Views for ABAP, ACT.

View this SAP How-to Guide

How to Enable Messaging to SAP UI5 Applications using ABAP Channels

$
0
0

Overview - This how-to guide gives an overview of ABAP Channels and gives you a step-by-step procedure to create ABAP Push Channel and configure communication between two applications hosted on ABAP Application Server.

View this SAP How-to Guide


ABAP in HANA Studio via WTS, error in defining ABAP Project

$
0
0

Dear Colleagues,

 

I managed to configure the ABAP Development Tool in SAP Hana Studio in my WTS.

But as I want to add a new ABAP Project, it ends with an error saying:

 

Logon to system FA7 failed (SNC Library not found; environment variable "SNC_LIB_64" not defined, fallback location does not exist: "C:\Program Files\SAP\FrontEnd\SecureLogin\lib\secgss.dll" )

 

As you know there is not C:\Program Files\... path in WTS.

 

Could please advise,

 

Thank you and best regards,

Steve

Join Us! ABAP for SAP HANA CodeJam in Izmir (Turkey)

ABAP For HANA Development Environment

$
0
0

Anybody Explain ETE Development Cycle of ABAP for HANA?

Call HANA Procedure via AMDP

$
0
0

Hi,

I wrote a procedure on HANA and i want to call via AMDP. As i saw from examples, developers generally writing the content of the procedure here but i wnt to call pre-written HANAprocedure via here.

Is it possible ?

 

My scenario is like that;

 

CLASS ZBPC_AMDP_TEST IMPLEMENTATION.  METHOD RUN_PACKAGE BY DATABASE PROCEDURE FOR HDB                        LANGUAGE SQLSCRIPT.
call Z_SP_TEST(:IN_A, :IN_B, :IN_C, ET_DATA  )  with overview;                         ENDMETHOD.
ENDCLASS.

I dont want to put all my select statement here and also it doesnt support local temporary tables.

Is there a way ?

Open Cursor of secondary HANA database with ADBC

$
0
0

Hi HANA-experts,

 

I need help to change an open cursor of the primary database to an open cursor of the secondary HANA database with ADBC. The open cursor of the primary database is the following:

 

OPEN CURSORcursorFOR

SELECTfieldname1 fieldname2

FROMviewname

WHEREfieldnameIN rangetab.

 

DO

FETCH NEXT CURSORcursor

INTO CORRESPONDING FIELDS OF TABLEinterntab

PACKAGE SIZEcursor_size.

IF sy-subrc <> 0.

EXIT.

ELSE.

"todo

ENDIF.

ENDDO.

 

CLOSE CURSOR:cursor.

 

I have defined the view in HANA Studio. I want to call this view with an open cursor in ERP. I need now a SELECT with cursor using ADBC. Can you give me the best way to solve it?

 

Thx, mlf

Update a global temporary table in AMDP

$
0
0


Hi HANA experts,

 

I am writing a piece of code using AMDP. I have a few basic questions.  I'm wondering if you could help me.

 

 

  1. Is local temporary table not supported in AMDP?
  2. In order to avoid local temporary table, I created a global temporary table.  In which
    schema should I put this global temporary table?  “_SYS_BIC”?  Does the user by default
    have the authorization to create this table and insert/update/delete records in this
    table?
  3. I wrote an UPDATE statement to update a record in this global temporary
    table.  The compiler immediately tell me that “SQLScript: feature not
    supported”.   What should I do? Delete the record and then re-insert it?

 

Thanks,

Xin

Video Tutorials about ABAP for SAP HANA

$
0
0

This page provides a collection of video tutorials about ABAP for SAP HANA developement based on SAP NetWeaver AS ABAP 7.4 (and higher). More information, guides and tutorials can be found here: http://scn.sap.com/docs/DOC-35518.

 

 

ABAP for SAP HANA Reference Scenario - Overview

This video gives a brief overview of the demo application Open Items Analysis (OIA) which is intended to provide developers with how-tos around the native ABAP consumption of the new powerful HANA-related capabilities introduced with SAP NetWeaver 7.4 powered by SAP HANA. It shows how to access and used the delivered ABAP and HANA developement entities.
Access the video here.

 

Implementing ABAP Managed Database Procedures on SAP HANA (New)

This tutorial demonstrates how to implement an ABAP Managed Database Procedures (AMDP) on SAP HANA, based on SAP NetWeaver AS ABAP 7.4 Support Package 5.

Previously watch the video "Introduction into ABAP Managed Database Procedures on SAP HANA".

 

 

Debugging ABAP Managed Procedures on SAP HANA(New)

This tutorial demonstrates how to debug an ABAP Managed Database Procedure on SAP HANA, based on SAP NetWeaver AS ABAP 7.4, Support Package 5.

 

Building Core Data Services Views in ABAP on SAP HANA (New)

This tutorial demonstrates how to build Core Data Services (CDS) views in ABAP on SAP HANA, based on SAP NetWeaver AS ABAP 7.4 Support Package 5.

Previously watch the video "Introduction into Advanced View Building in ABAP on SAP HANA".

 

 

Using the new ALV on HANA Component (New)

This tutorial shortly demonstrates how to use the SAP List Viewer with Integrated Data Access on SAP HANA (aka ALV on HANA), based on SAP NetWeraver AS ABAP 7.0, Support Package 05.

 

Find Optimizable Custom Code with the SQL Performance Tuning Worklist (New)

This tutorial shortly demonstrates how to find tunable ABAP custom code for SAP HANA using the SQL Performance Tuning Worklist (SWLT), based on SAP NetWeraver AS ABAP 7.0, Support Package 05.

 

Consuming native SAP HANA procedures in ABAP

In this video tutorial, we see how to use database procedure proxies to  natively consume SAP HANA procedures in ABAP in order to build a quick "Top and Flop" customer list.

For more information on this topic, please visit the SCN document.

 

Consuming native SAP HANA Views in ABAP

In this video tutorial, we see how to use external views to natively consume SAP HANA views in ABAP.

For more information on this topic, please visit the SCN document.

 

 

Using the HANA Transport Container

In this video tutorial, we see how to transport ABAP and SAP HANA content using the HANA Transport Container.

For more information on this topic, please visit the SCN document.


Featured Content for ABAP for SAP HANA

$
0
0

What's new in SAP NetWeaver AS ABAP 7.4 SP5?

The newly released AS ABAP 7.4 SP5 brings the interplay between ABAP and SAP HANA to another level and provides enhanced capabilities in regards to the ABAP for HANA development following the “code-to-data” paradigm. Find more information about the new ABAP for HANA features in Jens Weiler's blog here. January 23 2014

 

Want to try ABAP for SAP HANA yourself ? Check out the brand new E2E Development Guide

This document guides you through an end to end development example with SAP NetWeaver 7.4 SP5 on SAP HANA. You'll leverage the power of SAP HANA via the code-pushdown capabilities provided by the AS ABAP 7.4. Come on and take a look in it here. April 24, 2014


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

Multiplying two columns by CE functions

$
0
0

Hi all,

I want to compare performance results between SQL script and CE functions.

I have 2 tables joined and i am multiplying 2 columns by using subquery. Tables are like that;

 

TABLE: SALES

MATERIALID -------- TOTAL

 

 

TABLE: PRICES

MATERIALID -------- UNITP

 

 

query is similar like

 

Select PRICES.MATERIALID, Prices.UNITP * (select sum(TOTAL) from SALES
where PRICES.MATERIALID = SALES.MATERIALID ) as TOTAL_AMOUNT
from PRICES.

is there a way to do it via CE functions ?

Thank you.

what is hana ? does the syntax for abap in hana changes ?

$
0
0

Hi All,

I am very much interested to know HANA.

can any one please explain me ???

can we use normal ABAP syntax for HANA?

 

Regards,

Abdul

Brand-new ABAP 7.4 for SAP HANA End to End Development Guide with Latest ABAP 7.4 SP5 Features

$
0
0

Hey there! This document guides you through an end to end development example with SAP NetWeaver 7.4 SP5 on SAP HANA. You'll leverage the power of SAP HANA via the code-pushdown capabilities provided by the AS ABAP 7.4, in particular you'll create and consume CDS views as well as ABAP managed database procedures. Based on these new ABAP entities, you build a SAP NetWeaver Gateway OData services which feeds data to a Fiori-like application. Ready? Then please buckle up, get your seats in an upright position, and start with the guide! :-) Cheers,   Jasmin

View this Document

Unable to add ABAP plug-in in hana studio

$
0
0

Hi Gurus,

 

 

I installed below version

SAP HANA Studio

Version: 1.0.48

Build id: 201301130825 (372847)

 

 

I am trying to add ABAP tools from https://tools.hana.ondemand.com/juno but I am getting below errors.

 

Cannot complete the install because one or more required items could not be found.

  Software being installed: ABAP Core Development Tools (Developer Edition) 2.24.0 (com.sap.adt.core.devedition.feature.group 2.24.0)

  Missing requirement: ABAP Development Tools Connectivity 2.22.0 (com.sap.adt.connectivity.feature.group 2.22.0) requires 'org.eclipse.platform.feature.group [4.2.0,5.0.0)' but it could not be found

  Cannot satisfy dependency:

    From: ABAP Core Development Tools (Developer Edition) 2.24.0 (com.sap.adt.core.devedition.feature.group 2.24.0)

    To: com.sap.adt.core.feature.group [2.24.0]

  Cannot satisfy dependency:

    From: ABAP Core Development Tools 2.24.0 (com.sap.adt.core.feature.group 2.24.0)

    To: com.sap.adt.connectivity.feature.group [2.22.0]

 

Please help me out in resolving those.

 

Regards,

Rahul

Viewing all 831 articles
Browse latest View live


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