cancel
Showing results for 
Search instead for 
Did you mean: 

AMDP Error while reading huge data

kngupta141
Participant
0 Kudos

Hi Everyone,

I am new to ABAP on HANA, I have written a small code in AMDP to read data from my CDS view which is a combination MARA, MARC and MARD tables. The final result of the table should contain 88226275 records(Based on MARD records), but When i execute the program in DEV by using AMDP some exception is happening. Where as when i execute the program with direct select i am seeing 88226275 in my internal table.

Can any one tell me how to get rid of the error.

Here is my code of calling program

START-OF-SELECTION.
  .
  DATA(lo_amdp) = NEW zgtest_amdp( ).


  TRY.
      lo_amdp->fetch_matnr_data( EXPORTING ev_client = sy-mandt IMPORTING et_material = DATA(lt_data) ).


    CATCH cx_amdp_error INTO DATA(lo_amdp_error).
  ENDTRY.
  IF lo_amdp_error IS BOUND.
    MESSAGE lo_amdp_error->get_longtext( ) TYPE 'I'.
  ENDIF.

* This select brings the data
select mandt,
       matnr,
       werks,
       lgort
       FROM mard
       INTO TABLE @lt_data.

My class code

CLASS zgtest_amdp DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .


  PUBLIC SECTION.
    INTERFACES: if_amdp_marker_hdb.


    TYPES: BEGIN OF ty_material,
             mandt TYPE mara-mandt,
             matnr TYPE mara-matnr,
             werks TYPE marc-werks,
             lgort TYPE mard-lgort,
           END OF ty_material,


           tt_material TYPE STANDARD TABLE OF ty_material WITH EMPTY KEY.


    METHODS: fetch_matnr_data IMPORTING VALUE(ev_client)   TYPE sy-mandt
                              EXPORTING VALUE(et_material) TYPE tt_material
                              RAISING   cx_amdp_error.


  PROTECTED SECTION.


  PRIVATE SECTION.


ENDCLASS.




CLASS zgtest_amdp IMPLEMENTATION.
  METHOD fetch_matnr_data
  BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY USING zmat_det_001.


    et_material =
    select
*    TOP 5000    " This line is written to make my AMDP work which is commented now
    *
     from zmat_det_001
     where mandt = ev_client
     order by mandt, matnr, werks, lgort;


  endmethod.
ENDCLASS.

Thanks and regards,

Gupta

pfefferf
Active Contributor

Maybe you can tell us what error you get?

matt
Active Contributor
0 Kudos

Just for info

    CATCH cx_amdp_error INTO DATA(lo_amdp_error).
  ENDTRY.
  IF lo_amdp_error IS BOUND.
    MESSAGE lo_amdp_error->get_longtext( ) TYPE 'I'.
  ENDIF.

is incorrect. You should use

    CATCH cx_amdp_error INTO DATA(lo_amdp_error).
      MESSAGE lo_amdp_error->get_longtext( ) TYPE 'I'.
  ENDTRY.
View Entire Topic
kngupta141
Participant
0 Kudos

Here is the error message

matt
Active Contributor
0 Kudos

Set a breakpoint and look at the value of lo_amdp_error. Check the attributes. previous might also give more indications for the error.