Skip to Content

CDS Metadata Tables

Hi experts,

I need to figure out where to find metadata about CDS views (DDL) and their corresponding ABAP objects. I thought that the generated ABAP view would contain the same parameters as the CDS view that they are generated from but that is not the case. I have an example (C_PurRequisitionNoTouch from an S4/HANA IDES system) where the CDS defines three parameters but the generated ABAP view (CMMPRNOTOUCH) only lists two ‘Selection Condition’ in the definition in SE11. But when querying the ABAP view all three parameters must be set otherwise there will be a Syntax Error. So somehow I need to find the metadata for the CDS DDL in order to be able to query the ABAP View. The ABAP view metadata I have in ex table DD02V (field’WITH PARAMETERS’) and the Select Conditions are in table DD28S. There is the table RSODPABAPCDSVIEW that links the CDS with the ABAP view and the full CDS DDL can be found in DDDDLSRC. I can of course parse the CDS DDL but I am uncertain how that would work with extended CDS views if those contain multiple ‘layers’ of parameters. Any ideas?

Here is a small program illustrating the issue:

  l_date_function(32) TYPE c,
  l_start_date TYPE date,
  l_end_date TYPE date.

  l_date_function = ''.
  l_start_date = '20160101'.
  l_end_date = '20180101'.

*SELECT * FROM C_PurRequisitionNoTouch( P_DateFunction = @l_date_function , P_StartDate = @l_start_date , P_EndDate = @l_end_date )  
*This works

SELECT * FROM CMMPRNOTOUCH( P_DateFunction = @l_date_function, P_StartDate = @l_start_date , P_EndDate = @l_end_date ) 
*This works

*SELECT * FROM CMMPRNOTOUCH( P_StartDate = @l_start_date , P_EndDate = @l_end_date ) 
*This will not work

IF sy-subrc = 0.
  LOOP AT t_view.
cds-abap.png (48.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    May 29, 2018 at 05:53 AM

    This is exactly one of the reasons, why you should not access ABAP managed database objects outside from ABAP.

    The representation of a CDS (parameter) view on the DB is an internal affair of the ABAP runtime environment, it is database dependent and it might change from release to release.

    See and .

    Add comment
    10|10000 characters needed characters exceeded

  • May 29, 2018 at 11:46 AM

    Hi Horst, thank you for your answer. Unfortunately I’m still not sure that I understand even after reading the blog and the note. I want to extract CDS view data by calling it from an ABAP program. The limitation of using Open SQL is not a problem. Should I select data from the CDS view or the ABAP view (which one of them is stable over time/releases)? Or none of them? From my example:

    1. The CDS view: SELECT * FROM C_PurRequisitionNoTouch… Is there some other source of metadata other than the definition itself (an ABAP Class or a table(s))?
    2. The ABAP view: SELECT * FROM CMMPRNOTOUCH… Where do I find the metadata for he view so that I can figure out how to query it?
    3. Or, am I totally wrong in my design?

    / Mats

    Add comment
    10|10000 characters needed characters exceeded

  • May 31, 2018 at 09:10 AM

    After looking into it some more I believe that it is the generated ABAP view (in my example CMMPRNOTOUCH) I should call from the ABAP program. I also found a table with the parameters (all three) so that issue is solved as well. However, it would be great if you could confirm that this is the right approach you are describing in your blog Horst Keller .

    / Mats

    Add comment
    10|10000 characters needed characters exceeded