SRFD_DocumentDataEnriched

DDL: SRFD_DOCUMENTDATAENRICHED SQL: SRFV_DOCDATENRCD Type: view Package: GLO_GEN_SRF_RUNTIME

Generated Document Data

SRFD_DocumentDataEnriched is a CDS View that provides data about "Generated Document Data" in SAP S/4HANA. It reads from 5 data sources (SRFD_DocumentData, SRFD_SchemaElementEnriched, srf_rep_run, srf_rep_run_doc, srf_reporting) and exposes 24 fields with key field StatryRptDocDataUUID. Part of development package GLO_GEN_SRF_RUNTIME.

Data Sources (5)

SourceAliasJoin Type
SRFD_DocumentData doc_data from
SRFD_SchemaElementEnriched SchElem inner
srf_rep_run srf_rep_run inner
srf_rep_run_doc srf_rep_run_doc inner
srf_reporting srf_reporting inner

Parameters (2)

NameTypeDefault
p_schema_id srf_schema_id
p_partition_no srf_partition_no

Annotations (9)

NameValueLevelField
AbapCatalog.sqlViewName SRFV_DOCDATENRCD view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_ALLOWED view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label Generated Document Data view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #L view

Fields (24)

KeyFieldSource TableSource FieldDescription
KEY StatryRptDocDataUUID SRFD_DocumentData StatryRptDocDataUUID
StatryRptDocUUID SRFD_DocumentData StatryRptDocUUID
StatryRptTaskUUID SRFD_DocumentData StatryRptTaskUUID
StatryRptgEntity srf_reporting reporting_entity
StatryRptCategory srf_reporting rep_cat_id
StatryRptPeriodStartDate srf_reporting begin_of_period
StatryRptPeriodEndDate srf_reporting end_of_period
StatryRptReportingPeriodNumber srf_reporting reporting_period_num
StatryRptRunID srf_rep_run report_run_id
StatryRptDocument srf_rep_run_doc document_id
StatryRptSchemaElementId SRFD_DocumentData StatryRptSchemaElementId
StatryRptSchemaAttributeId SRFD_DocumentData StatryRptSchemaAttributeId
StatryRptSequenceNumber SRFD_DocumentData StatryRptSequenceNumber
StatryRptParentSequenceNumber SRFD_DocumentData StatryRptParentSequenceNumber
StatryRptSchemaParentElementId SRFD_SchemaElementEnriched StatryRptSchemaParentElementId
StatryRptDocDataGeneratedValue SRFD_DocumentData StatryRptDocDataGeneratedValue
StatryRptDocDataModifiedValue SRFD_DocumentData StatryRptDocDataModifiedValue
StatryRptDocDataValue SRFD_DocumentData StatryRptDocDataValue
StatryRptDocDataChangeInd SRFD_DocumentData StatryRptDocDataChangeInd
StatryRptSchemaRefElementId SRFD_SchemaElementEnriched StatryRptSchemaRefElementId
StatryRptSchemaSingleValLeafEl SRFD_SchemaElementEnriched StatryRptSchemaSingleValLeafEl
StatryRptPartitionNo
StatryRptPreviousSeqNo SRFD_DocumentData StatryRptPreviousSeqNo
StatryRptSubordinalNo SRFD_DocumentData StatryRptSubordinalNo
@AbapCatalog.sqlViewName: 'SRFV_DOCDATENRCD'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_ALLOWED
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'Generated Document Data'
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #L
//-----------------------------------------------------------------------------------------------------------//

// 1.This CDS view is for internal purpose only.

// 2.Before consuming the CDS view, proper authorization checks at Reporting Entity and Run level

//    must be carried out.

// 3.Mandatory specification of key "StatryRptDocUUID" is required while accessing the data from the cds view to avoid inconsistency

//-----------------------------------------------------------------------------------------------------------//

define view SRFD_DocumentDataEnriched
  with parameters
    p_schema_id : srf_schema_id,
    @Consumption.defaultValue: '0'
    p_partition_no : srf_partition_no

  as select from           SRFD_DocumentData          as doc_data

    inner join             srf_reporting                            on srf_reporting.db_key = doc_data.StatryRptTaskUUID

    inner join             srf_rep_run_doc                          on doc_data.StatryRptDocUUID = srf_rep_run_doc.db_key

    inner join             srf_rep_run                              on srf_rep_run_doc.parent_key = srf_rep_run.db_key

    inner join             SRFD_SchemaElementEnriched as SchElem    on  SchElem.StatryRptSchema           = :p_schema_id //SchElem.StatryRptSchema

                                                                    and SchElem.StatryRptSchemaVersion    = 'ACT'
                                                                    and doc_data.StatryRptSchemaElementId = SchElem.StatryRptSchemaElementId

    left outer to one join srf_rep_run_data           as RefElem on  doc_data.StatryRptDocUUID              = RefElem.parent_key
                                                                    and doc_data.StatryRptTaskUUID             = RefElem.root_key
                                                                    and SchElem.StatryRptSchemaRefElementId    = RefElem.element_id
                                                                    and doc_data.StatryRptSequenceNumber       = RefElem.sequence_no
                                                                    and doc_data.StatryRptParentSequenceNumber = RefElem.parent_seq_no
                                                                    and RefElem.partition_no = $parameters.p_partition_no


{
      //Technical key fields

  key doc_data.StatryRptDocDataUUID,
      doc_data.StatryRptDocUUID,
      doc_data.StatryRptTaskUUID,

      //Semantic/alterntive key fields

      srf_reporting.reporting_entity     as StatryRptgEntity,               // for RAL

      srf_reporting.rep_cat_id           as StatryRptCategory,              // for RAL

      srf_reporting.begin_of_period      as StatryRptPeriodStartDate,       // for RAL

      srf_reporting.end_of_period        as StatryRptPeriodEndDate,         // For RAL

      srf_reporting.reporting_period_num as StatryRptReportingPeriodNumber, // For RAL

      srf_rep_run.report_run_id          as StatryRptRunID,                 // for RAL


      //Data fields

      srf_rep_run_doc.document_id        as StatryRptDocument,
      doc_data.StatryRptSchemaElementId,
      doc_data.StatryRptSchemaAttributeId,
      doc_data.StatryRptSequenceNumber,
      doc_data.StatryRptParentSequenceNumber,
      SchElem.StatryRptSchemaParentElementId,
      doc_data.StatryRptDocDataGeneratedValue,
      doc_data.StatryRptDocDataModifiedValue,

      doc_data.StatryRptDocDataValue,

      case
      when RefElem.change_indicator = 'UM' or RefElem.change_indicator = 'CM' or RefElem.change_indicator = 'CU' then RefElem.modified_value
      else RefElem.generated_value
      end                                as StatryRptDocDataRefValue,

      doc_data.StatryRptDocDataChangeInd,
      SchElem.StatryRptSchemaRefElementId,
      SchElem.StatryRptSchemaSingleValLeafEl,
      $parameters.p_partition_no             as StatryRptPartitionNo,

      doc_data.StatryRptPreviousSeqNo,
      doc_data.StatryRptSubordinalNo

}

where
  SchElem.StatryRptSchema = :p_schema_id and
  doc_data.StatryRptPartitionNo = :p_partition_no