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

Multiplying two decimals in ABAP CDS View

$
0
0

Hi,

in the select list of an ABAP CDS view I am trying to multiply to decimal values ( price * quantity ) - this leads to the error message:

 

Maximum accuracy 31 as DEC exceeded by an arithmetic expression

 

I tried to cast price and quantity to FLTP before the multiplication. At design time I'm getting warnings (Decimal places are corrected to 16), but the view wouldn't acitvate.

 

How can I perform a simple multiplication of two decimal fields? I am on ABAP 7.4 SP12.

 

Thanks,

Marek


CDS CURRENCY CONVERSION (ABAP on HANA)

$
0
0

Hi All,

 

I'v tested CDS with currency conversion versus the classical approach with the function module for currency converion on application layer (CONVERT_AMOUNT_TO_CURRENCY). The classical approach seemed to be much faster, so I started testing.

 

Please find attached the objects used for testin:

  • y_cds_test_currconv.txt -> Simple ABAP report with both options
  • Y_CDS_TEST_CURRCONV.txt -> The CDS view

 

I test on a system with AS ABAP 7.4 SP8 + HANA SP 8 and also AS ABAP 7.4 SP8 + HANA SP 9.

 

There's actually an OSS, but the it's refering to Oracle DB and not HANA DB (2067294).

 

Native SQL statment (tracing done with ST05)

 

SETSCHEMA"SAPMDE";

SELECT

   "CARRID",

   "CONNID",

   "FLDATE",

   "SOURCE_PRICE",

   "SOURCE_CURRENCY",

   "TARGET_AMOUNT",

   "TARGET_CURRENCY"

  FROM

    "YTESTCUR" ( "TO_CURRENCY" => 'EUR' ,

                              "EXC_DATE" => '20150427' ) "YTESTCUR"

  WHERE

    "MANDT" = '100'


Result

native_sql.gif

 

Change the CDS and replace the CURRENCY_CONVERSOIN by table field PRICE. (to check if the slow performance is cause by the currency conversion function)
cds_change.jpg

Result run native SQL statement:

cds_change_result.jpg

 

I have also run the SAP HANA Plan Visualizer, refer the next screenshots.

 

visualizer1.jpg

 

visualizer2.jpg

visualizer3.jpg

 

It seems to me that the currency conversion has some performance issue. Has anybody experienced the same and maybe found a solution?

 

One final remark: for testing you need to have data in FLIGHT model. (Go to SE38 and run SAPBC_DATA_GENERATOR to generate data)

 

Thanks in advance.

 

Best Regards,

 

Bart

Problem with cl_salv_gui_table_ida

$
0
0

Hello,

 

I'm using the new ALV 'cl_salv_gui_table_ida' combined with a Core Data Service. I've activated the toolbar text search and enabled the search for a plenty of columns:

 

    go_alv_display->field_catalog( )->enable_text_search( 'NAME1' ).

    go_alv_display->field_catalog( )->enable_text_search( 'ORT01' ).

    go_alv_display->field_catalog( )->enable_text_search( 'PSTLZ' ).

    go_alv_display->field_catalog( )->enable_text_search( 'INFNR' ).

    go_alv_display->field_catalog( )->enable_text_search( 'LIFNR' ).

    go_alv_display->field_catalog( )->enable_text_search( 'LIFNR_2' ).

    go_alv_display->field_catalog( )->enable_text_search( 'MAKTX' ).

    go_alv_display->field_catalog( )->enable_text_search( 'SMTP_ADDR' ).

    go_alv_display->field_catalog( )->enable_text_search( 'ORT02' ).

 

The search is working for the fields NAME01, ORT01, PSTLZ, MAKTX, ORT02, The other columns don't work in the search.

 

I've checked the coding and found out that the search_scope is just filled with the working columns.

 

Class: CL_SADL_ABQI

Method: _GET_SEARCH_SCOPE

 

But I couldn't find the coding where the scope is filled.

 

Thx for your help!

Frank

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

How to Call HANA Procedure in ABAP

$
0
0

Hi Everyone,

 

I am new to ABAP

I have created a procedure in HANA that accepts two input parameters and outputs a table
I am using HANA as a Secondary Database
How can I call this procedure in my ABAP program?

 

Regards,

Vivek

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 ?

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.

IDA alv aggregation of different units/currencies is not possible

$
0
0

Hi,

 

when i try to collect quantities in ida ALV, it gives an error message "aggregation of different units/currencies is not possible"

 

do you have any idea?

 

1.png


CDS view currency conversion performance

$
0
0

Hi All,

Currency_conversion function in CDS view  terribly decrease performance of the cds  view,  view running in few seconds run for minutes after adding currency_conversion function. I am working on 7.40 SP10 system.

- I could not find any note for the issue for my system's support pack level ( I will open one )

- I tried to select  conversion ratio from tcurr table but it is necessary to subtract gdatu date from 9999999 to get actual date and could not cast gdatu to numeric field to  be able to perform necessary arithmetic operation in cds view. 

- Last solution I have in mind but  trying to avoid  is creating ZCURR table with proper date field instead of gdatu and filling it for the past and recent currency values using a simple program and daily job.


Do you have any other solution for above problem ? I searched the forum but find only one post for the issue which does not suggest any solution 

Consuming HANA Stored Procedures from ABAP in One Step

$
0
0

Hello,

 

I recently learned about calling HANA stored procedures from ABAP. As per the instructions, we are supposed to use the WITH OVERVIEW addition while calling the stored procedure. This would result in a name-value table (basically containing the output parameters of the stored procedure) using which as the basis, we need to write subsequent queries in order to get the data that we want. So, broadly speaking that's two main steps - the first where we write code to get the overview table and the second where we query based on the overview table.

 

I wonder if there is a shorter way of calling stored procedures, one that involves just one step where you are able to pass the information about which parameters' data you are looking for so that the single call returns you all the data. Is there such a way? Maybe one that involves NOT using the WITH OVERVIEW addition?

 

Thanks,

Akshat

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.

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

CDS view currency conversion performance

$
0
0

Hi All,

Currency_conversion function in CDS view  terribly decrease performance of the cds  view,  view running in few seconds run for minutes after adding currency_conversion function. I am working on 7.40 SP10 system.

- I could not find any note for the issue for my system's support pack level ( I will open one )

- I tried to select  conversion ratio from tcurr table but it is necessary to subtract gdatu date from 9999999 to get actual date and could not cast gdatu to numeric field to  be able to perform necessary arithmetic operation in cds view. 

- Last solution I have in mind but  trying to avoid  is creating ZCURR table with proper date field instead of gdatu and filling it for the past and recent currency values using a simple program and daily job.


Do you have any other solution for above problem ? I searched the forum but find only one post for the issue which does not suggest any solution 

Hi.. while creating alv hierarchical report . i got error fieldcatlog not found. help ll be appreciate.

$
0
0

REPORT ZSG_ALV_HIERARCHICAL_SO.

 

TYPE-POOLS:SLIS.

 

TABLES:VBAK,VBAP.

 

 

 

TYPES: BEGIN OF TY_VBAK,

          VBELN TYPE  VBAK-VBELN,         "SALES DOC

          ERDAT TYPE  VBAK-ERDAT,         "DATE ON WHICH RECORD CREATED

          ERNAM TYPE  VBAK-ERNAM,         "NAME OF PERSON RECORD CREATED

          AUDAT TYPE  VBAK-AUDAT,         "DOC DATE

          AUART TYPE  VBAK-AUART,         "SALES DOC

          VKORG TYPE  VBAK-VKORG,         "Sales Organization

          VTWEG TYPE  VBAK-VTWEG,         "Distribution Channel

          SPART TYPE  VBAK-SPART,         "Division

          VKGRP TYPE  VBAK-VKGRP,         "Sales Group

          EXPAND,

END OF TY_VBAK.

 

DATA:LT_VBAK TYPE TABLE OF TY_VBAK,

      LS_VBAK TYPE TY_VBAK.

 

TYPES:BEGIN OF TY_VBAP,

         VBELN TYPE VBAP-VBELN,           "SALES DOC

         POSNR TYPE VBAP-POSNR,           "SALES DOC ITEM

         MATNR TYPE VBAP-MATNR,           "MATERIAL NUMBER

         MATKL TYPE VBAP-MATKL,           "MATERIAL GRP

         WERKS TYPE VBAP-WERKS,           "PLANT

         LGORT TYPE VBAP-LGORT,           "STOARGE LOC

         NETPR TYPE VBAP-NETPR,           "NETPRICE

END OF TY_VBAP.

 

DATA: LT_VBAP   TYPE TABLE OF TY_VBAP,

       LS_VBAP   TYPE TY_VBAP,

 

       LT_FCAT   TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

*      LS_FCAT TYPE SLIS_FIELDCAT_ALV,

       S_KEYINFO TYPE SLIS_KEYINFO_ALV,

 

       S_LAYOUT  TYPE SLIS_LAYOUT_ALV.

 

SELECTION-SCREEN : BEGIN OF BLOCK B WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS   : P_VBELN FOR VBAK-VBELN.

SELECTION-SCREEN : END OF BLOCK B.

 

START-OF-SELECTION.

 

   PERFORM READ.

   PERFORM FCAT.

   PERFORM KEYINFO.

   PERFORM DISPLAY.

   PERFORM LAYOUT.

 

*&---------------------------------------------------------------------*

*&      Form  READ

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM READ .

   SELECT VBELN

              ERDAT

              ERNAM

              AUDAT

              AUART

              VKORG

              VTWEG

              SPART

              VKGRP

       FROM VBAK INTO TABLE LT_VBAK

       WHERE VBELN IN P_VBELN.

 

   IF LT_VBAK[] IS NOT INITIAL.

 

     SELECT  VBELN

             POSNR

             MATNR

             MATKL

             WERKS

             LGORT

             NETPR

       FROM VBAP INTO TABLE LT_VBAP

       FOR ALL ENTRIES IN LT_VBAK

       WHERE VBELN = LT_VBAK-VBELN.

   ENDIF.

ENDFORM.

*&---------------------------------------------------------------------*

*&      Form  FCAT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM FCAT.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

  EXPORTING

    I_PROGRAM_NAME                = SY-REPID

    I_INTERNAL_TABNAME            = 'LT_VBAK'

*   I_STRUCTURE_NAME             =

*   I_CLIENT_NEVER_DISPLAY       = 'X'

    I_INCLNAME                    = SY-REPID

*   I_BYPASSING_BUFFER           =

*   I_BUFFER_ACTIVE              =

   CHANGING

     CT_FIELDCAT                  = LT_FCAT[]

* EXCEPTIONS

*   INCONSISTENT_INTERFACE       = 1

*   PROGRAM_ERROR                = 2

*   OTHERS                       = 3

           .

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

 

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

      I_PROGRAM_NAME                = SY-REPID

      I_INTERNAL_TABNAME            = 'LT_VBAP'

*     I_STRUCTURE_NAME             =

*     I_CLIENT_NEVER_DISPLAY       = 'X'

      I_INCLNAME                    = SY-REPID

*     I_BYPASSING_BUFFER           =

*     I_BUFFER_ACTIVE              =

     CHANGING

       CT_FIELDCAT                  = LT_FCAT[]

*   EXCEPTIONS

*     INCONSISTENT_INTERFACE       = 1

*     PROGRAM_ERROR                = 2

*     OTHERS                       = 3

             .

   IF SY-SUBRC <> 0.

* Implement suitable error handling here

   ENDIF.

ENDFORM.

*&---------------------------------------------------------------------*

*&      Form  KEYINFO

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM KEYINFO .

S_KEYINFO-HEADER01 = 'VBELN'.

S_KEYINFO-ITEM01   = 'VBELN'.

ENDFORM.

*&---------------------------------------------------------------------*

*&      Form  DISPLAY

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM DISPLAY .

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

   EXPORTING

*   I_INTERFACE_CHECK              = ' '

     I_CALLBACK_PROGRAM             = SY-REPID

*   I_CALLBACK_PF_STATUS_SET       = ' '

*   I_CALLBACK_USER_COMMAND        = ' '

     IS_LAYOUT                      = S_LAYOUT

     IT_FIELDCAT                    = LT_FCAT[]

*   IT_EXCLUDING                   =

*   IT_SPECIAL_GROUPS              =

*   IT_SORT                        =

*   IT_FILTER                      =

*   IS_SEL_HIDE                    =

*   I_SCREEN_START_COLUMN          = 0

*   I_SCREEN_START_LINE            = 0

*   I_SCREEN_END_COLUMN            = 0

*   I_SCREEN_END_LINE              = 0

*   I_DEFAULT                      = 'X'

*   I_SAVE                         = ' '

*   IS_VARIANT                     =

*   IT_EVENTS                      =

*   IT_EVENT_EXIT                  =

     I_TABNAME_HEADER               = 'LT_VBAK'

     I_TABNAME_ITEM                 = 'LT_VBAP'

*   I_STRUCTURE_NAME_HEADER        =

*   I_STRUCTURE_NAME_ITEM          =

     IS_KEYINFO                     = S_KEYINFO

*   IS_PRINT                       =

*   IS_REPREP_ID                   =

*   I_BYPASSING_BUFFER             =

*   I_BUFFER_ACTIVE                =

*   IR_SALV_HIERSEQ_ADAPTER        =

*   IT_EXCEPT_QINFO                =

*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER        =

*   ES_EXIT_CAUSED_BY_USER         =

   TABLES

     T_OUTTAB_HEADER                = LT_VBAK

     T_OUTTAB_ITEM                  = LT_VBAP

* EXCEPTIONS

*   PROGRAM_ERROR                  = 1

*   OTHERS                         = 2

           .

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

 

ENDFORM.

*&---------------------------------------------------------------------*

*&      Form  LAYOUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM LAYOUT .

   S_LAYOUT-EXPAND_FIELDNAME  = 'EXPAND'.

   S_LAYOUT-WINDOW_TITLEBAR   = 'HIERARCHICAL ALV LIST DISPLAY'.

   S_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

ENDFORM.

HOW TO USE SELECT-OPTION IN AMDP

$
0
0

HI,

 

Could any one please let me know how to use select-option in AMDP .I have seen the post on scn and tried to apply but it gives me syntax error.same code in abap is not giving syntax error.

 

  SELECT MATNR, SPMON, SUM( MZUBB) AS MZUBB,  SUM( WZUBB ) AS WZUBB,

                       SUM( MGVBR) AS MGVBR, SUM( WGVBR) AS WGVBR,

                       SUM( MAGBB) AS  MAGBB, SUM( WAGBB ) AS WAGBB,WERKS

                       FROM S031

                       WHERE (IV_WHERE_CLAUSE)

                       GROUP BY MATNR,SPMON,WERKS;

 

here where clause is dynamic generated by class and method.

it says incorrect syntax near group by.i am writing this code inside AMDP implementation.

 

or else can anyone give step by step process to handle select option in amdp and consume it in our existing abap report.

 

also in my system i am not able to find cl_shdb_seltab? is there any alternative to this? please give full steps to acheive this..


CDS view currency conversion performance

$
0
0

Hi All,

Currency_conversion function in CDS view  terribly decrease performance of the cds  view,  view running in few seconds run for minutes after adding currency_conversion function. I am working on 7.40 SP10 system.

- I could not find any note for the issue for my system's support pack level ( I will open one )

- I tried to select  conversion ratio from tcurr table but it is necessary to subtract gdatu date from 9999999 to get actual date and could not cast gdatu to numeric field to  be able to perform necessary arithmetic operation in cds view. 

- Last solution I have in mind but  trying to avoid  is creating ZCURR table with proper date field instead of gdatu and filling it for the past and recent currency values using a simple program and daily job.


Do you have any other solution for above problem ? I searched the forum but find only one post for the issue which does not suggest any solution 

Issue with Association in CDS view

$
0
0

Hi Friends,

 

Need some help with association in CDS view.

 

I am trying to convert the below join ddl using association. But getting error "Table b unknown or shadowed by an alias" at line number 47. Please help, what mistake I am making here.

 

@AbapCatalog.sqlViewName: 'ZTRM_BOOK'
@AbapCatalog.compiler.CompareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Flight Booking Data'
define view Ztrm_Book_DDL as select from sbook as a
join spfli as b on
a.carrid = b.carrid and                   a.connid = b.connid
join scarr as c on a.carrid = c.carrid
join sairport as d on b.airpfrom = d.id
join sairport as e on b.airpto = e.id
{    a.carrid as carrid,    a.connid as connid,    fldate,    bookid,    passname,    forcuram,    b.airpfrom,    d.name as airportfrom,    cityfrom,    countryfr,    airpto,    e.name as airportto,    countryto,    cityto,    carrname,    url,    class,    loccuram,    loccurkey,    order_date,    agencynum    
}
---------------------------------------------------------------------------------------------------------------------------------------------------------
@AbapCatalog.sqlViewName: 'ZTRM_BOOK'
@AbapCatalog.compiler.CompareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Flight Booking Data'
define view Ztrm_Book_DDL as select from sbook as a
association [1] to spfli as b    on a.carrid = b.carrid and       a.connid = b.connid
association [1] to scarr as c
on a.carrid = c.carrid      
association [1] to SAIRPORT as d
on b.airpfrom = d.id //Table b unknown or shadowed by an alias
association [1] to sairport as e
on b.airpto = e.id     
{    a.carrid as carrid,    a.connid as connid,    fldate,    bookid,    passname,    forcuram,    b.airpfrom,    d.name as airportfrom,    cityfrom,    countryfr,    airpto,    e.name as airportto,    countryto,    cityto,    carrname,    url,    class,    loccuram,    loccurkey,    order_date,    agencynum  //  _association_name // Make association public  
}

Variable in SQL ABAP Managed Database Procedure

$
0
0

Dear all

 

I have a question regarding the use of a variable in an ABAP Managed Database Procedure.

 

The following method I implemented into a class:

 

Capture.PNG

 

How can I now insert a variable for the string 'YES' ?

 

I tried declaring a constant:

 

Capture.PNG

 

But I cannot use

 

... WHERE a.giftsyesorno = lc_yes;

 

Is there a solution for this problem? I would really like to use variables in the SQL syntax in the method.

 

 

Best regards

 

Thomas Bretonnet

how to use views of hana trial account in ABAP system

$
0
0

Der All,

 

is that possible to use views(attribute,analytic and calculation views) of HANA trial account in sap ABAP system.

 

if 'YES' please provide me the proper documentation.

 

 

Thanks and Regards

 

Ashwin M V

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.

Viewing all 1246 articles
Browse latest View live