Application Development and Automation 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: 

Default values for cds parameter

herzelhaimharel_gilor
Participant
0 Kudos
4,367

Hi all ,

just got an error while try to determine default value for cds parameter

i was try also , and it's not working

could someone let me know how to solve this ?

1 ACCEPTED SOLUTION

herzelhaimharel_gilor
Participant
0 Kudos
2,427

Hi Thorsten ,

i just followed https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abencds_f1_parameter_annotations.htm

looks like the error still persist

3 REPLIES 3

ThorstenHoefer
Active Contributor
0 Kudos
2,427

Hi,

you can determine the language with the session variable $session.system_language.
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/de-de/abencds_f1_session_variable.htm

The Default value for a parameter can be set with the consumption annotation

@Consumption.defaultValue

The report DEMO_CDS_SYSTEM_FIELDS is mentioned in the sap help:

https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abencds_f1_parameter_annotations.htm

Best Regards
Thorsten

herzelhaimharel_gilor
Participant
0 Kudos
2,428

Hi Thorsten ,

i just followed https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abencds_f1_parameter_annotations.htm

looks like the error still persist

2,427

This is the code from the demo CDS View demo_cds_system_fields.

Are you using version 7.5x?

@AbapCatalog.sqlViewName: 'DEMO_CDS_SYST'
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view demo_cds_system_fields
 with parameters
 @Environment.systemField : #CLIENT
 p_mandt : syst_mandt,
 @Environment.systemField : #SYSTEM_DATE
 p_datum : syst_datum,
 @Environment.systemField : #SYSTEM_TIME
 p_uzeit : syst_uzeit,
 p_langu : syst_langu @<Environment.systemField : #SYSTEM_LANGUAGE,
 p_uname : syst_uname @<Environment.systemField : #USER
 as select from
 demo_expressions
 {
 :p_mandt as client,
 :p_datum as datum,
 :p_uzeit as uzeit,
 :p_langu as langu,
 :p_uname as uname
 }
 where
 id = '1';     

ABAP Code

REPORT demo_cds_system_fields.
CLASS demo DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS main.
ENDCLASS.
CLASS demo IMPLEMENTATION.
  METHOD main.
    DELETE FROM demo_expressions.
    INSERT demo_expressions FROM @( VALUE #( id = '1' ) ).
    SELECT *
           FROM demo_cds_system_fields( p_datum  = @sy-datum,
                                        p_uzeit  = @sy-uzeit,
                                        p_langu  = @sy-langu,
                                        p_uname  = @sy-uname )
           INTO TABLE @DATA(result).
    SELECT *
           FROM demo_cds_system_fields(  )
           APPENDING TABLE @result.
    cl_demo_output=>display( result ).
  ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
  demo=>main( ).