Quantcast
Channel: SCN : Unanswered Discussions - ABAP for SAP HANA
Viewing all 613 articles
Browse latest View live

Retrieving table data by calling AMDP dynamically into another AMDP procedure

$
0
0

Hello,

 

          As per my requirement, i have one AMDP procedure which is returned table data. I try to call this AMDP dynamically into another AMDP using EXEC statement but i don't know how to get the return data after calling this AMDP. Can any one please help me on this if it is possible?.

 

class ztest implementation.

   method call_amdp by database procedure for hdb language sqlscript.

        declare lv_sql nvarchar(1000);

        lv_sql := 'CALL "ZTEST_PROC" ( LT_DATA ) ' ;

 

        EXEC : lv_sql.

 

***** Here how to retrieve the LT_DATA values .

 

   endmethod.

end class.

 

Thanks,
Venkatesh


Call UDF from CDS view and SQL console

$
0
0

Hi Experts,

 

I've question about user defined functions UDF - scalar type.

In my CDS view I tried to use currency_conversion function - with success.

 

@AbapCatalog.sqlViewName: 'Z079MM_CV_CDS_07'
@EndUserText.label: 'MBEW'
define view Z079mm_Cv_Mebew_Z_Ext
with parameters p_to_currency:abap.cuky(5),                               p_exc_date:abap.dats,
as
select from mbew           join t001k         on mbew.bwkey = t001k.bwkey       join t001         on t001k.bukrs = t001.bukrs    
{  key mbew.bwkey,  key mbew.matnr,  key mbew.bwtar,  lbkum,  salk3,  :p_to_currency as currency,
/////----------->here
currency_conversion( amount => salk3,                       source_currency => waers,                       round => 'X',                       target_currency => :p_to_currency,                       exchange_rate_date => :p_exc_date                       ) as salk3_cur                                                                                                                                                                         
}

This function is defined by SAP in schema SAPABAP1:

c.jpg

 

Later I wanted to use my function DIV_CURR defined in schema EXRMATUSZEWSKI:

@AbapCatalog.sqlViewName: 'Z079MM_CV_CDS_09'
@EndUserText.label: 'MBEW'
define view Z079mm_Cv_Mebew_Z_Ext2
with parameters p_to_currency:abap.cuky(5),                p_exc_date:abap.dats
as
select from mbew           join t001k         on mbew.bwkey = t001k.bwkey       join t001         on t001k.bukrs = t001.bukrs    
{  key mbew.bwkey,  key mbew.matnr,  key mbew.bwtar,  lbkum,  salk3,  :p_to_currency as currency,
currency_conversion( amount => salk3,                       source_currency => waers,                       round => 'X',                       target_currency => :p_to_currency,                       exchange_rate_date => :p_exc_date                       ) as salk3_cur,
/////----------->here                        div_curr(salk3,2) as result2                               //"EXRMATUSZEWSKI"."DIV_CURR"(salk3,2) as result3                                                                                                                                                    
}
}fffd

but compilator says "Function div_curr is unknown". I tried to add schema name but it not worked.

Both functions are scalar functions and are defined in similar way:

d.jpg

 

What is wrong with my code in CDS view? Is my own function really unreachable from CDS view?

 

In contrast in SQL console:

this works:

select div_curr(10,2) as result
from dummy

this is not working:

select currency_conversion( amount => '1000',                           source_currency => 'PLN',                           rounding => 'X',                           target_currency => 'EUR',                           exchange_rate_date => '20151211'  ) as salk3_cur  from dummy
select "SAPABAP1"."CURRENCY_CONVERSION"( amount => '1000',                                         source_currency => 'PLN',                                         rounding => 'X',                                         target_currency => 'EUR',                                         exchange_rate_date => '20151211'  ) as salk3_cur  from dummy   

Again why? what's the difference between those functions?

 

Best regards

Rafal

Limit Data in CDS for huge results

$
0
0

Hey Guys,

 

I have implemented the following CDS (ABAP on HANA):

 

CDS.jpg

 

It's basically a join of 3 huge tables (~150 Mio. records) with some extra logic. I need this split into 3 tables because the result of the join without any condition would result in over 50 billion records. When I access this view in ABAP with where clause like:

 

select * from /ascorpi/raav into table @data(lt_raa) where ip = '000C29E454191EE58BDFCA7F32185B16'

This is processed in ~300ms (That's fine).

 

For some other where clauses (or without where clause) this cannot be processed anymore though I limited the result on 10k records:

 

select * from /ascorpi/raav into table lt_raa up to 10000 rows.

It seems like the join is fully processed on the HANA DB and just the number of records that is copied over to the ABAP application server is limited to 10k records. This select kills the whole system...

 

Is there a way to limit the number of results on CDS level? I am never interested in a "full join" of all data. When I query with a bad where clause I want to have a limit that applies. Because of the structure of my data, I don't see a way to use some aggregate funcitons like min() or max() combinded with a "group by" clause.

 

I really appreciate your help.

 

Regards

 

Tobias

Other then ABAP, can CDS consumed by others reporting tools? e.g Bobj, Lumira

$
0
0

Dear Expert,

 

Other then ABAP, can CDS (core data services) consumed by other reporting tools? e.g Bobj, Lumira or HANA modeling join with other hana view. I googled but can't find any.

 

Thank you.

Duplicate records are coming while executing the querry in CDS in HANA studio

$
0
0


Hi Experts,

 

I have created below class in HANA studio and using AMDP concept here as shown 

 

Class_1.PNG

I am calling this class from a program as shown below:-

Program_1.PNG

 

I am getting below output

Output_1.PNG

 

Although my table containing 3 entries for the given bill doc. no. The records are repeating here.  Please let me know what went wrong here. I have checked in debug, method is executing once only so 3 records should come but in single execution I am getting 12 records. When I modified my class method as below I am getting exactly 3 records as expected.

 

 

Method_implement.PNG

 

 

 

 

 

Output_2.PNG

I have attached the code in the attachment

ABAP Correction for HANA compliance

$
0
0

Hello,

I have to manually correct ABAP code for HANA compliance for 'Analysis of WHERE condition for SELECT'.

Here in the below code I have to add WHERE clause, please suggest how to find out that what can be added with the Where clause.

Actually the code is a part of a program, and I don't know how that program is working.

CODE:

SELECT * INTO TABLE lt_hfm FROM Ztf_hfm.

 

Plz ask if any clarification is needed.

 

Regards,

AMAN

AMDP ranges and normal operators in where clause?

$
0
0


Hi,

 

I creating a AMDP in order to utilize the ROW_NUMBER function.

 

My "base" sql that I need in the AMDP is shown below. As you see will MATERIAL and /BIC/TRADE_ID have to be replaced by ranges (it is just example values that are shown). As well are there constant values for BILL_TPE and DOC_TYPE. For DATEFROM, DATETO and BILL_DATE will I have to se >= and <= opererators - the date is not fixed and will set on basis of a variable that I pass to the AMDP class.

 

Will that be possible in a AMDP? As off now I have done as you see below - I expect that will work for the range and constant value, but how about dates, how do I get that as part of the where clause as well?:

 

where_clause.PNG

 

The "base" sql that has to be executed in the AMDP where trade id and material has to be replaced by ranges and datefrom, dateto and bill_date has to be replaced by a variable.

 

amdp_sql.PNG

Thanks in advance.

KR

Torben

Alternative of EXEC Sql-ENDEXAC

$
0
0

I am transforming our oracle based ABAP code to HANA based code.So during this procedure I need to replace the native sql statement EXEC sql-ENDEXEC with some other HANA compatible statement because this statement is giving error in code inspector.I can't find any kind of replacement statement of this native sql.So please help me to do this.It is urgent for our project.Thank in advance


ABAP for HANA

$
0
0

Hi All,

I have learned that HANA is very vast.

I will be thankful for kindly guiding me what to focus on in HANA as an ABAPer.

 

 

Thanks,

SD

I can´t create external view from ABAP perspective

$
0
0

Hi Experts,

 

I am try to create a external view from ABAP perspective, but the list of attibute views don´t appear.The attibute view is this:

 

 

When try the create a external view:

 

 

These are the roles with which the view was created:


 

 

 

Thanks very much

Victor Hugo

Create CDS view using HANA live view

$
0
0

I was working on couple of LIVE views (ex. "_SYS_BIC"."sap.hba.ecc/WorkCenterCapacity"). I converted this into external view and while trying to consume it in CDS view it's showing an generic error ( ‘An error occurred while creating view <ZXXXX> in the database.’).

 

Few more scenarios I tried:

1. While using DDIC view in CDS, it's working.

2. While converting customized HANA view to external view, I can consume the same external view to CDS without any error.

3. Even encapsulating Live view into HANA view and using that converted ext view to CDS- throwing same generic error.

 

Not sure what is the special about those external view converted from LIVE view directly or indirectly.

 

Any suggestion/comment will be really appropriated.

Consumption of ABAP CDS view.

$
0
0

Hi All,

 

Is it possible to consume the ABAP CDS view to other reporting tool i.e. analysis for office, lumira, Dashboard etc.

If yes, Can you please guide how to achieve it.

 

Many thanks in advance.

 

Gaurav

Dynamic insert statement to update cross schema tables

$
0
0

Can any one help me to write a dynamic  INSERT statement in AMDP  method.

Requirement is ,  I have to update the cross schema table  from another  system.

 

I have to Update Z-Table in BW system  .

I created a method in CAR system and  run the program to update a table in BW  system.

 

INSERT INTO SAPSD1.ZTABLE    select * from :ITAB;

 

This is updating  in BW related Ztable  from  CAR system .  SAPSD1  is  BW  dev  schema.  To work  this  same  statement in BW  qa and PRD I have written like below.

 

LV_SQL  := 'INSERT INTO'  ||:IV_TABLE||    ' select * from :ITAB';

EXEC LV_SQL;

 

There is no syntactical error  in method , but  when I execute the program from CAR system I am getting  error  :  SQL Code 257.

 

NOTE   :     IV_TABLE.        will  have the  value  :  SAPSC1.ZTABLE ( when the program execute  from  CAR DEV)

                                                                                 SAPSQ1.ZTABLE  ( When the program execute from CAR QA )

                                                                                 SAPSP1.ZTABLE ( When the program execute from CAR Prod).

Can anyone help me to solve this ?

Doubt regarding SAP HANA-ABAP

$
0
0

Hi Experts,

Can anybody guide what will happen to skills like BDCs, BAPIs, workflows, Smartforms,screen exits,user exits,customer exits,BADIs etc on migration to S4-HANA.

Will these skills be obsolete?Kindly guide.

 

 

Thanks,

SD

hi


Duplicate records are coming while executing the querry in CDS in HANA studio

$
0
0


Hi Experts,

 

I have created below class in HANA studio and using AMDP concept here as shown 

 

Class_1.PNG

I am calling this class from a program as shown below:-

Program_1.PNG

 

I am getting below output

Output_1.PNG

 

Although my table containing 3 entries for the given bill doc. no. The records are repeating here.  Please let me know what went wrong here. I have checked in debug, method is executing once only so 3 records should come but in single execution I am getting 12 records. When I modified my class method as below I am getting exactly 3 records as expected.

 

 

Method_implement.PNG

 

 

 

 

 

Output_2.PNG

I have attached the code in the attachment

HANA Development: Asterisk (*) vs. detailed field specification in select statements

$
0
0

Dear all,

 

I have learned that using the asterisk / star * select Statements is a Performance Problem when using a HANA database.

 

 

For example,

------------------------------------------------------

data lt_t100 type table of t100.

select * from t100 into lt_t100 where sprsl = 'EN'.

------------------------------------------------------

 

is a critical coding.

 

 

What I am asking myself is whether the following construction is an improvement:

------------------------------------------------------

data lt_t100 type table of t100.

select SPRSL ARGBG MSGNR TEXT from t100 into lt_t100 where sprsl = 'EN'.

------------------------------------------------------

Actually, this does select the same fiields, but not using the * Syntax.

 

 

My question is:

 

Will that improve selection performance ?

 

 

 

Or will it only prevent the code inspector from grouching ?

 

Any help or comment is welcome !

 

 

 

 

 

 

Regards,

Martin

How to start working on Eclipse using ABAP?

$
0
0

Hi,

 

I need some reference or basic fundamental to start working on Eclipse using ABAP.

Please let me know if anybody can help in this.

HANA secondary database connections are exhausted.

$
0
0

Hi All,

 

 

 

We are running BW application on HANA 85.02.

 

 

 

Some background job failed with  DBIF_RSQL_INVALID_RSQL dump. It showing The rescources for further secondary database connections are exhausted.

 

 

 

Please help us where to check secondary database connections details.

 

 

 

 

 

Regards,

MK

Should an ABAP CDS be 1:1 to a business req?

$
0
0

As a beginner using CDS I have one basic question.

While creating CDS should we treat it like a report that satisfies one business requirement or should it be open to enhancements?

For eg. Can I use an existing view defn and extend it to hold more fields instead of creating a brand new CDS if the selection criteria is more or less the same. 

 

What are the consequences?

 

Thanks.

Meera

Viewing all 613 articles
Browse latest View live


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