I_SalesOrderInInvcgNotTransfd is a Composite CDS View that provides data about "SOFM Not Transferred Sales Orders In Invoice" in SAP S/4HANA. It reads from 1 data source (I_SalesDocumentBasic) and exposes 16 fields with key fields SalesOrder, BillingDocument.
@ClientHandling.algorithm: #SESSION_VARIABLE@ObjectModel.usageType.dataClass: #MIXED@ObjectModel.usageType.serviceQuality: #D@ObjectModel.usageType.sizeCategory: #S@EndUserText.label: 'SOFM Not Transferred Sales Orders In Invoice'
@VDM.viewType: #COMPOSITE@AccessControl.authorizationCheck: #CHECK@AbapCatalog.sqlViewName: 'ISOFISSUEIN01'
--COMMENTS
--CAVE: vkorg auf BDH can be different to to vkorg auf SOH - and we expose here the SOH-Vkorg
--Note (outdated): vbrk-buchk isnot persisted on VBRP. However, VBRP can be prefiltered by gbstk_ana = A or B ! <-- Performance Optimization 28.6.2019
--Note: vbrk-buchk IS persisted on VBRP (vbrp-vf_status_ana=B). This allows to ignore VBRK ! <-- Performance Optimization 16.8.2019
--Note for Performance especially in high volume setting:
-- not too many vbrk (filter buchk) <-OUTDATED 16.8.2019
-- not too many vbrp (filter gbstk_ana) <-NEW 28.6.2019
-- not too many vbak (filter push-down vkorg, ...) <-NEW 2017 ?
-- Update 16.8.2019 VBRK no longer needed - vbrp is filtered with vbrp.vf_status_ana=B
--AT11.08.2020 for all issues: VBKD-BSTKD (PurchaseOrderBYCustomer) no longer provided by issues (no true hdr attribute & too expensive)
defineview I_SalesOrderInInvcgNotTransfd
//withparameters// @Consumption.hidden: true// @Environment.systemField: #SYSTEM_DATE// P_ReferenceDate : sydate
asselectdistinctfrom I_BillingDocExtdItem as bdi --AT16.8.2019 OP1911 ignore VBRK by using vbrp-vf_status_ana = B
innerjoin I_SalesDocumentBasic as SOH on --I_SalesDocument
bdi.SalesDocument = SOH.SalesDocument
and --AT29.06.2020 enforce underlying/preceding Sales Document is C,I,L
( SOH.SDDocumentCategory = 'C' or
SOH.SDDocumentCategory = 'I' or
SOH.SDDocumentCategory = 'L'
)
//leftouter to one join P_SalesDocumentBusinessData as VBKD on// SOH.SalesDocument = VBKD.SlsDocBusinessData
// and VBKD.SlsDocBusinessDataItem = '000000'
{
//Keykeycast(SOH.SalesDocument as vdm_sales_order) as SalesOrder,
key bdi.BillingDocument as BillingDocument,
//Organization
SOH.SalesOrganization as SalesOrganization,
SOH.DistributionChannel as DistributionChannel,
SOH.OrganizationDivision as OrganizationDivision,
//Misc
SOH.RequestedDeliveryDate,
SOH.OverallSDProcessStatus,
SOH.SalesDocumentDate,
SOH.SalesGroup,
SOH.SalesOffice,
SOH.SoldToParty,
--VBKD.PurchaseOrderByCustomer,
//Category
SOH.SalesDocumentType as SalesOrderType,
--BDH.AccountingPostingStatus as AccountingPostingStatus,
//Issue
cast('IN01'as issue_sof) as Issue,
cast('30_IN' as issue_cat) as IssueCategory,
@DefaultAggregation: #MINcasewhen bdi.BillingDocumentDate = '00000000'
thencast(Dats_Days_Between( cast($session.system_date as dats), bdi.CreationDate ) as due_days)
elsecast(Dats_Days_Between( cast($session.system_date as dats), bdi.BillingDocumentDate ) as due_days)
endas DueDays
}
where
bdi.OverallBillingStatus = 'B' --AT16.8.2019 OP1911 ignore VBRK by using vbrp-vf_status_ana = B
--( BDH.AccountingPostingStatus = 'A' or BDH.AccountingPostingStatus = 'B' )
--BDH.BillingDocumentDate <= $session.system_date Fix AT3.5.2017
/*$parameters.P_ReferenceDate and
-- all "sales orderlike" categories/vbtyps
( SOH.SDDocumentCategory = 'C' or
SOH.SDDocumentCategory = 'I' or
SOH.SDDocumentCategory = 'L'
) --*//*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BILLINGDOCEXTDITEM",
"I_SALESDOCUMENTBASIC"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/