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

Rewriting Native SQL to Open SQL in HANA DB Migration

$
0
0

1. Native SQL is connecting to other DB Servers(MDM/BW….) and fetching data from tables not in R/3. How to handle in HANA.


 


2.Views/table which are not present in R/3 but available in oracle DB. Would these be created automatically after migration or CDS views should be      created  manually ? To handle this, do we need to create local/dictionary structures/tables manually ?

 

3. Please explain the below native SQL code as SUM-ROOT in where is not populated anywhere in the code.Also how to rewrite for HANA DB.

Capture.JPG


Own development on HANA

$
0
0

Our client has working system SAP ERP on SQL Server and want to move to SAP ERP HANA. There are own developments.

 

What problems can appear?

Heard that structure of the tables changed in SAP HANA and reports it is necessary to develop anew.

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

How to improve this CDS view performance

$
0
0

Hi Experts,

 

I am using a CDS view with following join conditions.

cds.png

And the where condition is " where  a.kdauf = :p_vbeln  or ( b.kdauf = :p_vbeln and b.werks = :p_werks ) or c.vbeln = :p_vbeln ".

 

Its taking at around 30 secs to execute. Is there any other way to make the cds view to work fast without hampering the functional requirement.

 

Thanks and regards

- Sabarna.

I am unable to debug HANA SQL script on AMDP

$
0
0

I have done the following by looking at various blogs and video's but I am still unable to debug the AMDP as it does not stop on the SAP procedure created for AMDP.

 

1) I have authorization for debug and execute on SAP<SYSID> schema

2) Authorization to attach the debugger to a SAP<SYSID> user session

3) I have set up a break point on the procedure which is created in SAP<SYSID> for the AMDP I created.

4) In debug perspective I have created a configuration for my SAP and HANA user for the HANA DB we are using and the debug thread is running for my procedure

6) When I call the program from ABAP perspective. I am able to debug on ABAP code which calls the AMDP but when executed the code never stops in the SQL Script.


my HANA version in SPS 7.


Can someone explain me if I am missing any step here.


Thanks

Nafran

Using BOPF Action in CDS View

$
0
0

Dear experts,

 

I have a question about using the BOPF Action in CDS view.

I wrote the following code:

 

 

@UI.lineItem:[{

position:50,

label:'Confrm',

type:#AS_DATAPOINT,


dataAction:'Z_PSO_BOPF_999:ACTION'

 

}]


key dpr.time_unit as time_unit, 

 

but it seems it does not work. Can somebody give me a hint how to make it work. Thank you.

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...

Abap Query Call function

$
0
0

Hi Experts,

 

I want to ask how to link Sales text of material master in ABAP Query, I already have "Read_Text" call function for script.

Please guide me from where i have to pick ABAP code of call function and how to update it in info set of query.

 

 

Given is my whole call function abap code. kindly teach me step by step process update call function.

 

 

************************************************

 

FUNCTION READ_TEXT.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(CLIENT) LIKE  SY-MANDT DEFAULT SY-MANDT
*"     VALUE(ID) LIKE  THEAD-TDID
*"     VALUE(LANGUAGE) LIKE  THEAD-TDSPRAS
*"     VALUE(NAME) LIKE  THEAD-TDNAME
*"     VALUE(OBJECT) LIKE  THEAD-TDOBJECT
*"     VALUE(ARCHIVE_HANDLE) LIKE  SY-TABIX DEFAULT 0
*"     VALUE(LOCAL_CAT) DEFAULT SPACE
*"  EXPORTING
*"     VALUE(HEADER) LIKE  THEAD STRUCTURE  THEAD
*"     VALUE(OLD_LINE_COUNTER) TYPE  THEAD-TDTXTLINES
*"  TABLES
*"      LINES STRUCTURE  TLINE
*"  EXCEPTIONS
*"      ID
*"      LANGUAGE
*"      NAME
*"      NOT_FOUND
*"      OBJECT
*"      REFERENCE_CHECK
*"      WRONG_ACCESS_TO_ARCHIVE
*"----------------------------------------------------------------------
" B20K074874 ... READ_TEXT resolves references in CATALOG
"                with READ_REFERENCE_LINES
"                resolve references for texts created with COPY_TEXTS
" B20K024363 ... Replace SY-TFILL with DESCRIBE
" B20K023213 ... Optimizing Performance with referenced texts
" B20K019187 ... New module COPY_TEXTS
" B20K019113 ... Process non-SAPscript texts
*-----------------------------------------------------------------------
DATA THEADER LIKE THEAD.
DATA STXH_WA LIKE STXH.
DATA NEWTEXT LIKE BOOLEAN.
DATA L_LANGUAGE(2).                         " for two char language code


*...Prüfen ob vom Archiv gelesen werden soll............................
IF ARCHIVE_HANDLE > 0.
   CALL FUNCTION   'TEXT_READ_ARCHIVE_OBJECT'
          EXPORTING  ARCHIVE_HANDLE          = ARCHIVE_HANDLE
                     ID                      = ID
                     LANGUAGE                = LANGUAGE
                     NAME                    = NAME
                     OBJECT                  = OBJECT
                     CLIENT                  = CLIENT
          IMPORTING  HEADER                  = HEADER
          TABLES     LINES                   = LINES
          EXCEPTIONS NOT_FOUND               = 1
                     WRONG_ACCESS_TO_ARCHIVE = 2.
   CASE SY-SUBRC.
   WHEN 1. MESSAGE E600 WITH NAME ID LANGUAGE RAISING NOT_FOUND.
   WHEN 2. MESSAGE A020 RAISING WRONG_ACCESS_TO_ARCHIVE.
   ENDCASE.
   EXIT.
ENDIF.

*...Initialisierung.....................................................
NEWTEXT   = FALSE.
REFERENCE = FALSE.

*...Pruefen Aufrufparameter.............................................
PERFORM CHECK_KEY USING OBJECT NAME ID LANGUAGE.
perform check_catalog_local using local_cat.
*...Text aus Textmemory lesen...........................................
IF TTXOB-TDSAVEMODE = SAVEMODE_POSTING.
   PERFORM IMPORT_CATALOG.
   if client = sy-mandt.
   PERFORM READ_CATALOG USING OBJECT NAME ID LANGUAGE.
   IF SY-SUBRC = 0.
     CASE CATALOG-FUNCTION.
*     text will be deleted
       WHEN FUNCTION_DELETE.
         REFRESH LINES. CLEAR LINES.
         CALL FUNCTION  'SAPSCRIPT_MESSAGE_DEF'
                  EXPORTING NO = 600
                            V1 = NAME
                            V2 = ID
                            V3 = LANGUAGE.
         MESSAGE E600 WITH NAME ID LANGUAGE RAISING NOT_FOUND.
*     text will be created new
       WHEN FUNCTION_INSERT.
         CLEAR THEADER. REFRESH LINES.                        "B20K074874
         IMPORT THEAD TO THEADER                              "
                TLINE TO LINES                                "
           FROM MEMORY ID MEMORY_ID.                          "
         HEADER        = THEADER.                             "
         HEADER-TDNAME = CATALOG-TDNAME.                      "
         PERFORM READ_REFERENCE_LINES TABLES LINES            "
                                      USING CLIENT            "
                                            HEADER.           "
         DESCRIBE TABLE LINES LINES HEADER-TDTXTLINES.        "
*     text will be updated
       WHEN FUNCTION_UPDATE.
         CLEAR THEADER. REFRESH LINES.                        "B20K074874
         IMPORT THEAD TO THEADER                              "
                TLINE TO LINES                                "
           FROM MEMORY ID MEMORY_ID.                          "
         HEADER = THEADER.                                    "
         PERFORM READ_REFERENCE_LINES TABLES LINES            "
                                      USING CLIENT            "
                                            HEADER.           "
         DESCRIBE TABLE LINES LINES HEADER-TDTXTLINES.        "
*     text will be copied from other DB text at COMMIT_TEXT
       WHEN FUNCTION_COPY.
         PERFORM IMPORT_COPY_CATALOG.
         READ TABLE COPY_CATALOG INDEX CATALOG-COPYINDEX.
         IF SY-SUBRC = 0.
           HEADER-TDOBJECT  = CATALOG-TDOBJECT.
           HEADER-TDNAME    = CATALOG-TDNAME.
           HEADER-TDID      = CATALOG-TDID.
           HEADER-TDSPRAS   = CATALOG-TDSPRAS.
           THEADER-TDOBJECT = COPY_CATALOG-TDOBJECT.
           THEADER-TDNAME   = COPY_CATALOG-TDNAME.
           THEADER-TDID     = COPY_CATALOG-TDID.
           THEADER-TDSPRAS  = COPY_CATALOG-TDSPRAS.
           PERFORM BUILD_COPY_HEADER USING HEADER
                                           THEADER
                                           FUNCTION_COPY.
           IF THEADER-TDREFOBJ = SPACE AND                    "B20K074874
              THEADER-TDREFID  = SPACE AND                    "
              THEADER-TDREFNAME = SPACE.                      "
             PERFORM READ_TEXTLINES TABLES LINES              "
                                    USING  THEADER            "
                                           SY-MANDT.          "
           ELSE.                                              "
             PERFORM READ_REFTEXT_LINES TABLES LINES          "
                                        USING  THEADER        "
                                               SY-MANDT.      "
           ENDIF.
           header-tdtxtlines = theader-tdtxtlines.
         ENDIF.
*     text will be updated from other DB text at COMMIT_TEXT
       WHEN FUNCTION_COPYUPDATE.
         PERFORM IMPORT_COPY_CATALOG.
         READ TABLE COPY_CATALOG INDEX CATALOG-COPYINDEX.
         IF SY-SUBRC = 0.
           SELECT SINGLE * FROM STXH INTO STXH_WA
             WHERE TDOBJECT = CATALOG-TDOBJECT
               AND TDNAME   = CATALOG-TDNAME
               AND TDID     = CATALOG-TDID
               AND TDSPRAS  = CATALOG-TDSPRAS.
           CHECK SY-SUBRC = 0.
           MOVE-CORRESPONDING STXH_WA TO HEADER.
           THEADER-TDOBJECT = COPY_CATALOG-TDOBJECT.
           THEADER-TDNAME   = COPY_CATALOG-TDNAME.
           THEADER-TDID     = COPY_CATALOG-TDID.
           THEADER-TDSPRAS  = COPY_CATALOG-TDSPRAS.
           PERFORM BUILD_COPY_HEADER USING HEADER
                                           THEADER
                                           FUNCTION_COPYUPDATE.
           IF THEADER-TDREFOBJ = SPACE AND                    "B20K074874
              THEADER-TDREFID  = SPACE AND                    "
              THEADER-TDREFNAME = SPACE.                      "
             PERFORM READ_TEXTLINES TABLES LINES              "
                                    USING  THEADER            "
                                           SY-MANDT.          "
           ELSE.                                              "
             PERFORM READ_REFTEXT_LINES TABLES LINES          "
                                        USING  THEADER        "
                                               SY-MANDT.      "
           ENDIF.
           header-tdtxtlines = theader-tdtxtlines.
         ENDIF.
*     no action is performed since text was created and deleted
       WHEN FUNCTION_NONE.
         REFRESH LINES. CLEAR LINES.
         CALL FUNCTION  'SAPSCRIPT_MESSAGE_DEF'
                  EXPORTING NO = 600
                            V1 = NAME
                            V2 = ID
                            V3 = LANGUAGE.
         MESSAGE E600 WITH NAME ID LANGUAGE RAISING NOT_FOUND.
     ENDCASE.
   ELSE.
     NEWTEXT = TRUE.
   ENDIF.
   else.
      newtext = true.
   endif.
ENDIF.

*...Text aus Textdatei lesen............................................
IF TTXOB-TDSAVEMODE = SAVEMODE_DIALOG OR NEWTEXT = TRUE.
   SELECT SINGLE * FROM STXH CLIENT SPECIFIED
      WHERE MANDT    = CLIENT
        AND TDOBJECT = OBJECT
        AND TDNAME   = NAME
        AND TDID     = ID
        AND TDSPRAS  = LANGUAGE.
   IF SY-SUBRC > 0.
     WRITE LANGUAGE TO L_LANGUAGE(2).
     CALL FUNCTION  'SAPSCRIPT_MESSAGE_DEF'
             EXPORTING NO = 600
                       V1 = NAME
                       V2 = ID
                       V3 = L_LANGUAGE.
     MESSAGE E600 WITH NAME ID LANGUAGE RAISING NOT_FOUND.
   ELSE.
     MOVE-CORRESPONDING STXH TO HEADER.
     OLD_LINE_COUNTER = HEADER-TDTXTLINES.
     IF STXH-TDREF = TRUE.
       PERFORM READ_REFTEXT_LINES TABLES LINES
                                   USING  HEADER
                                          CLIENT.
     ELSE.
       PERFORM READ_TEXTLINES TABLES LINES
                               USING  HEADER
                                      CLIENT.
       IF SY-SUBRC > 0.
         REFRESH LINES. CLEAR LINES.
       ENDIF.
     ENDIF.
   ENDIF.
ENDIF.

*...Ausgabeparameter setzen.............................................
if header-tdtexttype is initial.   " just for ITF
   HEADER-TDLINESIZE = TTXOB-TDLINESIZE.
endif.

ENDFUNCTION.

* read LINES of a reference text found in CATALOG            "B20K074874
* returns SY-SUBRC = 0 if found
FORM READ_REFERENCE_LINES TABLES LINES STRUCTURE TLINE
                           USING CLIENT
                                 VALUE(HEADER) LIKE THEAD.
STATICS: TEXT_IN_CATALOG LIKE BOOLEAN.

TEXT_IN_CATALOG = TRUE.
PERFORM CHECK_REFERENCE USING HEADER-TDREFOBJ            "sets REFERENCE
                               HEADER-TDREFNAME
                               HEADER-TDREFID.
IF REFERENCE = FALSE.
   EXIT.
ENDIF.
* resolve reference chain in CATALOG
WHILE REFERENCE = TRUE AND TEXT_IN_CATALOG = TRUE.
   PERFORM READ_CATALOG USING HEADER-TDREFOBJ
                              HEADER-TDREFNAME
                              HEADER-TDREFID
                              HEADER-TDSPRAS.
   IF SY-SUBRC = 0.
*   read header from MEMORY
     CASE CATALOG-FUNCTION.
*     text will be deleted
       WHEN FUNCTION_DELETE.
         MESSAGE E610 WITH CATALOG-TDOBJECT
                           CATALOG-TDID
                           CATALOG-TDNAME
                           CATALOG-TDSPRAS
           RAISING REFERENCE_CHECK.
*     text will be created new
       WHEN FUNCTION_INSERT.
         IMPORT THEAD TO HEADER
                TLINE TO LINES
           FROM MEMORY ID MEMORY_ID.
         PERFORM CHECK_REFERENCE USING HEADER-TDREFOBJ   "sets REFERENCE
                                       HEADER-TDREFNAME
                                       HEADER-TDREFID.
*     text will be updated
       WHEN FUNCTION_UPDATE.
         IMPORT THEAD TO HEADER
                TLINE TO LINES
           FROM MEMORY ID MEMORY_ID.
         PERFORM CHECK_REFERENCE USING HEADER-TDREFOBJ   "sets REFERENCE
                                       HEADER-TDREFNAME
                                       HEADER-TDREFID.
*     text will be copied from DB text at COMMIT_TEXT
       WHEN FUNCTION_COPY.          "COPY_TEXTS copies from DB
         TEXT_IN_CATALOG = FALSE.
       WHEN FUNCTION_COPYUPDATE.    "COPY_TEXTS copies from DB
         TEXT_IN_CATALOG = FALSE.
       WHEN FUNCTION_NONE.          "read from DB
         TEXT_IN_CATALOG = FALSE.
     ENDCASE.
   ELSE.
     TEXT_IN_CATALOG = FALSE.
   ENDIF.
ENDWHILE.
IF REFERENCE = TRUE.
   REFRESH LINES.
* read text from DB?
   IF TEXT_IN_CATALOG = FALSE.
     PERFORM READ_REFTEXT_LINES TABLES LINES
                                USING  HEADER
                                       CLIENT.
*
   ENDIF.
ELSE.
* LINES have been filled by IMPORT ....
ENDIF.
ENDFORM.

***************************************************************************************************************

 

Regards,

Qamber Abbas


Try to remove append structure but blocked by CDS view dictornary objects

$
0
0

Hi Experts,

 

I’m currently busy with a new project where we moved our existing ECC (SAP Retail) system from a Oracle database to a SAP HANA Primary database. Nobody on our team are very familiar with the SAP HANA database or the new functionality. We are all learning as we go.

 

One of our requirements are to rip out some of our custom code. While doing that I came across a problem that I don’t know how to solve and I was wondering if there are someone out there that might have a solution.

 

We are currently on ECC 6, Release 7.4 Service Pack 12

 

One of the objects I had to remove was an append structure to table RSEG.  The append structure consisted of only one zz field.

 

I did a where use on the append structure. It was not used.

I did a where use on the actual field within the append structure.  It was still not used.

 

I deleted the append structure in SE11.  It did not complain about being used anywhere.  It then tried to adjust the database table RSEG, but could not activate the changes because it encountered some errors.  It said it was used in 2 SAP standard CDS Views.

 

The exact message was: ‘Field RSEG-ZZSIN is still being used as a view field in view CDS_IV_ITEMS’

 

The 2 SAP Standard CDS views (DDL Source) are:

• CDS_IV_ITEMS

• CDS_IV_ITEMS_P

 

Both CDS views (DDL source) are using the RSEG table as the main table and have multiple associations(joins) to other tables, but the field is not specified, in other words it is a Select *.

 

I believe this is a chicken and egg situation.  DDL source is activated and it then generates a Dictionary object in SE11 using table RSEG as base.  Database table RSEG cannot fix the database because it sees 2 dictionary objects that are using the field.

 

So my question is, how to I fix it?

How do I get RSEG table sorted out and then re-generates the DDL source / CDS View Dictionary object?

 

Are there a new Transaction code that I should use?

Are you aware of any OSS notes that will fix this?.

 

Any suggestions will be most welcome.

 

Kind Regards,

Sanet Pienaar

AMDP: SQLSCRIPT message: return type mismatch error

$
0
0

Dear Colleagues,

 

I am getting the mismatch error for the AMDP that I am trying to write.

Can you help me here?

 

Error Message:

SQLSCRIPT message: return type mismatch: GT_DTAB2[ PLTYP:NVARCHAR(2) VBELN:NVARCHAR(10) FKDAT:NVARCHAR(8) KNUMV:NVARCHAR(10) FKART:NVARCHAR(4) KDGRP:NVARCHAR(2) MVGR3:NVARCHAR(3) POSNR:NVARCHAR(6) AUBEL:NVARCHAR(10) FKIMG:DECIMAL(13,3) ZZAM

 

 

AMDP Code stack

 

CLASS zcl_get_itab_value DEFINITION  PUBLIC  FINAL  CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
TYPES: BEGIN OF ty_dtab1,        pltyp    TYPE vbrk-pltyp,        kunnr    TYPE vbpa-kunnr,        mvgr3    TYPE vbrp-mvgr3,        zzamatkl TYPE vbrp-zzamatkl,        matnr    TYPE vbrp-matnr,        arktx    TYPE vbrp-arktx,        kondm    TYPE vbrp-kondm,        auart    TYPE vbak-auart,        vbeln    TYPE vbrk-vbeln,        posnr    TYPE vbrp-posnr,        aubel    TYPE vbrp-aubel,        fkdat    TYPE vbrk-fkdat,        fkart    TYPE vbrk-fkart,        fkimg    TYPE vbrp-fkimg,        knumv    TYPE vbak-knumv,        werks    TYPE vbrp-werks,       END OF ty_dtab1.
TYPES gt_dtab1 TYPE STANDARD TABLE OF ty_dtab1.
CLASS-METHODS GET_DTAB_DATA_SAMPLE      IMPORTING          VALUE(gv_value) TYPE mandt      EXPORTING          VALUE(gt_dtab2) TYPE gt_dtab1.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_get_itab_value IMPLEMENTATION.  METHOD get_dtab_data_sample  by database procedure for hdb language  SQLSCRIPT OPTIONS READ-ONLY USING VBRP VBRK VBAK VBPA.    gt_dtab2 = SELECT T1."PLTYP", T1."VBELN", T1."FKDAT",    T1."KNUMV",                      T1."FKART", T1."KDGRP", T2."MVGR3",    T2."POSNR",                      T2."AUBEL", T2."FKIMG", T2."ZZAMATKL", T2."MATNR",                      T2."ARKTX", T2."WERKS", T2."KONDM",    T3."AUART",                      T2."VKBUR", T4."KUNNR"                 FROM "VBRP" AS T2                INNER JOIN "VBRK" AS T1                   ON T1."VBELN" = T2."VBELN"                INNER JOIN "VBAK" AS T3                   ON T2."AUBEL" = T3."VBELN"                INNER JOIN "VBPA" AS T4                   ON T4."VBELN" = T2."VBELN"                WHERE T1."FKART" IN ('F2','RE','S1','S2','ZS','ZVAT','RVAT','ZIFR')                  AND T1."VKORG" = 'IN01';  ENDMETHOD.
ENDCLASS.

Appreciate your time and inputs.

Thank you.

 

Warm Regards,

Harshad Mishrikotkar.

Sorting Order in SQL Queries

$
0
0

Hi Colleagues,

 

We notice difference in the output when executing the SELECT queries on traditional DB and HANA. We are using side car approach so we have both the databases.

 

    SELECT Query 1 without HANA

 

     SELECT * FROM

                     EKPO

          INTO   TABLE LT_EKPO

             FOR ALL ENTRIES IN LT_EKKO

    WHERE    ebeln = lt_ekko-ebeln

          AND   werks IN s_werks.

 

    SELECT Query 2 with HANA

 

     SELECT * FROM

                     EKPO

          connection (gv_dbcon)

          INTO   TABLE LT_EKPO

             FOR ALL ENTRIES IN LT_EKKO

    WHERE    ebeln = lt_ekko-ebeln

          AND   werks IN s_werks.

 

 

Both the queries give me the same result set, but with different order.

What could be the reason? and how this should be avoided.

Thank you.

 

Regards,

Harshad Mishrikotkar.

ABAP CDS View: OData service CRUD enabled?

$
0
0

Hello All,

 

Is it possible to make an odata service generated by the abap cds view CRUD enabled?

So can I do an UPDATE, DELETE, CREATE on the odata service?

 

I am reading stuff about BOPF ? Is this the way to go forward?

 

Regards,

Bert

Generate DB Procedure Proxies

$
0
0

Hello colleagues,

 

is it possible to generate/create DB procedure proxies dynamically within ABAP?

So we know the DB procedure name and want to create a DB procedure proxy dynamically in ABAP.

 

Regards

André

CDS View vs Atribute view

$
0
0

Hello All,

 

I need to know is CDS view and Attribute view are co related and what is the difference between CDS view and Attribute view.

 

Please suggest.

 

LR Reddy.

HANA and not fully qualified SELECT SINGLE statements - an issue?

$
0
0

As part of an upgrade from Oracle to HANA (ECC), we have checked all (used) custom programs using the Code Inspector using check variant FUNCTIONAL_DB to find possible HANA issues. Now, during functional testing, one specific issue pops up related to a SELECT SINGLE statement with an incompletely specified key. (SELECT SINGLE * FROM KNVV INTO WA_KNVV WHERE KUNNR = I_KUNNR). According to the tester, the row that is selected now is different from the expected one.

 

I have used the Code Inspector to check for all SELECT SINGLE statements with incomplete specified key and found a lot of them. However, SAP did not add this check to the variant FUNCTIONAL_DB, so I'm wondering if there really is a problem here.

 

So my questions are:

  1. Do all tables still have a primary index? I have performed a database object check for KNVV via SE11 and this says there is still a consistent index KNVV~0 so I presume these indices still exist.
  2. In general, if I perform SELECT SINGLE without using fully qualified primary key, will HANA still use the primary index (if for example the first keys are specified and the last key field isn't)
  3. Are there situations where a SELECT SINGLE without fully qualified key on a HANA database can return a different row from the table than on an Oracle or other non-HANA database?

 

I fully understand that the best solution is analyzing and changing these SELECT SINGLE statements, but for the moment I want to know if there actually is a real problem. If this is the case, I am going to add the check on SELECT SINGLE to my next HANA upgrade projects.


how to call amdp in another amdp

$
0
0

Hi all,

 

i have attached the code sample,please tell me how to handle this in AMDP .

 

 

Basically i have two performs .in one perform we are fetching some data and based on that data again we fetch another data in another perform.how to handle this in AMDP.

 

ALSO  if i have two internal table in ABAP report and i need to loop one internal table and read second internal table based on some condition how to handle this in AMDP?

 

please tell me step by step or provide me screenshots,because i am not very much comfortable to use AMDP

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.

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 ?

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

CDS View vs Atribute view

$
0
0

Hello All,

 

I need to know is CDS view and Attribute view are co related and what is the difference between CDS view and Attribute view.

 

Please suggest.

 

LR Reddy.

Viewing all 1246 articles
Browse latest View live


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