P_LogcDocSales

DDL: P_LOGCDOCSALES Type: view_entity CONSUMPTION

P_LogcDocSales is a Consumption CDS View in SAP S/4HANA. It reads from 1 data source (I_SalesDocument) and exposes 5 fields with key field SalesDocument.

Data Sources (1)

SourceAliasJoin Type
I_SalesDocument SalesDocument from

Annotations (3)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #CONSUMPTION view

Fields (5)

KeyFieldSource TableSource FieldDescription
KEY SalesDocument I_SalesDocument SalesDocument
SalesDocumentType SalesDocumentType
OrganizationDivision OrganizationDivision
SalesOrganization SalesOrganization
DistributionChannel DistributionChannel
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM: {
  private: true,
  viewType: #CONSUMPTION
}
define view entity P_LogcDocSales
  as select from I_SalesDocument as SalesDocument

{
  key SalesDocument.SalesDocument,

      // map to the defined logistic document categories of pc if_ehfnd_logistic_comn_c

      cast (
          case
            when SalesDocument.SDDocumentCategory = 'C'
              then 'SO' // Sales Order (EHFND_LOG_DOC_CATEGORY)

            when SalesDocument.SDDocumentCategory = 'I'
              then 'OC' // Sales Order Without Charge (EHFND_LOG_DOC_CATEGORY)

            when SalesDocument.SDDocumentCategory = 'E' or
                 SalesDocument.SDDocumentCategory = 'F'
              then 'SA' // Scheduling Agreement (EHFND_LOG_DOC_CATEGORY)

          end
           as ehfnd_log_doc_category) as ProdCmplncLogsDocumentCategory,

      //Needed for Authorization check

      @ObjectModel.readOnly:true
      @Consumption.hidden: true
      SalesDocumentType,

      @ObjectModel.readOnly:true
      @Consumption.hidden: true
      OrganizationDivision,

      @ObjectModel.readOnly:true
      @Consumption.hidden: true
      SalesOrganization,

      @ObjectModel.readOnly:true
      @Consumption.hidden: true
      DistributionChannel

}
where
  (
     SalesDocument.SDDocumentCategory = 'C' // if_ehfnd_sd_integration_c=>gc_vbtypl-order

  or SalesDocument.SDDocumentCategory = 'I' // if_ehfnd_sd_integration_c=>gc_vbtypl-order_wo_charge

  or SalesDocument.SDDocumentCategory = 'E' // if_ehfnd_sd_integration_c=>gc_vbtypl-scheduling_agreement

  or SalesDocument.SDDocumentCategory = 'F' // if_ehfnd_sd_integration_c=>gc_vbtypl-sched_agreement_w_ext_svc_agnt

  )
  // filter blocked logistic document

//  and(

//    OverallDangerousGoodsStatus <> 'D' // dom_total_dgsta - Blocked – Dangerous Goods Transport Forbidden

//    and OverallDangerousGoodsStatus <> 'C' // dom_total_dgsta - Partially Blocked – Dangerous Goods Transport Forbidden

//  )

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_SALESDOCUMENT"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/