Ehenv_Cdef_Amns_All_P

DDL: EHENV_CDEF_AMNS_ALL_P SQL: EHENVV_AM_CDEF Type: view

All CDEFs for Amounts with parameter

Ehenv_Cdef_Amns_All_P is a CDS View that provides data about "All CDEFs for Amounts with parameter" in SAP S/4HANA. It reads from 14 data sources and exposes 43 fields.

Data Sources (14)

SourceAliasJoin Type
ehfndd_amns_root amns from
ehfndd_amns_root amns2 union
ehenvd_cdef_root cdef inner
ehenvd_cdef_root cdef2 inner
ehenvd_sdef_head head inner
ehenvd_cdef_inpt input inner
ehenvd_cdef_inpt input2 inner
ehenvd_cdef_res res inner
ehenvd_cdef_res res2 inner
ehenvd_cdef_resh resh inner
ehenvd_cdef_resh resh2 inner
ehenvd_sdef_samp samp inner
ehenvd_scen_root scen inner
ehenvd_scen_root scen2 inner

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName EHENVV_AM_CDEF view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.authorizationCheck #NOT_REQUIRED view
EndUserText.label All CDEFs for Amounts with parameter view
ObjectModel.usageType.serviceQuality #P view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #MIXED view

Fields (43)

KeyFieldSource TableSource FieldDescription
amountkey ehfndd_amns_root db_key
amountstatus ehfndd_amns_root status
calcuser ehenvd_cdef_root user_id_cr
execoption ehenvd_cdef_root exec_option
calckey ehenvd_cdef_inpt parent_key
inputperiod ehenvd_cdef_inpt usage_period
scenkey ehenvd_scen_root db_key
scenstatus ehenvd_scen_root status
scenvalidto ehenvd_scen_root valid_to
locationkey ehenvd_scen_root loc_root_key_ref
usageperiod ehenvd_cdef_resh usage_period
calcreshkey ehenvd_cdef_resh db_key
subjecttype ehenvd_cdef_resh subject_type_code
subjectkey ehenvd_cdef_resh subject_root_key_ref
unit ehenvd_cdef_resh unit
chemprop ehenvd_sdef_head chem_property
analytetype ehenvd_sdef_head analyte_type
analytekey ehenvd_sdef_head analyte_key
headkey ehenvd_sdef_head db_key
timestamp
resulttype ehenvd_cdef_resh result_type
cron_pattern ehenvd_cdef_inpt cron_pattern
amountstatus ehfndd_amns_root status
calcuser ehenvd_cdef_root user_id_cr
execoption ehenvd_cdef_root exec_option
calckey ehenvd_cdef_inpt parent_key
inputperiod ehenvd_cdef_inpt usage_period
scenkey ehenvd_scen_root db_key
scenstatus ehenvd_scen_root status
scenvalidto ehenvd_scen_root valid_to
locationkey ehenvd_scen_root loc_root_key_ref
usageperiod ehenvd_cdef_resh usage_period
calcreshkey ehenvd_cdef_resh db_key
subjecttype ehenvd_cdef_resh subject_type_code
subjectkey ehenvd_cdef_resh subject_root_key_ref
unit ehenvd_cdef_resh unit
chemprop
analytetype
analytekey
headkey ehfndd_amns_root source_root_key_ref
timestamp
resulttype ehenvd_cdef_resh result_type
cron_pattern ehenvd_cdef_inpt cron_pattern
@AbapCatalog.sqlViewName: 'EHENVV_AM_CDEF'
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #NOT_REQUIRED
//@AbapCatalog.compiler.compareFilter: true

@EndUserText.label: 'All CDEFs for Amounts with parameter'
//CDS View Performance annotation

@ObjectModel.usageType:{ serviceQuality: #P,      
                         sizeCategory:  #L,         // < 10.000.000

                         dataClass: #MIXED }

/* Get all calculation definition keys for an amount */
define view Ehenv_Cdef_Amns_All_P
  with parameters
    p_amount_key : /bobf/conf_key
  as select from ehfndd_amns_root as amns
    inner join   ehenvd_sdef_samp as samp  on  amns.source_root_key_ref = samp.sampling_key_ref
                                           and amns.sourcetype          = '05' // finalized sampling

    inner join   ehenvd_sdef_head as head  on  samp.parent_key        = head.parent_key
                                           and amns.amountcategory    = head.chem_property
                                           and amns.subj_comp_type    = head.analyte_type
                                           and amns.subj_comp_key_ref = head.analyte_key
    inner join   ehenvd_cdef_inpt as input on head.db_key = input.data_source_key_ref
    inner join   ehenvd_scen_root as scen  on  input.scen_root_key_ref =  scen.db_key
                                           and scen.date_activated     <> 0
    inner join   ehenvd_cdef_root as cdef  on  input.parent_key =  cdef.db_key
                                           and cdef.exec_option <> '03' //exclude no calc calculations

    inner join   ehenvd_cdef_resh as resh  on  resh.parent_key  = cdef.db_key
                                           and resh.result_type = '00' //final result types

    inner join   ehenvd_cdef_res  as res   on  res.parent_key  = resh.db_key  

{
  amns.db_key                     as amountkey,
  amns.valuetimestamp             as valuetimestamp,
  amns.status                     as amountstatus,
  cdef.user_id_cr                 as calcuser,
  cdef.exec_option                as execoption,
  input.parent_key                as calckey,
  input.usage_period              as inputperiod,
  scen.db_key                     as scenkey,
  scen.status                     as scenstatus,
  scen.valid_from                 as scenvalidfrom,
  scen.valid_to                   as scenvalidto,
  scen.loc_root_key_ref           as locationkey,
  resh.usage_period               as usageperiod,
  resh.db_key                     as calcreshkey,
  resh.subject_type_code          as subjecttype,
  resh.subject_root_key_ref       as subjectkey,
  resh.unit                       as unit,
  head.chem_property              as chemprop,
  head.analyte_type               as analytetype,
  head.analyte_key                as analytekey,
  head.db_key                     as headkey,
  ''                              as timestamp,
  resh.result_type                as resulttype,
  cdef.exec_option_last_activ     as exec_option_last_activ,
  input.cron_pattern as cron_pattern,
  input.time_interval_pattern as time_interval_pattern,
  res.dirty_from_tstmp            as dirty_from_tstmp
}
where
  amns.db_key = $parameters.p_amount_key
  and amns.missing_ind <> 'X'

union select from ehfndd_amns_root as amns2
  inner join      ehenvd_cdef_inpt as input2 on amns2.source_root_key_ref = input2.data_source_key_ref
                                             and(
                                               amns2.sourcetype    = '02' // Collection

                                               or amns2.sourcetype = '04' // Calculation

                                               or amns2.sourcetype = '06' // Aggregated Data

                                             )                            
  inner join      ehenvd_scen_root as scen2  on  input2.scen_root_key_ref =  scen2.db_key
                                             and scen2.date_activated     <> 0
  inner join      ehenvd_cdef_root as cdef2  on  input2.parent_key =  cdef2.db_key
                                             and cdef2.exec_option <> '03' //exclude no calc calculations

  inner join      ehenvd_cdef_resh as resh2  on  resh2.parent_key  = cdef2.db_key
                                             and resh2.result_type = '00'
  inner join      ehenvd_cdef_res  as res2   on  res2.parent_key  = resh2.db_key                                               
{
  amns2.db_key                     as amountkey,
  amns2.valuetimestamp             as valuetimestamp,
  amns2.status                     as amountstatus,
  cdef2.user_id_cr                 as calcuser,
  cdef2.exec_option                as execoption,
  input2.parent_key                as calckey,
  input2.usage_period              as inputperiod,
  scen2.db_key                     as scenkey,
  scen2.status                     as scenstatus,
  scen2.valid_from                 as scenvalidfrom,
  scen2.valid_to                   as scenvalidto,
  scen2.loc_root_key_ref           as locationkey,
  resh2.usage_period               as usageperiod,
  resh2.db_key                     as calcreshkey,
  resh2.subject_type_code          as subjecttype,
  resh2.subject_root_key_ref       as subjectkey,
  resh2.unit                       as unit,
  ''                               as chemprop,
  ''                               as analytetype,
  hextobin('00000000000000000000000000000000') as analytekey,
  amns2.source_root_key_ref        as headkey, // just to comply with other part of the union

  ''                               as timestamp,
  resh2.result_type                as resulttype,
  cdef2.exec_option_last_activ     as exec_option_last_activ,
  input2.cron_pattern as cron_pattern,
  input2.time_interval_pattern as time_interval_pattern,
  res2.dirty_from_tstmp            as dirty_from_tstmp
}
where
  amns2.db_key = $parameters.p_amount_key 
  and amns2.missing_ind <> 'X'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"EHENVD_CDEF_INPT",
"EHENVD_CDEF_RES",
"EHENVD_CDEF_RESH",
"EHENVD_CDEF_ROOT",
"EHENVD_SCEN_ROOT",
"EHENVD_SDEF_HEAD",
"EHENVD_SDEF_SAMP",
"EHFNDD_AMNS_ROOT"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/