Open sync-by-unito[bot] opened 10 months ago
➤ Canberk.Zor commented:
@AbapCatalog.sqlViewName: 'ZCZ_CDS_004' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'CDS ( Input Parameters )' define view ZCZ_DDL_004 with parameters p_vbeln : vbeln_vl , p_erdat : abap.dats , p_ernam : ernam as select from likp as _likp { _likp.vbeln as deliveryNo , _likp.erdat , _likp.ernam } where _likp.vbeln = $parameters.p_vbeln and _likp.erdat = $parameters.p_erdat and _likp.ernam = $parameters.p_ernamP\NAME : DATA\ELEMENT_NAME
OR USING
ABAP DATA DECLERATION as shown in above code block
image.png ( https://trello.com/1/cards/654a308a4bfd600d2419affc/attachments/654b3d91a4146be63dc97f50/download/image.png )
As a default , parameters are mandatory fields.When we press F8 button , input field popup screen will be shown.
image.png ( https://trello.com/1/cards/654a308a4bfd600d2419affc/attachments/654b3da702e1e60cf3a60ec9/download/image.png )
At the last digit of the text “ P_VBELN:* “ , you see star ( this means this field is mandatory)
This not means that parameters are always mandatory.
PARAMETERS are optional only when default value is assigned to them.We can only use system fields by using annotation \@Environment.systemField: .
@AbapCatalog.sqlViewName: 'ZCZ_CDS_004' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'CDS ( Input Parameters )' define view ZCZ_DDL_004 with parameters @Environment.systemField: #SYSTEM_DATE p_erdat : abap.dats , @Environment.systemField: #USER p_ernam : ernam as select from likp as _likp { _likp.vbeln as deliveryNo , _likp.erdat , _likp.ernam } where _likp.erdat = $parameters.p_erdat and _likp.ernam = $parameters.p_ernam We define system fields ( #SYSTEM_DATE AND #USER ) as a default to the parameters :
P\erdat and p\ernam.
Star dissepeared.This means that these fields are not mandatory anymore.
image.png ( https://trello.com/1/cards/654a308a4bfd600d2419affc/attachments/654b3e14b7bfae19971a1d48/download/image.png )
If we enter parameters , the list will be shown related with our parameters
image.png ( https://trello.com/1/cards/654a308a4bfd600d2419affc/attachments/654b3e22eb82f4ccdbba35be/download/image.png )
If we don’t enter parameters , the system automically search LIKP table with parameters ernam = system user’s name and erdat = system’s date.
These are comes from \@Environment.systemField: #SYSTEM_DATE
\@Environment.systemField: #USER
image.png ( https://trello.com/1/cards/654a308a4bfd600d2419affc/attachments/654b3e467d9c5794df3d7420/download/image.png )
So how we call this view in GUI ?
If CDS doesn’t use \@Environment.systemField: and we don’t enter parameters in select statement
image.png ( https://trello.com/1/cards/654a308a4bfd600d2419affc/attachments/654b3e7f27ad33b23f839c16/download/image.png )
The syntax error will be existed.
We have to give parameters in select statement
image.png ( https://trello.com/1/cards/654a308a4bfd600d2419affc/attachments/654b3e929e9821c3868c66ff/download/image.png )
image.png ( https://trello.com/1/cards/654a308a4bfd600d2419affc/attachments/654b3ea94c4dafea57437cf0/download/image.png )
➤ Tuğrul CEYHAN commented:
Eline sağlık canberkzor
┆Issue is synchronized with this Trello card by Unito ┆Attachments: INPUT_PARAMETERS.pdf