C_SlsDocFlfmtSlsDoc

DDL: C_SLSDOCFLFMTSLSDOC SQL: CSOFSLSDOC Type: view CONSUMPTION

Sales Doc Fulfillment: Sales Document

C_SlsDocFlfmtSlsDoc is a Consumption CDS View that provides data about "Sales Doc Fulfillment: Sales Document" in SAP S/4HANA. It reads from 1 data source (I_SalesDocument) and exposes 151 fields with key field SalesDocument. It has 2 associations to related views.

Data Sources (1)

SourceAliasJoin Type
I_SalesDocument SalesDocument from

Associations (2)

CardinalityTargetAliasCondition
[0..1] I_SalesDocumentRjcnReason _SalesDocumentRjcnReason $projection.SalesDocumentRjcnReason = _SalesDocumentRjcnReason.SalesDocumentRjcnReason
[0..1] E_SalesDocumentBasic _Extension $projection.SalesDocument = _Extension.SalesDocument

Annotations (12)

NameValueLevelField
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.representativeKey SalesDocument view
EndUserText.label Sales Doc Fulfillment: Sales Document view
VDM.viewType #CONSUMPTION view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #BLOCKED_DATA_EXCLUDED view
AbapCatalog.preserveKey true view
AbapCatalog.sqlViewName CSOFSLSDOC view

Fields (151)

KeyFieldSource TableSource FieldDescription
KEY SalesDocument SalesDocument
SDDocumentCategory I_SalesDocument SDDocumentCategory
SalesDocumentType I_SalesDocument SalesDocumentType
SalesDocumentProcessingType I_SalesDocument SalesDocumentProcessingType
SalesOrganization I_SalesDocument SalesOrganization
DistributionChannel I_SalesDocument DistributionChannel
OrganizationDivision I_SalesDocument OrganizationDivision
SalesGroup I_SalesDocument SalesGroup
SalesOffice I_SalesDocument SalesOffice
TotalNetAmount I_SalesDocument TotalNetAmount
TransactionCurrency I_SalesDocument TransactionCurrency
CustomerPaymentTerms I_SalesDocument CustomerPaymentTerms
PurchaseOrderByCustomer I_SalesDocument PurchaseOrderByCustomer
CreditSegment
NextCreditCheckDate I_SalesDocument NextCreditCheckDate
RequestedDeliveryDate I_SalesDocument RequestedDeliveryDate
ShippingType I_SalesDocument ShippingType
ShippingCondition I_SalesDocument ShippingCondition
IncotermsClassification I_SalesDocument IncotermsClassification
IncotermsLocation1 I_SalesDocument IncotermsLocation1
IncotermsLocation2 I_SalesDocument IncotermsLocation2
IncotermsVersion I_SalesDocument IncotermsVersion
CompleteDeliveryIsDefined I_SalesDocument CompleteDeliveryIsDefined
DeliveryBlockReason I_SalesDocument DeliveryBlockReason
BillingDocumentDate I_SalesDocument BillingDocumentDate
HeaderBillingBlockReason I_SalesDocument HeaderBillingBlockReason
PaymentPlan I_SalesDocument PaymentPlan
PaymentCardIsBlockedForAuthzn _PaymentPlan PaymentCardIsBlockedForAuthzn
OverallSDProcessStatus I_SalesDocument OverallSDProcessStatus
SalesDocApprovalStatus I_SalesDocument SalesDocApprovalStatus
OverallPurchaseConfStatus
OverallSDDocumentRejectionSts I_SalesDocument OverallSDDocumentRejectionSts
OverallTotalDeliveryStatus I_SalesDocument OverallTotalDeliveryStatus
OverallOrdReltdBillgStatus I_SalesDocument OverallOrdReltdBillgStatus
HdrGeneralIncompletionStatus I_SalesDocument HdrGeneralIncompletionStatus
HeaderDelivIncompletionStatus I_SalesDocument HeaderDelivIncompletionStatus
OverallPricingIncompletionSts I_SalesDocument OverallPricingIncompletionSts
HeaderBillgIncompletionStatus I_SalesDocument HeaderBillgIncompletionStatus
OvrlItmGeneralIncompletionSts I_SalesDocument OvrlItmGeneralIncompletionSts
OvrlItmBillingIncompletionSts I_SalesDocument OvrlItmBillingIncompletionSts
OvrlItmDelivIncompletionSts I_SalesDocument OvrlItmDelivIncompletionSts
CentralCreditCheckStatus
FinDocCreditCheckStatus I_SalesDocument FinDocCreditCheckStatus
ExprtInsurCreditCheckStatus I_SalesDocument ExprtInsurCreditCheckStatus
PaytAuthsnCreditCheckSts I_SalesDocument PaytAuthsnCreditCheckSts
CtrlgObjStatusIsDeliveryBlkd
CtrlgObjStatusIsBillingBlkd
OverallChmlCmplncStatus
OverallDangerousGoodsStatus
OverallSafetyDataSheetStatus
OverallTrdCmplncEmbargoSts
OvrlTrdCmplncSnctndListChkSts
OvrlTrdCmplncLegalCtrlChkSts
SoldToParty
SoldToPartyName
SoldToPartyFullName
SoldToPartyFullNameNEW
AddressID
AddressID SoldToPartyAddressInfo AddressID
AddressObjectType SoldToPartyAddressInfo AddressObjectType
AddressPersonID SoldToPartyAddressInfo AddressPersonID
ShipToParty
ShipToPartyName
ShipToPartyCountry
ShipToPartyCountryName
AddressIDasShipToPartyAddressID
AddressIDasShipToPartyAddressID
ShipToPartyAddressObjectType ShipToPartyAddressInfo AddressObjectType
ShipToPartyAddressPersonID ShipToPartyAddressInfo AddressPersonID
ResponsibleEmployee
ResponsibleEmployeeName
BillToParty Partner BillToParty
BillToPartyName
PayerParty Partner PayerParty
PayerPartyName
BusinessPartner
CustomerClassification
CustomerProject
CustomerProjectName
BusinessSolutionOrder I_SalesDocument BusinessSolutionOrder
BillingCompanyCode BillingCompanyCode
int1asSalesDocApprovalStsCriticality
int1asHdrGenIncompltnStsCriticality
int1asHdrDelivIncompltnStsCritlty
int1asHdrBillgIncompltnStsCritlty
int1asOvrlItmGenIncompltnStsCritlty
int1asOvrlItmDelivIncompltnCritlty
int1asOvrlItmBillgIncompltnCritlty
int1asOvrlPrcgIncompltnStsCritlty
int1asCtrlgObjStsIsDelivBlkdCritlty
int1asDeliveryBlockReasonCriticality
int1asCtrlgObjStsIsBillgBlkdCritlty
int1asHdrBillgBlockReasonCriticality
int1asCentralCreditChkStsCriticality
int1asPaytAuthCrdtChkStsCriticality
int1asFinDocCrdtCheckStsCriticality
int1asExprtInsurCrdtChkStsCritlty
int1asOvrlChmlCmplncStsCriticality
int1asOvrlDngrsGdsStsCriticality
int1asOvrlSftyDataSheetStsCritlty
int1asOvrlTrdCmplncEmbargoStsCritlty
int1asOvrlTrdCmplncSnctndListCritlty
int1asOvrlTrdCmplncLglCtrlStsCritlty
int1asPurchaseConfStatusCriticality
SalesDocumentRjcnReason
SalesDocApprovalReason
TradeComplianceIsActive
_SDDocumentCategory _SDDocumentCategory
_SalesDocumentType _SalesDocumentType
_SalesOrganization _SalesOrganization
_DistributionChannel _DistributionChannel
_OrganizationDivision _OrganizationDivision
_SalesGroup _SalesGroup
_SalesOffice _SalesOffice
_CustomerPaymentTerms _CustomerPaymentTerms
_SalesArea _SalesArea
_CreditSegment
_TransactionCurrency _TransactionCurrency
_ShippingType _ShippingType
_ShippingCondition _ShippingCondition
_IncotermsClassification _IncotermsClassification
_IncotermsVersion _IncotermsVersion
_DeliveryBlockReason _DeliveryBlockReason
_HeaderBillingBlockReason _HeaderBillingBlockReason
_OverallSDProcessStatus _OverallSDProcessStatus
_SalesDocApprovalStatus _SalesDocApprovalStatus
_OverallPurchaseConfStatus _OverallPurchaseConfStatus
_OverallSDDocumentRejectionSts _OverallSDDocumentRejectionSts
_OverallTotalDeliveryStatus _OverallTotalDeliveryStatus
_OverallOrdReltdBillgStatus _OverallOrdReltdBillgStatus
_HdrGeneralIncompletionStatus _HdrGeneralIncompletionStatus
_HeaderDelivIncompletionStatus _HeaderDelivIncompletionStatus
_OverallPricingIncompletionSts _OverallPricingIncompletionSts
_HeaderBillgIncompletionStatus _HeaderBillgIncompletionStatus
_OvrlItmGeneralIncompletionSts _OvrlItmGeneralIncompletionSts
_OvrlItmBillingIncompletionSts _OvrlItmBillingIncompletionSts
_OvrlItmDelivIncompletionSts _OvrlItmDelivIncompletionSts
_CentralCreditCheckStatus _CentralCreditCheckStatus
_FinDocCreditCheckStatus _FinDocCreditCheckStatus
_ExprtInsurCreditCheckStatus _ExprtInsurCreditCheckStatus
_PaytAuthsnCreditCheckSts _PaytAuthsnCreditCheckSts
_OverallChmlCmplncStatus _OverallChmlCmplncStatus
_OverallDangerousGoodsStatus _OverallDangerousGoodsStatus
_OvrlSftyDataSheetSts _OvrlSftyDataSheetSts
_OvrlTradeCmplncEmbargoStatus _OvrlTradeCmplncEmbargoStatus
_OvTrdCmplncSnctndListChkSts _OvTrdCmplncSnctndListChkSts
_OvrlTrdCmplncLegalCtrlChkSts _OvrlTrdCmplncLegalCtrlChkSts
_CustomerClassification
_CreditMgmt _CreditMgmt
_SalesDocumentRjcnReason _SalesDocumentRjcnReason
_SalesDocApprovalReason _SalesDocApprovalReason
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #MIXED 
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #S
@ObjectModel.representativeKey: 'SalesDocument'

@EndUserText.label: 'Sales Doc Fulfillment: Sales Document'
@VDM.viewType: #CONSUMPTION
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED
@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName: 'CSOFSLSDOC'

define view C_SlsDocFlfmtSlsDoc

as select from I_SalesDocument as SalesDocument 

left outer to one join I_SDDocStandardPartner   as Partner
           on SalesDocument.SalesDocument = Partner.SDDocument 
           
           
left outer to one join  I_SDDocumentCompletePartners     as SoldToPartyAddressInfo      on SalesDocument.SalesDocument = SoldToPartyAddressInfo.SDDocument 
                                                                                        and SoldToPartyAddressInfo.SDDocumentItem = '000000'
                                                                                        and SoldToPartyAddressInfo.PartnerFunction = 'AG'   
           
left outer to one join  I_SDDocumentCompletePartners     as ShipToPartyAddressInfo      on SalesDocument.SalesDocument = ShipToPartyAddressInfo.SDDocument --AT 21.09.2018: new CE1902
                                                                                        and ShipToPartyAddressInfo.SDDocumentItem = '000000'
                                                                                        and ShipToPartyAddressInfo.PartnerFunction = 'WE'   
      
//Association

association[0..1] to I_PaymentPlan as _PaymentPlan
on $projection.PaymentPlan = _PaymentPlan.PaymentPlan 

association[0..1] to C_SlsDocFlfmtCreditMgmt as _CreditMgmt
on $projection.creditsegment        = _CreditMgmt.CreditSegment and
   $projection.BusinessPartner      = _CreditMgmt.BusinessPartner 
              
association[0..1] to I_SDDocCtrlgObjStsBlkdInfo as _ConObjStatusDelBlocked
on SalesDocument.ControllingObject                        = _ConObjStatusDelBlocked.ControllingObject and
   _ConObjStatusDelBlocked.BusinessTransactionType      = 'SDDN' and
   _ConObjStatusDelBlocked.BusTransacExecutionAllowance = '3' and
   _ConObjStatusDelBlocked.ControllingObjectCategory    = 'VBK' and
   not _ConObjStatusDelBlocked.StatusIsInactive         = 'X'

association[0..1] to I_SDDocCtrlgObjStsBlkdInfo as _ConObjStatusBillgBlocked  
on SalesDocument.ControllingObject                          = _ConObjStatusBillgBlocked.ControllingObject and
   _ConObjStatusBillgBlocked.BusinessTransactionType      = 'SDIN' and
   _ConObjStatusBillgBlocked.BusTransacExecutionAllowance = '3' and
   _ConObjStatusBillgBlocked.ControllingObjectCategory    = 'VBK' and
   not _ConObjStatusBillgBlocked.StatusIsInactive         = 'X' 

association [0..1] to I_SalesDocumentRjcnReason     as _SalesDocumentRjcnReason     
on  $projection.SalesDocumentRjcnReason = _SalesDocumentRjcnReason.SalesDocumentRjcnReason
   
//Extensibility

association [0..1] to E_SalesDocumentBasic as _Extension on $projection.SalesDocument = _Extension.SalesDocument               
     
{ 
   key SalesDocument,

   SalesDocument.SDDocumentCategory,
   SalesDocument.SalesDocumentType,
   @UI.hidden: true
   SalesDocument.SalesDocumentProcessingType,   
   
   // Semantic Object

   @UI.hidden: true 
   cast(
   case 
     when  SalesDocument.SDDocumentCategory = 'C'
     then  'SalesOrder'
     when  SalesDocument.SDDocumentCategory = 'I'
     then  'SalesOrderWithoutCharge'
     when  SalesDocument.SDDocumentCategory = 'L'
     then  'DebitMemoRequest'
   end   
   as  char30 )
   as SemanticObject,   
    
   //Organization

   SalesDocument.SalesOrganization,
   SalesDocument.DistributionChannel,
   SalesDocument.OrganizationDivision,   
   
   SalesDocument.SalesGroup,
   SalesDocument.SalesOffice,   
            
   //Sales

   @DefaultAggregation: #NONE
   @Semantics.amount.currencyCode: 'TransactionCurrency'
   SalesDocument.TotalNetAmount,
   @Semantics.currencyCode: true
   SalesDocument.TransactionCurrency,
 
   SalesDocument.CustomerPaymentTerms,
   SalesDocument.PurchaseOrderByCustomer,
   @ObjectModel.foreignKey.association: '_CreditSegment'
   SalesDocument._CreditControlArea._CreditControlArea2Segment.CreditSegment,
   SalesDocument.NextCreditCheckDate,
         
   //Shipping

   SalesDocument.RequestedDeliveryDate,
   SalesDocument.ShippingType,
   SalesDocument.ShippingCondition,
   SalesDocument.IncotermsClassification,
   SalesDocument.IncotermsLocation1,
   SalesDocument.IncotermsLocation2,
   SalesDocument.IncotermsVersion,
   SalesDocument.CompleteDeliveryIsDefined,
   SalesDocument.DeliveryBlockReason,
   
   //Billing

   SalesDocument.BillingDocumentDate,
   SalesDocument.HeaderBillingBlockReason,
   
   //PaymentCardPlan

   SalesDocument.PaymentPlan,
   _PaymentPlan.PaymentCardIsBlockedForAuthzn,

   // Status

   SalesDocument.OverallSDProcessStatus,  
   SalesDocument.SalesDocApprovalStatus,
   @ObjectModel.foreignKey.association: '_OverallPurchaseConfStatus'
   cast(SalesDocument.OverallPurchaseConfStatus as totpurchaseconfsts preserving type ) as OverallPurchaseConfStatus,
   SalesDocument.OverallSDDocumentRejectionSts,
   SalesDocument.OverallTotalDeliveryStatus,
   SalesDocument.OverallOrdReltdBillgStatus,
   SalesDocument.HdrGeneralIncompletionStatus,     
   SalesDocument.HeaderDelivIncompletionStatus,
   SalesDocument.OverallPricingIncompletionSts,
   SalesDocument.HeaderBillgIncompletionStatus,
   SalesDocument.OvrlItmGeneralIncompletionSts,
   SalesDocument.OvrlItmBillingIncompletionSts,
   SalesDocument.OvrlItmDelivIncompletionSts, 
   @ObjectModel.foreignKey.association: '_CentralCreditCheckStatus'
   cast(SalesDocument.CentralCreditCheckStatus as central_credit_check_status preserving type) as  CentralCreditCheckStatus,
   SalesDocument.FinDocCreditCheckStatus,
   SalesDocument.ExprtInsurCreditCheckStatus,
   SalesDocument.PaytAuthsnCreditCheckSts,
   cast( _ConObjStatusDelBlocked.CtrlgObjStatusIsDeliveryBlkd as user_status_deliv_block preserving type ) as CtrlgObjStatusIsDeliveryBlkd,
   cast( _ConObjStatusBillgBlocked.CtrlgObjStatusIsBillingBlkd  as user_status_inv_block preserving type ) as CtrlgObjStatusIsBillingBlkd,
   @ObjectModel.foreignKey.association: '_OverallChmlCmplncStatus'
   cast(SalesDocument.OverallChmlCmplncStatus as mon_tdd_total_pcsta preserving type) as OverallChmlCmplncStatus,
   @ObjectModel.foreignKey.association: '_OverallDangerousGoodsStatus'
   cast(SalesDocument.OverallDangerousGoodsStatus as mon_tdd_total_dgsta preserving type) as OverallDangerousGoodsStatus,
   @ObjectModel.foreignKey.association: '_OvrlSftyDataSheetSts'   
   cast(SalesDocument.OverallSafetyDataSheetStatus as mon_tdd_total_sdssta preserving type) as OverallSafetyDataSheetStatus,   
   @ObjectModel.foreignKey.association: '_OvrlTradeCmplncEmbargoStatus'
   cast(SalesDocument.OverallTrdCmplncEmbargoSts as totembargochksts preserving type) as OverallTrdCmplncEmbargoSts, 
   @ObjectModel.foreignKey.association: '_OvTrdCmplncSnctndListChkSts'
   cast(SalesDocument.OvrlTrdCmplncSnctndListChkSts as totwatchlistscrngchksts preserving type) as OvrlTrdCmplncSnctndListChkSts, 
   @ObjectModel.foreignKey.association: '_OvrlTrdCmplncLegalCtrlChkSts'
   cast(SalesDocument.OvrlTrdCmplncLegalCtrlChkSts as totlglctrlchksts preserving type) as OvrlTrdCmplncLegalCtrlChkSts,            
         
   //Partner 

   --@ObjectModel.text.element:  [ 'SoldToPartyName' ] --AT NK 18.10.2021 Change reference to also cover OTC
   @ObjectModel.text.element:  [ 'SoldToPartyFullName' ]   
   SalesDocument.SoldToParty,
   @Semantics.text: true  
   cast (Partner._SoldToParty.CustomerName as vdm_sold_to_name)                         as SoldToPartyName,
   //cast(SoldToPartyAddressInfo.PartnerIsOneTimeAccount as  isonetimeaccountsoldtoparty) as SoldToPartyIsOneTimeAccount,

   
   
-- AT17.05.2021: changes for BP Adoption (CE2108)    --*FullName
   --cast(SoldToPartyAddressInfo._Address.FullName as fullnamesoldtoparty)                as SoldToPartyFullName,    
   @ObjectModel.readOnly: true
   @ObjectModel.virtualElement: true
   @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SOF_FULLNAME'
   cast( '' as fullnamesoldtoparty )                                      as SoldToPartyFullName,       
   --cast(SoldToPartyAddressInfo._DfltAddrRprstn.AddresseeFullName as fullnamesoldtoparty)                as SoldToPartyFullNameNEW, --naive design for performance evaluation
-- AT17.05.2021: end

-- AT17.05.2021: changes for BP Adoption (CE2108)    --*FormattedAddress
   --SoldToPartyAddressInfo._Address.AddressID,
   SoldToPartyAddressInfo.AddressID,
   SoldToPartyAddressInfo.AddressObjectType,
   SoldToPartyAddressInfo.AddressPersonID,
   @ObjectModel.readOnly: true
   @ObjectModel.virtualElement: true
   @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SOF_ADDRESS'  
   cast( ' ' as formattedaddresssoldtoparty  )as SoldToPartyFormattedAddress,
-- AT17.05.2021: end

-- @ObjectModel.text.element:  [ 'ShipToPartyName' ] --AT NK 18.10.2021 Change reference to also cover OTC
   @ObjectModel.text.element:  [ 'ShipToPartyFullName' ]
   Partner.ShipToParty,  
   @Semantics.text: true  
   cast (Partner._ShipToParty.CustomerName as ship_to_name) as ShipToPartyName, 
   
-- AT17.05.2021: changes for BP Adoption (CE2108)    --*FullName   
   --cast(ShipToPartyAddressInfo._Address.FullName as fullnameshiptoparty)       as ShipToPartyFullName,    --AT 20.09.2018: new CE1902
   @ObjectModel.readOnly: true
   @ObjectModel.virtualElement: true
   @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SOF_FULLNAME'
   cast( '' as fullnameshiptoparty )                                      as ShipToPartyFullName,
-- AT17.05.2021: end      
  
   @ObjectModel.text.element: [ 'ShipToPartyCountryName' ]
-- AT01.10.2021: changes for BP Adoption (CE2202)    
   ----cast (Partner._ShipToParty._StandardAddress.Country as shiptopartycountry)  as ShipToPartyCountry, --AT9.6.2021 case 336990 CE2108
   --cast (ShipToPartyAddressInfo._Address.Country as shiptopartycountry)  as ShipToPartyCountry,    
   @ObjectModel.readOnly: true
   @ObjectModel.virtualElement: true
   @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SOF_COUNTRYNAME'
   cast( '' as shiptopartycountry )                                      as ShipToPartyCountry   ,    
-- AT01.10.2021: end
         
   @Semantics.text: true 
-- AT01.10.2021: changes for BP Adoption (CE2202)   
   ----cast (Partner._ShipToParty._StandardAddress._Country._Text[1: Language = $session.system_language].CountryName as shiptopartycountryname)  as ShipToPartyCountryName, --AT9.6.2021 case 336990 CE2108   
   --cast (ShipToPartyAddressInfo._Address._Country._Text[1: Language = $session.system_language].CountryName as shiptopartycountryname)  as ShipToPartyCountryName,       
   @ObjectModel.readOnly: true
   @ObjectModel.virtualElement: true
   @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SOF_COUNTRYNAME'
   cast( '' as shiptopartycountryname )                                      as ShipToPartyCountryName   ,    
-- AT01.10.2021: end    
    
-- AT17.05.2021: changes for BP Adoption (CE2108)    --*FormattedAddress
-- ShipToPartyAddressInfo._Address.AddressID as ShipToPartyAddressID,                                     --AT 29.09.2018: new CE1902
   ShipToPartyAddressInfo.AddressID as ShipToPartyAddressID,
   ShipToPartyAddressInfo.AddressObjectType as ShipToPartyAddressObjectType,
   ShipToPartyAddressInfo.AddressPersonID as ShipToPartyAddressPersonID,
   @ObjectModel.readOnly: true
   @ObjectModel.virtualElement: true
   @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SOF_ADDRESS'
   cast( ' ' as formattedaddressshiptoparty  )as ShipToPartyFormattedAddress,                             --AT 29.09.2018: new CE1902
-- AT17.05.2021: end  
  
   @ObjectModel.text.element:  [ 'ResponsibleEmployeeName' ]
   Partner.ResponsibleEmployee,
   @Semantics.text: true   
   cast (Partner._ResponsibleEmployee.PersonFullName  as resp_empl_name) as ResponsibleEmployeeName,
   
   @ObjectModel.text.element:  [ 'BillToPartyName' ]
   Partner.BillToParty,
   @Semantics.text: true  
   cast (Partner._BillToParty.CustomerName as bill_to_name) as BillToPartyName, 

   @ObjectModel.text.element:  [ 'PayerPartyName' ]
   Partner.PayerParty,
   @Semantics.text: true   
   cast (Partner._PayerParty.CustomerName as payer_name) as PayerPartyName,
   
   //Payer Business Partner to read Credit Management Data

   Partner._PayerParty._CustomerToBusinessPartner._BusinessPartner.BusinessPartner as BusinessPartner,
   
   SalesDocument._SoldToParty.CustomerClassification, 
   
   //Project assignment

   @ObjectModel.text.element:  [ 'CustomerProjectName' ]
   SalesDocument._EngagementProjectItem.EngagementProject as CustomerProject,
   @Semantics.text: true
   SalesDocument._EngagementProjectItem._EngagementProject.EngagementProjectName as CustomerProjectName,  
   
   // Solution Order

   @UI.hidden: true
   SalesDocument.BusinessSolutionOrder,
   
   BillingCompanyCode,
   
   // Criticality

    @UI.hidden: true  
    cast(
    case
    when SalesDocApprovalStatus  = 'B'                                    then  3 // Released

    when SalesDocApprovalStatus  = 'A' or
         SalesDocApprovalStatus  = 'D '                                   then  2 // In Approval, To Be Reworked

    when SalesDocApprovalStatus  = 'C'                                    then  1 // Rejected

                                                                          else  0 // Not relevant

    end  as abap.int1
      )   as SalesDocApprovalStsCriticality,
    
    @UI.hidden: true    
    cast(  
    case
    when HdrGeneralIncompletionStatus = 'C'                               then 3 // C - Complete

                                                                          else 1  
    end as abap.int1
    )    as HdrGenIncompltnStsCriticality,
     
    @UI.hidden: true      
    cast(
    case
    when HeaderDelivIncompletionStatus = 'C'                              then 3 // C - Complete

                                                                          else 1  
    end as abap.int1
    )    as HdrDelivIncompltnStsCritlty,
     
    @UI.hidden: true      
    cast(
    case
    when HeaderBillgIncompletionStatus = 'C'                              then 3 // C - Complete  

                                                                          else 1  
    end as abap.int1
    )    as HdrBillgIncompltnStsCritlty,
     
     
    @UI.hidden: true      
    cast(
    case
    when OvrlItmGeneralIncompletionSts = 'C'                              then 3 // C - All Items Complete  

                                                                          else 1  
    end as abap.int1
    )    as OvrlItmGenIncompltnStsCritlty,
     
    @UI.hidden: true      
    cast(
    case
    when OvrlItmDelivIncompletionSts = 'C'                                then 3 // C - All Items Complete    

                                                                          else 1  
    end as abap.int1
    )    as OvrlItmDelivIncompltnCritlty,
     
    @UI.hidden: true      
    cast(
    case
    when OvrlItmBillingIncompletionSts = 'C'                              then 3 // C - All Items Complete  

                                                                          else 1  
    end as abap.int1
    )    as OvrlItmBillgIncompltnCritlty,
     
    @UI.hidden: true      
    cast(
    case
    when OverallPricingIncompletionSts = 'C'                              then 3 // C - All Items Complete    

                                                                          else 1  
    end as abap.int1
    )    as OvrlPrcgIncompltnStsCritlty,
     
    @UI.hidden: true      
    cast(
    case
    when _ConObjStatusDelBlocked.CtrlgObjStatusIsDeliveryBlkd = 'X'       then 1  //boolean

                                                                          else 3  
    end as abap.int1
    )    as CtrlgObjStsIsDelivBlkdCritlty,
     
    @UI.hidden: true      
    cast(
    case
    when DeliveryBlockReason <> ''                                        then 1  
                                                                          else 9  // no icon

    end as abap.int1
    )    as DeliveryBlockReasonCriticality,
     
    @UI.hidden: true      
    cast(
    case
    when _ConObjStatusBillgBlocked.CtrlgObjStatusIsBillingBlkd = 'X'      then 1  //boolean

                                                                          else 3  
    end as abap.int1
    )    as CtrlgObjStsIsBillgBlkdCritlty,
     
    @UI.hidden: true
    cast(      
    case
    when HeaderBillingBlockReason <> ''                                   then 1  
                                                                          else 9  // no icon

    end as abap.int1
    )    as HdrBillgBlockReasonCriticality,
     
     @UI.hidden: true      
    cast(
    case
    when CentralCreditCheckStatus = 'D'
      or CentralCreditCheckStatus = 'A'                                   then 3   //D - Released, A - Approved

    when CentralCreditCheckStatus = ''                                    then 0  // '' - not performed

                                                                          else 1  // B & C

    end as abap.int1
    )    as CentralCreditChkStsCriticality,
    
    @UI.hidden: true      
    cast(
    case
    when PaytAuthsnCreditCheckSts = 'D'
      or PaytAuthsnCreditCheckSts = 'A'                                   then 3  //D - Released, A - Approved

      when PaytAuthsnCreditCheckSts = ''                                  then 0  // '' - not performed

                                                                          else 1  
    end as abap.int1
    )    as PaytAuthCrdtChkStsCriticality, 
         
    @UI.hidden: true      
    cast(
    case
    when FinDocCreditCheckStatus = 'D'
      or FinDocCreditCheckStatus = 'A'                                    then 3   //D - Released, A - Approved

      when FinDocCreditCheckStatus = ''                                   then 0
                                                                          else 1  
    end as abap.int1
    )    as FinDocCrdtCheckStsCriticality, 
     
    @UI.hidden: true     
    cast( 
    case
    when ExprtInsurCreditCheckStatus = 'D'
      or ExprtInsurCreditCheckStatus = 'A'                                then 3  //D - Released, A - Approved

    when ExprtInsurCreditCheckStatus = ''                                 then 0  // '' - not performed

                                                                          else 1  
    end as abap.int1
    )    as ExprtInsurCrdtChkStsCritlty,
   
    @UI.hidden: true      
    cast(
    case
    when OverallChmlCmplncStatus = 'A'                                   then 3  // Approved

    when OverallChmlCmplncStatus = ''                                    then 0  // No Check

                                                                         else 1  // Blocked, Approval Rejected, Partially Blocked, Partially Rejected            

    end as abap.int1
    )    as OvrlChmlCmplncStsCriticality, 
    
    @UI.hidden: true      
    cast(
    case
    when OverallDangerousGoodsStatus = 'A'                              then 3  // Transport allowed                               

    when OverallDangerousGoodsStatus = '' or  
         OverallDangerousGoodsStatus = 'B'                              then 0  // Not relevant for Checks

                                                                        else 1  // Transport Restricted, Partially Blocked, Blocked                                        

    end as abap.int1
    )    as OvrlDngrsGdsStsCriticality, 
    
    @UI.hidden: true      
    cast(
    case
    when OverallSafetyDataSheetStatus  = 'A'                            then 3  // Ok approved                               

    when OverallSafetyDataSheetStatus  = '' or  
         OverallSafetyDataSheetStatus  = 'B'                            then 0  // Not relevant for Checks

                                                                        else 1  // Partially Blocked, Blocked                                        

    end as abap.int1
    )    as OvrlSftyDataSheetStsCritlty, 
    
    @UI.hidden: true      
    cast(
    case
    when OverallTrdCmplncEmbargoSts  = 'A'                            then 3  // Released                              

    when OverallTrdCmplncEmbargoSts  = ''                             then 0  // Not relevant for Checks

                                                                      else 1  // Partially Pending, Partially Blocked, Pending, Blocked                                        

    end as abap.int1
    )    as OvrlTrdCmplncEmbargoStsCritlty, 
    
    @UI.hidden: true      
    cast(
    case
    when OvrlTrdCmplncSnctndListChkSts = 'A'                          then 3  // Released                              

    when OvrlTrdCmplncSnctndListChkSts = ''                           then 0  // Not relevant for Checks

                                                                      else 1  // Partially Pending, Partially Blocked, Pending, Blocked                                        

    end as abap.int1
    )    as OvrlTrdCmplncSnctndListCritlty, 
    
    @UI.hidden: true      
    cast(
    case
    when OvrlTrdCmplncLegalCtrlChkSts = 'A'                           then 3  // Released                              

    when OvrlTrdCmplncLegalCtrlChkSts = ''                            then 0  // Not relevant for Checks

                                                                      else 1  // Partially Pending, Partially Blocked, Pending, Blocked                                        

    end as abap.int1
    )    as OvrlTrdCmplncLglCtrlStsCritlty, 
   
    @UI.hidden: true      
    cast(
    case
    when OverallPurchaseConfStatus = 'C'                              then 3  // Confirmed by MM

    when OverallPurchaseConfStatus = ''                               then 0  // No relevant

                                                                      else 1  // Not yet confirmed, Partially Confirmed            

    end as abap.int1
    )    as PurchaseConfStatusCriticality, 
    
    @UI.hidden: true
    @ObjectModel.foreignKey.association: '_SalesDocumentRjcnReason'
    cast( '  ' as abgru_va) as SalesDocumentRjcnReason,   
    
    cast( SalesDocApprovalReason  as sd_apm_approval_reason_vdm preserving type )  as SalesDocApprovalReason, 
    
    @UI.hidden: true
    @Semantics.booleanIndicator: true    
    @ObjectModel.virtualElement
    @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SOF_TRADE_COMPL_RELE'
    cast('' as boole_d preserving type )                                           as TradeComplianceIsActive,      
       
   //Associations      

      _SDDocumentCategory,
      _SalesDocumentType,
      _SalesOrganization,
      _DistributionChannel,
      _OrganizationDivision,
      _SalesGroup,
      _SalesOffice,
      _CustomerPaymentTerms,
      _SalesArea, 
      SalesDocument._CreditControlArea._CreditControlArea2Segment._CreditSegment,  
      _TransactionCurrency,
      _ShippingType,
      _ShippingCondition,
      _IncotermsClassification,
      _IncotermsVersion,
      _DeliveryBlockReason,
      _HeaderBillingBlockReason,
      _OverallSDProcessStatus,
      _SalesDocApprovalStatus,
      _OverallPurchaseConfStatus,
      _OverallSDDocumentRejectionSts,
      _OverallTotalDeliveryStatus,
      _OverallOrdReltdBillgStatus,
      _HdrGeneralIncompletionStatus,
      _HeaderDelivIncompletionStatus,
      _OverallPricingIncompletionSts,
      _HeaderBillgIncompletionStatus,
      _OvrlItmGeneralIncompletionSts,
      _OvrlItmBillingIncompletionSts,
      _OvrlItmDelivIncompletionSts,
      _CentralCreditCheckStatus,  
      _FinDocCreditCheckStatus,
      _ExprtInsurCreditCheckStatus,
      _PaytAuthsnCreditCheckSts,
      _OverallChmlCmplncStatus,
      _OverallDangerousGoodsStatus,
      _OvrlSftyDataSheetSts,
      _OvrlTradeCmplncEmbargoStatus,
      _OvTrdCmplncSnctndListChkSts,
      _OvrlTrdCmplncLegalCtrlChkSts,
      SalesDocument._SoldToParty._CustomerClassification,  
      _CreditMgmt,
      @Consumption.filter.hidden: true
      _SalesDocumentRjcnReason,
      _SalesDocApprovalReason                 
 }
  where (SalesDocument.SDDocumentCategory = 'C' or   --> Order
         SalesDocument.SDDocumentCategory = 'I' or   --> Order w/o charge
         SalesDocument.SDDocumentCategory = 'L' )    --> Debit Memo Request
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BUSINESSPARTNER",
"I_CREDITCONTROLAREA",
"I_CREDITCONTROLAREA2SEGMENT",
"I_CUSTOMER",
"I_CUSTOMERTOBUSINESSPARTNER",
"I_ENGAGEMENTPROJECT",
"I_ENGAGEMENTPROJECTITEM",
"I_PAYMENTPLAN",
"I_PERSONWORKAGREEMENT_1",
"I_SALESDOCUMENT",
"I_SDDOCCTRLGOBJSTSBLKDINFO",
"I_SDDOCSTANDARDPARTNER",
"I_SDDOCUMENTCOMPLETEPARTNERS"
],
"ASSOCIATED":
[
"C_SLSDOCFLFMTCREDITMGMT",
"E_SALESDOCUMENTBASIC",
"I_BILLINGBLOCKREASON",
"I_CENTRALCREDITCHECKSTATUS",
"I_CREDITMANAGEMENTSEGMENT",
"I_CURRENCY",
"I_CUSTOMERCLASSIFICATION",
"I_CUSTOMERPAYMENTTERMS",
"I_DELIVERYBLOCKREASON",
"I_DISTRIBUTIONCHANNEL",
"I_DIVISION",
"I_EXPRTINSURCREDITCHECKSTATUS",
"I_FINDOCCREDITCHECKSTATUS",
"I_HDRBILLGINCOMPLETIONSTATUS",
"I_HDRDELIVINCOMPLETIONSTATUS",
"I_HDRGENINCOMPLETIONSTATUS",
"I_INCOTERMSCLASSIFICATION",
"I_INCOTERMSVERSION",
"I_OVERALLCHMLCMPLNCSTATUS",
"I_OVERALLDANGEROUSGOODSSTATUS",
"I_OVERALLORDRELTDBILLGSTATUS",
"I_OVERALLPRCINCOMPLETIONSTS",
"I_OVERALLPURCHASECONFSTATUS",
"I_OVERALLSDDOCUMENTRJCNSTATUS",
"I_OVERALLSDPROCESSSTATUS",
"I_OVERALLTOTALDELIVERYSTATUS",
"I_OVRLITMBILLGINCOMPLTNSTS",
"I_OVRLITMDELIVINCOMPLETIONSTS",
"I_OVRLITMGENINCOMPLETIONSTS",
"I_OVRLSFTYDATASHEETSTS",
"I_OVRLTRADECMPLNCEMBARGOSTATUS",
"I_OVRLTRDCMPLNCLEGALCTRLCHKSTS",
"I_OVTRDCMPLNCSNCTNDLISTCHKSTS",
"I_PAYMENTPLAN",
"I_PAYTAUTHSNCREDITCHECKSTS",
"I_SALESAREA",
"I_SALESDOCAPPROVALREASON",
"I_SALESDOCAPPROVALSTATUS",
"I_SALESDOCUMENTRJCNREASON",
"I_SALESDOCUMENTTYPE",
"I_SALESGROUP",
"I_SALESOFFICE",
"I_SALESORGANIZATION",
"I_SDDOCCTRLGOBJSTSBLKDINFO",
"I_SDDOCUMENTCATEGORY",
"I_SHIPPINGCONDITION",
"I_SHIPPINGTYPE"
],
"BASE":
[
"I_CREDITCONTROLAREA2SEGMENT",
"I_CUSTOMER",
"I_SALESDOCUMENT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/