Skip to Content
0

How to select an CDS View from AMDP

Oct 06, 2017 at 04:56 AM

194

avatar image

Hi,

i have written many ABAP CDS Views. They work great.

Now i reached the point where i have to use AMDPs.

My problem: i can't select from the CDS views i created.

CLASS /vwk/cl_esp_cats_amdp DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .


  PUBLIC SECTION.
  INTERFACES if_amdp_marker_hdb.
  class-METHODS get_hierarchy_configurations for table function /vwk/ESPCO_6007HIERARCHY.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.






CLASS /vwk/cl_esp_cats_amdp IMPLEMENTATION.
  METHOD get_hierarchy_configurations BY DATABASE FUNCTION FOR HDB LANGUAGE SQLSCRIPT options read-only using /VWK/espco600706 
  .
lt_aha = select * from /VWK/ESPCO600706;
  ENDMETHOD.


ENDCLASS.


i' ll get the message "SQLSCRIPT: sql syntax error: incorrect syntax near "/""

and when i do it like this:

lt_aha = select * from "/VWK/ESPCO600706";

it says "lt_aha = select * from "/VWK/ESPCO600706";"

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Michael Roger Oct 06, 2017 at 05:37 AM
0

I see... because of the parameters of the view, there is a wrong message. after adding the parameters to the select, it works.

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Hi Michael,

Just to be clear, inside your AMDP method you are selecting against the abapcatalog.sqlViewName generated by the CDS? Or you select directly agains the CDS name?

0

Hi Marco,

i used the sqlViewName.... as mentioned, it works now.

0

Thanks Michael,

And how do you specify the CDS views parameters from within the AMDP?

0

lt_aha = select * from "/VWK/ESPCO600706"( par_one => :local_var_one , par_two => :local_var_two );
i think this should answer your question...
0

Thank you Michael

0