I_ARProcessFlowDocumentVH

DDL: I_ARPROCESSFLOWDOCUMENTVH SQL: IARPROCFLOWDOC Type: view COMPOSITE

Document Number

I_ARProcessFlowDocumentVH is a Composite CDS View that provides data about "Document Number" in SAP S/4HANA. It reads from 6 data sources and exposes 169 fields with key fields DocumentType, CompanyCode, FiscalYear, Documentid, CompanyCode. It has 1 association to related views.

Data Sources (6)

SourceAliasJoin Type
I_BillingDocument I_BillingDocument union_all
I_BillingDocumentBasic I_BillingDocumentBasic union_all
I_DeliveryDocument I_DeliveryDocument union_all
I_SalesDocument I_SalesDocument from
I_SalesDocument I_SalesDocument union_all
I_ServiceDocument I_ServiceDocument union_all

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_APProcessFlowDocTypeText _APProcessFlowDocTypeText _APProcessFlowDocTypeText.Language = $session.system_language and _APProcessFlowDocTypeText.ProcessType = 'AR' and _APProcessFlowDocTypeText.DocumentType = '1'

Annotations (13)

NameValueLevelField
AbapCatalog.sqlViewName IARPROCFLOWDOC view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.dataCategory #VALUE_HELP view
VDM.viewType #COMPOSITE view
EndUserText.label Document Number view
Search.searchable true view
Metadata.ignorePropagatedAnnotations true view

Fields (169)

KeyFieldSource TableSource FieldDescription
KEY DocumentType
KEY CompanyCode
KEY FiscalYear
KEY Documentid
ACMTransactingCustomerRef
DocumentTypeDescription
SalesDocumentType
OrganizationDivision
SalesOrganization
DistributionChannel
ShippingPoint
BillingDocumentType
FinancialAccountType
BusinessArea
FunctionalArea
Segment
SalesOffice
SalesGroup
SalesOrganizationOrgUnitID
SalesOfficeOrgUnitID
SalesGroupOrgUnitID
DocumentTypeasdokarasDocumentType
KEY CompanyCode
KEY FiscalYear
KEY Documentid
ACMTransactingCustomerRef
DocumentTypeDescription
SalesDocumentType
OrganizationDivision
SalesOrganization
DistributionChannel
ShippingPoint
BillingDocumentType
FinancialAccountType
BusinessArea
FunctionalArea
Segment
SalesOffice
SalesGroup
SalesOrganizationOrgUnitID
SalesOfficeOrgUnitID
SalesGroupOrgUnitID
DocumentTypeasdokarasDocumentType
KEY CompanyCode
KEY FiscalYear
KEY Documentid
ACMTransactingCustomerRef
DocumentTypeDescription
SalesDocumentType
OrganizationDivision
SalesOrganization
DistributionChannel
ShippingPoint
BillingDocumentType
FinancialAccountType
BusinessArea
FunctionalArea
Segment
SalesOffice
SalesGroup
SalesOrganizationOrgUnitID
SalesOfficeOrgUnitID
SalesGroupOrgUnitID
DocumentTypeasdokarasDocumentType
KEY CompanyCode
KEY FiscalYear
KEY Documentid
ACMTransactingCustomerRef
DocumentTypeDescription
SalesDocumentType
OrganizationDivision
SalesOrganization
DistributionChannel
ShippingPoint
BillingDocumentType
FinancialAccountType
BusinessArea
FunctionalArea
Segment
SalesOffice
SalesGroup
SalesOrganizationOrgUnitID
SalesOfficeOrgUnitID
SalesGroupOrgUnitID
DocumentTypeasDocumentType
KEY CompanyCode CompanyCode
KEY FiscalYear
KEY Documentid
ACMTransactingCustomerRef
DocumentTypeDescription
SalesDocumentType
OrganizationDivision
SalesOrganization
DistributionChannel
ShippingPoint
BillingDocumentType
FinancialAccountType
BusinessArea
FunctionalArea
Segment
SalesOffice
SalesGroup
SalesOrganizationOrgUnitID
SalesOfficeOrgUnitID
SalesGroupOrgUnitID
DocumentTypeasdokarasDocumentType
KEY CompanyCode CompanyCode
KEY FiscalYear
KEY Documentid
ACMTransactingCustomerRef
DocumentTypeDescription
SalesDocumentType
OrganizationDivision
SalesOrganization
DistributionChannel
ShippingPoint
BillingDocumentType
FinancialAccountType
BusinessArea
FunctionalArea
Segment
SalesOffice
SalesGroup
SalesOrganizationOrgUnitID
SalesOfficeOrgUnitID
SalesGroupOrgUnitID
DocumentTypeasdokarasDocumentType
KEY CompanyCode
KEY FiscalYear
KEY Documentid
ACMTransactingCustomerRef
DocumentTypeDescription
SalesDocumentType
OrganizationDivision
SalesOrganization
DistributionChannel
ShippingPoint
BillingDocumentType
FinancialAccountType
BusinessArea
FunctionalArea
Segment
SalesOffice
SalesGroup
SalesOrganizationOrgUnitID
SalesOfficeOrgUnitID
SalesGroupOrgUnitID
DocumentTypeasdokarasDocumentType
KEY CompanyCode
KEY FiscalYear
KEY Documentid
ACMTransactingCustomerRef
DocumentTypeDescription
SalesDocumentType
OrganizationDivision
SalesOrganization
DistributionChannel
ShippingPoint
BillingDocumentType
FinancialAccountType
BusinessArea
FunctionalArea
Segment
SalesOffice
SalesGroup
SalesOrganizationOrgUnitID
SalesOfficeOrgUnitID
SalesGroupOrgUnitID
ServiceOrganization
@AbapCatalog.sqlViewName: 'IARPROCFLOWDOC'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.dataClass:  #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.dataCategory: #VALUE_HELP
@VDM.viewType: #COMPOSITE
@EndUserText.label: 'Document Number'
@Search.searchable: true
@Metadata.ignorePropagatedAnnotations:true
define view I_ARProcessFlowDocumentVH
  as

  select from I_SalesDocument
  association [0..1] to I_APProcessFlowDocTypeText as _APProcessFlowDocTypeText on  _APProcessFlowDocTypeText.Language     = $session.system_language
                                                                                and _APProcessFlowDocTypeText.ProcessType  = 'AR'
                                                                                and _APProcessFlowDocTypeText.DocumentType = '1' //change

{
  key cast(_APProcessFlowDocTypeText.DocumentType as dokar)                                                 as DocumentType,
  key cast('' as fis_bukrs)                                                                                 as CompanyCode,
  key cast('' as fis_gjahr)                                                                                 as FiscalYear,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
  key cast(SalesDocument as farp_dispprocflow_belnr_d)                                                      as Documentid,
      cast(PurchaseOrderByCustomer as bstnk)                                                                as ACMTransactingCustomerRef,
      I_SalesDocument._SalesDocumentType._Text[1:Language = $session.system_language].SalesDocumentTypeName as DocumentTypeDescription,

      @Consumption.hidden: true
      cast(SalesDocumentType as auart)                                                                      as SalesDocumentType,
      @Consumption.hidden: true
      cast(OrganizationDivision as spart)                                                                   as OrganizationDivision,
      @Consumption.hidden: true
      cast(SalesOrganization as vkorg)                                                                      as SalesOrganization,
      @Consumption.hidden: true
      cast(DistributionChannel as vtweg)                                                                    as DistributionChannel,
      @Consumption.hidden: true
      cast('' as vstel)                                                                                     as ShippingPoint,
      @Consumption.hidden: true
      cast('' as fkart)                                                                                     as BillingDocumentType,
      @Consumption.hidden: true
      cast('' as koart)                                                                                     as FinancialAccountType,
      @Consumption.hidden: true
      cast('' as gsber)                                                                                     as BusinessArea,
      @Consumption.hidden: true
      cast('' as fkber_long)                                                                                as FunctionalArea,
      @Consumption.hidden: true
      cast('' as fb_segment)                                                                                as Segment,
      @Consumption.hidden: true
      cast('' as vkbur )                                                                                    as SalesOffice,
      @Consumption.hidden: true
      cast('' as vkgrp )                                                                                    as SalesGroup,
      @Consumption.hidden: true
      cast('' as crmt_sales_org )                                                                           as SalesOrganizationOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_office )                                                                        as SalesOfficeOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_group )                                                                         as SalesGroupOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_service_org )                                                                         as ServiceOrganization

}
where
  OvrlItmGeneralIncompletionSts <> ''
  and SDDocumentCategory = 'B'

union all select from I_SalesDocument
association [0..1] to I_APProcessFlowDocTypeText as _APProcessFlowDocTypeText on  _APProcessFlowDocTypeText.Language     = $session.system_language
                                                                              and _APProcessFlowDocTypeText.ProcessType  = 'AR'
                                                                              and _APProcessFlowDocTypeText.DocumentType = '2'   //change

{
  key cast(_APProcessFlowDocTypeText.DocumentType  as dokar)                                                as DocumentType,
  key cast('' as fis_bukrs)                                                                                 as CompanyCode,
  key cast('' as fis_gjahr)                                                                                 as FiscalYear,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
  key cast(SalesDocument as farp_dispprocflow_belnr_d)                                                      as Documentid,
      cast(PurchaseOrderByCustomer as bstnk)                                                                as ACMTransactingCustomerRef,
      I_SalesDocument._SalesDocumentType._Text[1:Language = $session.system_language].SalesDocumentTypeName as DocumentTypeDescription,

      @Consumption.hidden: true
      cast(SalesDocumentType as auart)                                                                      as SalesDocumentType,
      @Consumption.hidden: true
      cast(OrganizationDivision as spart)                                                                   as OrganizationDivision,
      @Consumption.hidden: true
      cast(SalesOrganization as vkorg)                                                                      as SalesOrganization,
      @Consumption.hidden: true
      cast(DistributionChannel as vtweg)                                                                    as DistributionChannel,
      @Consumption.hidden: true
      cast('' as vstel)                                                                                     as ShippingPoint,
      @Consumption.hidden: true
      cast('' as fkart)                                                                                     as BillingDocumentType,
      @Consumption.hidden: true
      cast('' as koart)                                                                                     as FinancialAccountType,
      @Consumption.hidden: true
      cast('' as gsber)                                                                                     as BusinessArea,
      @Consumption.hidden: true
      cast('' as fkber_long)                                                                                as FunctionalArea,
      @Consumption.hidden: true
      cast('' as fb_segment)                                                                                as Segment,
      @Consumption.hidden: true
      cast('' as vkbur )                                                                                    as SalesOffice,
      @Consumption.hidden: true
      cast('' as vkgrp )                                                                                    as SalesGroup,
      @Consumption.hidden: true
      cast('' as crmt_sales_org )                                                                           as SalesOrganizationOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_office )                                                                        as SalesOfficeOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_group )                                                                         as SalesGroupOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_service_org )                                                                         as ServiceOrganization

}
where
  OvrlItmGeneralIncompletionSts <> ''
  and
  (  SDDocumentCategory = 'C'
  or SDDocumentCategory = 'H'
  or SDDocumentCategory = 'I'
  or SDDocumentCategory = 'K'
  or SDDocumentCategory = 'L'
  or SDDocumentCategory = 'G' )

union all select from I_DeliveryDocument
association [0..1] to I_APProcessFlowDocTypeText as _APProcessFlowDocTypeText on  _APProcessFlowDocTypeText.Language     = $session.system_language
                                                                              and _APProcessFlowDocTypeText.ProcessType  = 'AR'
                                                                              and _APProcessFlowDocTypeText.DocumentType = '3' //change

{
  key cast(_APProcessFlowDocTypeText.DocumentType  as dokar)                                                         as DocumentType,
  key cast(''  as fis_bukrs)                                                                                         as CompanyCode,
  key cast(''  as fis_gjahr)                                                                                         as FiscalYear,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
  key cast(DeliveryDocument as farp_dispprocflow_belnr_d)                                                            as Documentid,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
      cast(GoodsIssueOrReceiptSlipNumber as bstnk)                                                                   as ACMTransactingCustomerRef,
      I_DeliveryDocument._DeliveryDocumentType._Text[1:Language = $session.system_language].DeliveryDocumentTypeName as DocumentTypeDescription,

      @Consumption.hidden: true
      cast('' as auart)                                                                                              as SalesDocumentType,
      @Consumption.hidden: true
      cast('' as spart)                                                                                              as OrganizationDivision,
      @Consumption.hidden: true
      cast('' as vkorg)                                                                                              as SalesOrganization,
      @Consumption.hidden: true
      cast('' as vtweg)                                                                                              as DistributionChannel,
      @Consumption.hidden: true
      cast(ShippingPoint as vstel)                                                                                   as ShippingPoint,
      @Consumption.hidden: true
      cast('' as fkart)                                                                                              as BillingDocumentType,
      @Consumption.hidden: true
      cast('' as koart)                                                                                              as FinancialAccountType,
      @Consumption.hidden: true
      cast('' as gsber)                                                                                              as BusinessArea,
      @Consumption.hidden: true
      cast('' as fkber_long)                                                                                         as FunctionalArea,
      @Consumption.hidden: true
      cast('' as fb_segment)                                                                                         as Segment,
      @Consumption.hidden: true
      cast('' as vkbur )                                                                                             as SalesOffice,
      @Consumption.hidden: true
      cast('' as vkgrp )                                                                                             as SalesGroup,
      @Consumption.hidden: true
      cast('' as crmt_sales_org )                                                                                    as SalesOrganizationOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_office )                                                                                 as SalesOfficeOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_group )                                                                                  as SalesGroupOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_service_org )                                                                                  as ServiceOrganization

}
where
     SDDocumentCategory = 'J'
  or SDDocumentCategory = 'T'

union all select from I_BillingDocument
association [0..1] to I_APProcessFlowDocTypeText as _APProcessFlowDocTypeText on  _APProcessFlowDocTypeText.Language     = $session.system_language
                                                                              and _APProcessFlowDocTypeText.ProcessType  = 'AR'
                                                                              and _APProcessFlowDocTypeText.DocumentType = '4' //change

{
  key cast(_APProcessFlowDocTypeText.DocumentType as dokar)                                                       as DocumentType,
  key cast('' as fis_bukrs)                                                                                       as CompanyCode,
  key cast('' as fis_gjahr)                                                                                       as FiscalYear,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
  key cast(BillingDocument as farp_dispprocflow_belnr_d)                                                          as Documentid,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
      cast(DocumentReferenceID as bstnk)                                                                          as ACMTransactingCustomerRef,
      I_BillingDocument._BillingDocumentType._Text[1:Language = $session.system_language].BillingDocumentTypeName as DocumentTypeDescription,

      @Consumption.hidden: true
      cast('' as auart)                                                                                           as SalesDocumentType,
      @Consumption.hidden: true
      cast('' as spart)                                                                                           as OrganizationDivision,
      @Consumption.hidden: true
      cast(SalesOrganization as vkorg)                                                                            as SalesOrganization,
      @Consumption.hidden: true
      cast('' as vtweg)                                                                                           as DistributionChannel,
      @Consumption.hidden: true
      cast('' as vstel)                                                                                           as ShippingPoint,
      @Consumption.hidden: true
      cast(BillingDocumentType as fkart)                                                                          as BillingDocumentType,
      @Consumption.hidden: true
      cast('' as koart)                                                                                           as FinancialAccountType,
      @Consumption.hidden: true
      cast('' as gsber)                                                                                           as BusinessArea,
      @Consumption.hidden: true
      cast('' as fkber_long)                                                                                      as FunctionalArea,
      @Consumption.hidden: true
      cast('' as fb_segment)                                                                                      as Segment,
      @Consumption.hidden: true
      cast('' as vkbur )                                                                                          as SalesOffice,
      @Consumption.hidden: true
      cast('' as vkgrp )                                                                                          as SalesGroup,
      @Consumption.hidden: true
      cast('' as crmt_sales_org )                                                                                 as SalesOrganizationOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_office )                                                                              as SalesOfficeOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_group )                                                                               as SalesGroupOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_service_org )                                                                               as ServiceOrganization

}

union all select distinct from I_OperationalAcctgDocItem
association [0..1] to I_APProcessFlowDocTypeText as _APProcessFlowDocTypeText on  _APProcessFlowDocTypeText.Language     = $session.system_language
                                                                              and _APProcessFlowDocTypeText.ProcessType  = 'AR'
                                                                              and _APProcessFlowDocTypeText.DocumentType = '5' //change

{
  key _APProcessFlowDocTypeText.DocumentType                                                                                                              as DocumentType,
  key CompanyCode                                                                                                                                         as CompanyCode,
  key cast(FiscalYear  as fis_gjahr)                                                                                                                      as FiscalYear,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
  key cast(AccountingDocument as farp_dispprocflow_belnr_d)                                                                                               as Documentid,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
      cast(_JournalEntry.DocumentReferenceID as bstnk)                                                                                                    as ACMTransactingCustomerRef,
      cast(_JournalEntry._AccountingDocumentType._Text[1:Language = $session.system_language].AccountingDocumentTypeName as fap_dispprocflow_doctype_txt) as DocumentTypeDescription,

      @Consumption.hidden: true
      cast('' as auart)                                                                                                                                   as SalesDocumentType,
      @Consumption.hidden: true
      cast('' as spart)                                                                                                                                   as OrganizationDivision,
      @Consumption.hidden: true
      cast('' as vkorg)                                                                                                                                   as SalesOrganization,
      @Consumption.hidden: true
      cast('' as vtweg)                                                                                                                                   as DistributionChannel,
      @Consumption.hidden: true
      cast('' as vstel)                                                                                                                                   as ShippingPoint,
      @Consumption.hidden: true
      cast('' as fkart)                                                                                                                                   as BillingDocumentType,
      @Consumption.hidden: true
      cast(FinancialAccountType as koart)                                                                                                                 as FinancialAccountType,
      @Consumption.hidden: true
      cast(BusinessArea as gsber)                                                                                                                         as BusinessArea,
      @Consumption.hidden: true
      cast(FunctionalArea as fkber_long)                                                                                                                  as FunctionalArea,
      @Consumption.hidden: true
      cast(Segment as fb_segment)                                                                                                                         as Segment,
      @Consumption.hidden: true
      cast('' as vkbur )                                                                                                                                  as SalesOffice,
      @Consumption.hidden: true
      cast('' as vkgrp )                                                                                                                                  as SalesGroup,
      @Consumption.hidden: true
      cast('' as crmt_sales_org )                                                                                                                         as SalesOrganizationOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_office )                                                                                                                      as SalesOfficeOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_group )                                                                                                                       as SalesGroupOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_service_org )                                                                                                                       as ServiceOrganization

}
where
      FinancialAccountType = 'D'
  and ClearingAccountingDocument != AccountingDocument

union all select distinct from I_OperationalAcctgDocItem
association [0..1] to I_APProcessFlowDocTypeText as _APProcessFlowDocTypeText on  _APProcessFlowDocTypeText.Language     = $session.system_language
                                                                              and _APProcessFlowDocTypeText.ProcessType  = 'AR'
                                                                              and _APProcessFlowDocTypeText.DocumentType = '6' //change

{
  key cast(_APProcessFlowDocTypeText.DocumentType as dokar)                                                                                               as DocumentType,
  key CompanyCode                                                                                                                                         as CompanyCode,
  key cast(FiscalYear as fis_gjahr)                                                                                                                       as FiscalYear,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
  key cast(AccountingDocument as farp_dispprocflow_belnr_d)                                                                                               as Documentid,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
      cast(_JournalEntry.DocumentReferenceID as bstnk)                                                                                                    as ACMTransactingCustomerRef,
      cast(_JournalEntry._AccountingDocumentType._Text[1:Language = $session.system_language].AccountingDocumentTypeName as fap_dispprocflow_doctype_txt) as DocumentTypeDescription,

      @Consumption.hidden: true
      cast('' as auart)                                                                                                                                   as SalesDocumentType,
      @Consumption.hidden: true
      cast('' as spart)                                                                                                                                   as OrganizationDivision,
      @Consumption.hidden: true
      cast('' as vkorg)                                                                                                                                   as SalesOrganization,
      @Consumption.hidden: true
      cast('' as vtweg)                                                                                                                                   as DistributionChannel,
      @Consumption.hidden: true
      cast('' as vstel)                                                                                                                                   as ShippingPoint,
      @Consumption.hidden: true
      cast('' as fkart)                                                                                                                                   as BillingDocumentType,
      @Consumption.hidden: true
      cast(FinancialAccountType as koart)                                                                                                                 as FinancialAccountType,
      @Consumption.hidden: true
      cast(BusinessArea as gsber)                                                                                                                         as BusinessArea,
      @Consumption.hidden: true
      cast(FunctionalArea as fkber_long)                                                                                                                  as FunctionalArea,
      @Consumption.hidden: true
      cast(Segment as fb_segment)                                                                                                                         as Segment,
      @Consumption.hidden: true
      cast('' as vkbur )                                                                                                                                  as SalesOffice,
      @Consumption.hidden: true
      cast('' as vkgrp )                                                                                                                                  as SalesGroup,
      @Consumption.hidden: true
      cast('' as crmt_sales_org )                                                                                                                         as SalesOrganizationOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_office )                                                                                                                      as SalesOfficeOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_group )                                                                                                                       as SalesGroupOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_service_org )                                                                                                                       as ServiceOrganization

}
where
      FinancialAccountType       = 'D'
  and ClearingAccountingDocument = AccountingDocument

union all select from I_ServiceDocument
association [0..1] to I_APProcessFlowDocTypeText as _APProcessFlowDocTypeText on  _APProcessFlowDocTypeText.Language     = $session.system_language
                                                                              and _APProcessFlowDocTypeText.ProcessType  = 'AR'
                                                                              and _APProcessFlowDocTypeText.DocumentType = '7' 
{
  key cast(_APProcessFlowDocTypeText.DocumentType  as dokar)                                                                         as DocumentType,
  key cast('' as fis_bukrs)                                                                                                          as CompanyCode,
  key cast('' as fis_gjahr)                                                                                                          as FiscalYear,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
  key cast(ServiceDocument as farp_dispprocflow_belnr_d)                                                                             as Documentid,
      cast(PurchaseOrderByCustomer as bstnk)                                                                                         as ACMTransactingCustomerRef,
      I_ServiceDocument._ServiceDocumentType._ServiceDocumentTypeText[1:Language = $session.system_language].ServiceDocumentTypeName as DocumentTypeDescription,

      @Consumption.hidden: true
      cast(ServiceDocumentType as auart)                                                                                             as SalesDocumentType,
      @Consumption.hidden: true
      cast(Division as spart)                                                                                                        as OrganizationDivision,
      @Consumption.hidden: true
      cast(SalesOrganization as vkorg)                                                                                               as SalesOrganization,
      @Consumption.hidden: true
      cast(DistributionChannel as vtweg)                                                                                             as DistributionChannel,
      @Consumption.hidden: true
      cast('' as vstel)                                                                                                              as ShippingPoint,
      @Consumption.hidden: true
      cast('' as fkart)                                                                                                              as BillingDocumentType,
      @Consumption.hidden: true
      cast('' as koart)                                                                                                              as FinancialAccountType,
      @Consumption.hidden: true
      cast('' as gsber)                                                                                                              as BusinessArea,
      @Consumption.hidden: true
      cast('' as fkber_long)                                                                                                         as FunctionalArea,
      @Consumption.hidden: true
      cast('' as fb_segment)                                                                                                         as Segment,      
      @Consumption.hidden: true
      cast(SalesOffice as vkbur )                                                                                                    as SalesOffice,
      @Consumption.hidden: true
      cast(SalesGroup as vkgrp )                                                                                                     as SalesGroup,
      @Consumption.hidden: true
      cast(SalesOrganizationOrgUnitID as crmt_sales_org )                                                                            as SalesOrganizationOrgUnitID,
      @Consumption.hidden: true
      cast(SalesOfficeOrgUnitID as crmt_sales_office )                                                                               as SalesOfficeOrgUnitID,
      @Consumption.hidden: true
      cast(SalesGroupOrgUnitID as crmt_sales_group )                                                                                 as SalesGroupOrgUnitID,
      @Consumption.hidden: true
      cast(ServiceOrganization as crmt_service_org )                                                                                 as ServiceOrganization 

}
where
      ServiceObjectType           = 'BUS2000112'
  and ServiceDocumentTemplateType = ''
  
union all select from I_BillingDocumentBasic
association [0..1] to I_APProcessFlowDocTypeText as _APProcessFlowDocTypeText on  _APProcessFlowDocTypeText.Language     = $session.system_language
                                                                              and _APProcessFlowDocTypeText.ProcessType  = 'AR'
                                                                              and _APProcessFlowDocTypeText.DocumentType = '8' 
{
  key cast(_APProcessFlowDocTypeText.DocumentType  as dokar)                                                                         as DocumentType,
  key cast('' as fis_bukrs)                                                                                                          as CompanyCode,
  key cast('' as fis_gjahr)                                                                                                          as FiscalYear,
      @Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
  key cast(BillingDocument as farp_dispprocflow_belnr_d)                                                                             as Documentid,
      cast(PurchaseOrderByCustomer as bstnk)                                                                                         as ACMTransactingCustomerRef,
      I_BillingDocumentBasic._BillingDocumentType._Text[1:Language = $session.system_language].BillingDocumentTypeName               as DocumentTypeDescription,

      @Consumption.hidden: true
      cast(BillingDocumentType as auart)                                                                                             as SalesDocumentType,
      @Consumption.hidden: true
      cast(Division as spart)                                                                                                        as OrganizationDivision,
      @Consumption.hidden: true
      cast(SalesOrganization as vkorg)                                                                                               as SalesOrganization,
      @Consumption.hidden: true
      cast(DistributionChannel as vtweg)                                                                                             as DistributionChannel,
      @Consumption.hidden: true
      cast('' as vstel)                                                                                                              as ShippingPoint,
      @Consumption.hidden: true
      cast(BillingDocumentType as fkart)                                                                                             as BillingDocumentType,
      @Consumption.hidden: true
      cast('' as koart)                                                                                                              as FinancialAccountType,
      @Consumption.hidden: true
      cast('' as gsber)                                                                                                              as BusinessArea,
      @Consumption.hidden: true
      cast('' as fkber_long)                                                                                                         as FunctionalArea,
      @Consumption.hidden: true
      cast('' as fb_segment)                                                                                                         as Segment,
      @Consumption.hidden: true
      cast('' as vkbur )                                                                                                             as SalesOffice,
      @Consumption.hidden: true
      cast('' as vkgrp )                                                                                                             as SalesGroup,
      @Consumption.hidden: true
      cast('' as crmt_sales_org )                                                                                                    as SalesOrganizationOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_office )                                                                                                 as SalesOfficeOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_sales_group )                                                                                                  as SalesGroupOrgUnitID,
      @Consumption.hidden: true
      cast('' as crmt_service_org )                                                                                                  as ServiceOrganization

}
where
      SDDocumentCategory = 'EBDR'