ABAP CDS Views: Working with parameters & F4 Help
@AbapCatalog.sqlViewName: 'Z_XXXX_V1' // SQL View Name
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #CONSUMPTION
@Analytics.query: true
@Analytics.dataExtraction.enabled: true
@EndUserText.label: 'Consumption view'
define view ZCDS_C_XXXX // Defining CDS View
with parameters
@EndUserText.label: 'Service Order Type'
P_OrderType : abap.char( 4 ) // Parameter name & Type
as select from ZCDS_I_XXXX (P_OType:$parameters.P_OrderType) // Passing parameter value to composite view
{
@AnalyticsDetails.query.axis: #ROWS
key aXYZ,
@EndUserText.label: 'Service Order Type'
@AnalyticsDetails.query.axis: #ROWS
OrderType
}
Sample Code -
define view ZCDS_C_XXXX // CDS View Name
with parameters
@Consumption.valueHelpDefinition: // Annotation to link parameter with CDS view which will help to generate Text
[ {
entity: { name: 'ZCDS_XXXX_Value_Help',
element: 'OrderType'}
}]
@EndUserText.label: 'Service Order Type'
P_OrderType : abap.char( 4 )
as select from ZCDS_I_XXXX (P_OType:$parameters.P_OrderType)
{
@AnalyticsDetails.query.axis: #ROWS
key aXYZ,
@EndUserText.label: 'Service Order Type'
@AnalyticsDetails.query.axis: #ROWS
@AnalyticsDetails.query.display: #KEY_TEXT
OrderType
}
@AbapCatalog.sqlViewName: 'Z_XXXX_V1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #CONSUMPTION
@Analytics.query: true
@Analytics.dataExtraction.enabled: true
@EndUserText.label: 'Consumption view'
define view ZCDS_C_XXXX as select from ZCDS_I_XXXX
{
@AnalyticsDetails.query.axis: #ROWS
key aXYZ,
@Consumption.Filter.mandatory : True // Annotation for input prompts
@Consumption.valueHelp : '_ValueHelp.aXXXX' // Annotation to link with CDS view which will generate text
@EndUserText.label: 'Service Order Type'
@AnalyticsDetails.query.axis: #ROWS
@AnalyticsDetails.query.display: #KEY_TEXT
OrderType
}
@AbapCatalog.sqlViewName: 'ZVM_XXX_A1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Analytics.dataCategory: #CUBE
@VDM.viewType: #COMPOSITE
@EndUserText.label: 'Parameter based CDS view'
define view ZCDS_I_XXXX
as select from aXXX_Table
association [0..1] to ZCDS_XXXX_Value_Help as _ValueHelp
on $projection.OrderType = _ValueHelp.OrderType
{
key aXYZ,
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
@ObjectModel.foreignKey.association: '_ValueHelp'
aXXXX as OrderType,
//Association
_ValueHelp
}
@Consumption.filter.multipleSelections: true
Sample Code -
define view ZCDS_C_XXXX as select from ZCDS_I_XXXX
{
@AnalyticsDetails.query.axis: #ROWS
key aXYZ,
@Consumption.Filter.mandatory : True
@Consumption.Filter.MultipleSelections : True // Annotation to enable multiple selection
@Consumption.valueHelp : '_ValueHelp.aXXXX'
@EndUserText.label: 'Service Order Type'
@AnalyticsDetails.query.axis: #ROWS
@AnalyticsDetails.query.display: #KEY_TEXT
OrderType
}
@Consumption.filter.mandatory: True
@Consumption.filter.selectionType: #RANGE
1. CDS view used for Value help association
@AbapCatalog.sqlViewName: 'ZXXXXX' // SQL View Name
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Analytics.dataCategory: #DIMENSION
@VDM.viewType: #BASIC
@Search.searchable: true
@EndUserText.label: 'Value Help'
define view ZCDS_XXXXX_Value_Help as select from tXXXX // CDS View Name and Source Table
association [0..1] to ZCDS_XXXXX_TEXT as _TEXT // CDS View from which we will fetch text value
on $projection.OrderType = _TEXT.OrderType
{
@Search.defaultSearchElement: true
key aXXXX as OrderType,
//Association
_TEXT
}
2. CDS view for Text
@AbapCatalog.sqlViewName: 'ZXXXXTEXT1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #BASIC
@ObjectModel.dataCategory: #TEXT
@Search.searchable: true
@EndUserText.label: 'Value Help Text'
define view ZCDS_XXXXX_TEXT as select from tXXX01 // CDS View to generate text
{
key aXXXX as OrderType, // Key Field
@Semantics.text: true
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
txt as OrderTypeText // Text Field
} where spras = 'E'
define view ZCDS_XXXXX_TEXT as select from tXXX01 // CDS View to generate text
{
key aXXXX as OrderType, // Key Field
@Semantics.text: true
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
Key txt as OrderTypeText // Text Field as Key
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 |