ABAP CDS on HANA-3

cds

Calling CDS view in program( SQL Query)

 

 

We have the CDS view CDS view with Parameter . Now let’s use this CDS view in the report/program select query.

2

Program Code:

1


To check if DB supports  VIEWS_WITH_PARAMETERS usually class CL_ABAP_DBFEATURES  is used but now we can directly use ##db_feature_mode[views_with_parameters] as a part of SQL query.


PARAMETERS: p_carr type sflight-carrid.

START-OF-SELECTION.
“if ( CL_ABAP_DBFEATURES=>use_features(
” requested_features = VALUE #( ( “CL_ABAP_DBFEATURES=>VIEWS_WITH_PARAMETERS ) ) ) = abap_true ).

select * FROM Zflight_Param_View( flight_code = @p_carr )
into TABLE @DATA(lt_flight) ##db_feature_mode[views_with_parameters].

cl_demo_output=>display_data(
EXPORTING
value = lt_flight
name = ‘Flight CDS View with Input Parameters’ ).
“endif.


Output.


3

4


 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s