P_BillingDocProcFlowM2
P_BillingDocProcFlowM2 is a Consumption CDS View in SAP S/4HANA. It reads from 1 data source (I_SDDocumentProcessFlow) and exposes 8 fields with key fields LevelM2Document, LevelM2DocumentItem, LevelM1Document, LevelM1DocumentItem, LevelM1DocumentCategory.
Data Sources (1)
| Source | Alias | Join Type |
|---|---|---|
| I_SDDocumentProcessFlow | LevelM2 | inner |
Annotations (9)
| Name | Value | Level | Field |
|---|---|---|---|
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| ObjectModel.usageType.serviceQuality | #C | view | |
| ObjectModel.usageType.sizeCategory | #XL | view | |
| VDM.private | true | view | |
| VDM.viewType | #CONSUMPTION | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| AbapCatalog.sqlViewName | PBILLGDOCPROCFM2 | view | |
| AbapCatalog.preserveKey | true | view |
Fields (8)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | LevelM2Document | PrecedingDocument | ||
| KEY | LevelM2DocumentItem | PrecedingDocumentItem | ||
| KEY | LevelM1Document | LevelM1Document | ||
| KEY | LevelM1DocumentItem | LevelM1DocumentItem | ||
| KEY | LevelM1DocumentCategory | LevelM1DocumentCategory | ||
| KEY | BillingDocument | BillingDocument | ||
| BillingDocumentType | BillingDocumentType | |||
| SalesOrganization | LevelM1 | SalesOrganization |
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XL
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AbapCatalog.sqlViewName: 'PBILLGDOCPROCFM2'
@AbapCatalog.preserveKey:true
define view P_BillingDocProcFlowM2
as select distinct from P_BillingDocProcFlowM1 as LevelM1 --> Level -1
inner join I_SDDocumentProcessFlow as LevelM2 --> Level Minus2
on LevelM2.SubsequentDocument = LevelM1.LevelM1Document
and LevelM2.SubsequentDocumentItem = LevelM1.LevelM1DocumentItem
and LevelM2.SubsequentDocumentCategory = LevelM1.LevelM1DocumentCategory
and (
LevelM2.PrecedingDocumentCategory = 'C' --> Order
or LevelM2.PrecedingDocumentCategory = 'E' --> Scheduling Agreement
or LevelM2.PrecedingDocumentCategory = 'I' --> Order w/o charge
or LevelM2.PrecedingDocumentCategory = 'H' --> Return
or LevelM2.PrecedingDocumentCategory = 'L' --> Debit Memo Request
or LevelM2.PrecedingDocumentCategory = 'L' --> Debit Memo Request
or LevelM2.PrecedingDocumentCategory = 'M' --> Invoice
or LevelM2.PrecedingDocumentCategory = '2' --> External Transaction
or LevelM2.PrecedingDocumentCategory = 'CSVO' --> CM Service Order
or LevelM2.PrecedingDocumentCategory = 'CSCO' --> CM Service Confirmation
or LevelM2.PrecedingDocumentCategory = 'CSCT' --> CM Service Contract
or LevelM2.PrecedingDocumentCategory = 'PBRQ' --> Project Billing Request
)
left outer to one join I_SalesDocumentBasic as SalesDocument on LevelM2.PrecedingDocument = SalesDocument.SalesDocument
{
//Key
key PrecedingDocument as LevelM2Document,
key PrecedingDocumentItem as LevelM2DocumentItem,
key case
when PrecedingDocumentCategory = 'M'
then 'MREF' --> allow assignmet to 'Reference' lane
else
PrecedingDocumentCategory
end as LevelM2DocumentCategory,
key LevelM1Document,
key LevelM1DocumentItem,
key LevelM1DocumentCategory,
//Billing Document
key BillingDocument,
BillingDocumentType,
//Order relevant for Project e.g Professional Service
case when
(
SalesDocument._SalesDocumentType.OrderTypeForBillingRequest != ' ' or
SalesDocument._SalesDocumentType.SalesDocumentProcessingType = 'P' --> Professional Service
)
then
'X'
else
''
end as SalesOrderIsProjectBased,
case when
(
SalesDocument._SalesDocumentType.OrderTypeForBillingRequest = ' ' and
SalesDocument._SalesDocumentType.SalesDocumentProcessingType != 'P' and
( ( LevelM2.PrecedingDocumentCategory = 'C' --> Order
and LevelM2.SubsequentDocumentCategory = 'L' ) --> --> Debit Memo Request
or ( LevelM2.PrecedingDocumentCategory = 'M' --> Invoice
and LevelM2.SubsequentDocumentCategory = 'L' ) --> --> Debit Memo Request
) )
then
' '
else
''
end as IsReferenceDocument,
//Organization
LevelM1.SalesOrganization
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_SALESDOCUMENTBASIC",
"I_SALESDOCUMENTTYPE",
"I_SDDOCUMENTPROCESSFLOW",
"P_BILLINGDOCPROCFLOWM1"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA