Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to select an CDS View from AMDP

Former Member

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";"

1 ACCEPTED SOLUTION

Former Member

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

6 REPLIES 6

Former Member

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

0 Kudos

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 Kudos

Hi Marco,

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

0 Kudos

Thanks Michael,

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

0 Kudos

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

0 Kudos

Thank you Michael