Quantcast
Channel: SCN: Message List - ABAP for SAP HANA
Viewing all 2110 articles
Browse latest View live

calling CDS view with input parameters using associations

$
0
0

Hi Experts,

 

I have a requirement to call an CDS view with input parameters using associations.

 

I understand it is possible to call a CDS view with input paramaters using below syntax :

 

SELECT FROM TestView(startDate = '20150101')

 

But how to write association for CDS view with input paramaters?

 

Thanks,

Puneet Jain


Re: How to use SQL query for HANA view in AMDP Class

$
0
0

Please check HANA View as well as underlying HANA view aslo..

 

-Amol S

Re: How to use SQL query for HANA view in AMDP Class

$
0
0

Hi Amol,

 

HANA view is working fine and also I executed SQL query while using HANA view in SQL console as said earlier, which is working also fine.

 

Regards,

Chintan

Re: How to compute/calculate based on String?

$
0
0

Hi

 

try this sql as in the image.you can add the case for div and multiplication also.

 

Capture1.PNG

Re: How to compute/calculate based on String?

$
0
0

Arun Kumaar Menon wrote:

 

Hi

 

try this sql as in the image.you can add the case for div and multiplication also.

 

Capture1.PNG

 

Hi Arun -

 

Thanks for the quick response. However, I found this way is difficult due I will have bracket (  ) , and If statement, and other things. I might go to this way for the last resort.

Hence, I am thinking to put all those amount into 1 string or nvarchar, and need 1 SQL Command to handle the computation.

 

If you have any thought on this - what is the SQL Command/Syntax, and the sample code, kindly please let me know.

 

Many thanks,
Daniel.

Re: AMDP Execution failed because of large amount of data

$
0
0

Hi

 

I think if you do this way may be it will help

 

  1. First create a query with fixed where clause which will reduce the number of record for eg filter it by year
  2. on this result set apply filter.which is dynamic

Re: SAP ABAP(7.4 SP11) CDS consumption to Analysis for office not working

Error in sap ecc6 ehp7 installation in phase sap hana post load activities

$
0
0

Hi Experts,

 

While installing ECC6 EHP7 on hana we are facing issue in performing sap hana post load activities like below,

 

Error.JPG

 

 

while executing command in hana with SYSTEM useri am facing issue like below,

 

Error in HANA.JPG

 

 

 

 

Please guide us for this issue.

 

Thanks in advance

Jana


Re: SAP ABAP(7.4 SP11) CDS consumption to Analysis for office not working

$
0
0

If you think the question is answered, please mark Answered.

Updating data in HANA DB

$
0
0

Hi ,

 

I am using HANA DB as my secondary database.

I need to update data in some  table.

I am taking refrence from brilliant SAP demo program ADBC_DEMO for all data operations. But when I execute method to create a table , i can see that table is created in HANA studio.

WHen I insert / delete data  in that table , my ABAP code given no error. But I cant see data updates in HANA .

After that when I fetch data , I am getting updated data. Though that updated data i can not see in HANA.

What is the possible reason for this?

Re: Updating data in HANA DB

$
0
0

Hi Meenu,

What exactly the error you are receiving on Studio?

 

 

Amit

Dump when calling AMDP

$
0
0

Hello Experts,

 

I am receiving below dump when calling my AMDP method. I am not able to figure out the reason.

Request your help. Google has resulted only 7 results for this dump. None seem relevant.

 

Dump details:

 

Category          ABAP programming error
Runtime Errors    AMDP_EXECUTION_FAILED
Except.           CX_AMDP_EXECUTION_FAILED
ABAP Program      ZCL_AMDP_EXAMPLE==============CP

Application Component  Not assigned

 

Dump location: The dump occurs at declaration of AMDP method i.e. at below statement

 

  METHOD GET_MAT_DET_AMDP

  BY DATABASE PROCEDURE FOR HDB

  LANGUAGE SQLSCRIPT

  options READ-ONLY

  using mara makt marc.

 

Report call: The report calls method GET_MAT_DET2 which calls method GET_MAT_DET_AMDP

 

AMDP Class details

 

CLASS zcl_amdp_example DEFINITION

  PUBLIC

  FINAL

  CREATE PUBLIC .

 

  PUBLIC SECTION.

 

    INTERFACES if_amdp_marker_hdb.

 

    TYPES: BEGIN OF ty_mara,

             matnr TYPE mara-matnr,

             ersda TYPE mara-ersda,

             ernam TYPE mara-ernam,

             maktx TYPE makt-maktx,

           END OF ty_mara,

           tt_mara TYPE TABLE OF ty_mara.

 

    TYPES: BEGIN OF ty_marc,

             matnr type mara-matnr,

             werks type marc-werks,

           END OF ty_marc,

           tt_marc type TABLE OF ty_marc.

 

  methods GET_MAT_DET2

    importing

      IM_MATNR type MARA-MATNR

    exporting

      EX_MATDET type TT_MARA

      EX_MARC   type TT_marc.

 

  PROTECTED SECTION.

private section.

 

  methods GET_MAT_DET_AMDP

    importing

      VALUE(IM_MATNR) type MARA-MATNR

    exporting

      VALUE(IM_client) type mandt

      VALUE(EX_MATDET) type TT_MARA

      VALUE(EX_MARC)   type TT_marc.

 

ENDCLASS.

 

CLASS ZCL_AMDP_EXAMPLE IMPLEMENTATION.

 

  METHOD GET_MAT_DET_AMDP

  BY DATABASE PROCEDURE FOR HDB

  LANGUAGE SQLSCRIPT

  options READ-ONLY

  using mara makt marc.

 

    ex_matdet = SELECT  mara.matnr,

                        mara.ersda,

                        mara.ernam,

                        makt.maktx

    FROM mara as mara JOIN makt as makt

    on mara.mandt = makt.mandt

    AND mara.matnr = makt.matnr

    WHERE mara.mandt = :im_client

    AND mara.matnr = :im_matnr

    AND makt.spras = 'E';

 

    ex_marc = SELECT marc.matnr, marc.werks

    from marc as marc JOIN :ex_matdet as ex_matdet

    ON marc.matnr = ex_matdet.matnr

    where marc.mandt = :im_client

    and   marc.matnr = :im_matnr;

 

  ENDMETHOD.

 

  METHOD GET_MAT_DET2.

 

        CALL METHOD get_mat_det_amdp

          EXPORTING

            im_matnr  = im_matnr

          IMPORTING

            im_client = sy-mandt

            ex_matdet = ex_matdet

            ex_marc   = ex_marc.

 

  ENDMETHOD.

 

ENDCLASS.

 

Report details

 

REPORT zgen_amdp_example.

PARAMETERS: p_matnr type mara-matnr.

DATA: it_matdet TYPE zcl_amdp_example=>tt_mara,
       it_marc   TYPE zcl_amdp_example=>tt_marc.

* instantiation
DATA(lo_amdp_example) = new zcl_amdp_example( ).

* execution

lo_amdp_example->get_mat_det2(
   EXPORTING
     im_matnr  = p_matnr
   IMPORTING
     ex_matdet = it_matdet
     ex_marc   = it_marc
).

Re: Dump when calling AMDP

$
0
0

Hello Sanket,

 

please can you add an exception handling to your method call to find out more details (add exception class CX_AMDP_ERROR to the declaration fo method GET_MET_DET2 and catch the exception when the method is called; check with methods GET_TEXT, GET_LONGTEXT if more details are provided).

 

Another point is how you work with the client. It is not correct that the client is an exporting parameter in the AMDP method. You have to declare it as importing parameter to be able to use it successfully with the correct client value in your where clause. As you have used already the naming convention IM_CLIENT I think it was already in your mind to do so.

 

Regards,

Florian

Re: Dump when calling AMDP

$
0
0

Thanks for the update.

Client as an exporting parameter was the issue.

Silly I overlooked it. I had planned to use client as an importing parameter but placed by mistake in exporting parameter.

Re: Why the ATC message "DB Operation SELECT for ... found" is a problem ?

$
0
0

Hi,

 

What I have found is - If we have selected "Search DB Operations" in our variants. It will list down all the DB related Queries - SELECT, DELETE, UPDATE, INSERT in program. Prime purpose of selecting this option to get the list of DB interaction from program.

 

Thanks & Regards,

Rajesh


Re: calling CDS view with input parameters using associations

$
0
0

Hello Punit,

 

Please check the below code and try to modify as per your requirement.

 

define view zcds_p_assc

  with parameters p_distance_l:S_DISTANCE,

                  p_distance_o:S_DISTANCE,

                  p_unit:S_DISTID

  as select from spfli

association [1..1] to scarr as spfli_scarr

              on $projection.carrid = spfli_scarr.carrid     

            { key spfli.carrid,

              key spfli.connid,

                  spfli_scarr.carrname,

                  spfli.cityfrom,

                  spfli.cityto,

                  spfli.distance,

                  spfli.distid }

            where spfli.distid = :p_unit and

                           spfli.distance between :p_distance_l

                                        and :p_distance_o;

 

Regards,

Lokeswar.

Re: ADBC Insert Query not working

Re: calling CDS view with input parameters using associations

$
0
0

Hi Puneet,

 

Are you trying to use path expression in Open SQL to access the associated CDS view? If yes, you cannot pass input parameters to the associated CDS view.

 

No actual parameters can be passed to input parameters of the CDS views of associations. There are no optional input parameters, which means that these views cannot currently be used in Open SQL path expressions.

 

Regards,

Panneer

Re: calling CDS view with input parameters using associations

$
0
0

Hi Panneer,

 

I got below example on how to use associations on CDS with input parameters.

 

Example :

 

CDS with Input Paramater :

 

define view ZCDSWithInputParams

  with parameters  startDate : abap.dats , endDate : abap.dats

     as select from salesOrder

{

key node as SalesOrderItem,

amount

 

}

 

Calling CDS with input parameters using association :

 

define view ZCDSTest

     as select from ZCDSTest2

association[0..1] to ZCDSWithInputParams as _mySales on $projection.node = _mySales.node

{

_mySales(startDate : '20150101' , endDate : '20160101').SalesOrderItem

}

 

Thanks,

Puneet Jain

Hello SAP Gurus

$
0
0

I am into SAP ABAP and willing to explore on SAP HANA..Could anyone share some Documents related to SAP HANA..?

Viewing all 2110 articles
Browse latest View live


Latest Images

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