C_SlsDocFlfmtSDDocContacts

DDL: C_SLSDOCFLFMTSDDOCCONTACTS SQL: CSOFSDDOCCONT Type: view CONSUMPTION Package: ODATA_SD_SOF

Sales Doc Fulfillment: Contacts

C_SlsDocFlfmtSDDocContacts is a Consumption CDS View that provides data about "Sales Doc Fulfillment: Contacts" in SAP S/4HANA. It reads from 2 data sources (P_SlsDocFlfmtSDDocContacts1, I_SDDocumentCompletePartners) and exposes 35 fields with key fields SDDocument, PartnerFunction, Personnel, ContactPerson, Customer. It has 9 associations to related views. Part of development package ODATA_SD_SOF.

Data Sources (2)

SourceAliasJoin Type
P_SlsDocFlfmtSDDocContacts1 ExContacts union_all
I_SDDocumentCompletePartners SDPartner from

Associations (9)

CardinalityTargetAliasCondition
[0..1] I_PersonWorkAgreement_1 _PersonWorkAgreement $projection.Personnel = _PersonWorkAgreement.PersonWorkAgreement
[1..1] I_SalesDocument _SalesDocument $projection.SDDocument = _SalesDocument.SalesDocument
[1..1] I_DeliveryDocument _DeliveryDocument $projection.SDDocument = _DeliveryDocument.DeliveryDocument
[1..1] I_BillingDocument _BillingDocument $projection.SDDocument = _BillingDocument.BillingDocument
[0..1] I_AddrCurDfltLandlinePhoneNmbr _CurrentDfltLandlinePhoneNmbr $projection.AddressID = _CurrentDfltLandlinePhoneNmbr.AddressID and $projection.AddressPersonID = _CurrentDfltLandlinePhoneNmbr.AddressPersonID
[0..1] I_AddrCurDefaultEmailAddress _CurrentDfltEmailAddress $projection.AddressID = _CurrentDfltEmailAddress.AddressID and $projection.AddressPersonID = _CurrentDfltEmailAddress.AddressPersonID
[0..1] I_AddrCurDfltMobilePhoneNumber _CurrentDfltMobilePhoneNumber $projection.AddressID = _CurrentDfltMobilePhoneNumber.AddressID and $projection.AddressPersonID = _CurrentDfltMobilePhoneNumber.AddressPersonID
[0..*] I_PartnerFunctionText _PartnerFunctionText $projection.PartnerFunction = _PartnerFunctionText.PartnerFunction
[0..1] I_PartnerFunction _PartnerFunction $projection.PartnerFunction = _PartnerFunction.PartnerFunction

Annotations (12)

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

Fields (35)

KeyFieldSource TableSource FieldDescription
KEY SDDocument SDDocument
KEY PartnerFunction PartnerFunction
KEY Personnel Personnel
KEY ContactPerson ContactPerson
KEY Customer Customer
KEY CustomerContact
AddressID I_SDDocumentCompletePartners AddressID
AddressPersonID I_SDDocumentCompletePartners AddressPersonID
ContactFunctionName
ContactIsInternal
ContactIsExternal
_SalesDocument _SalesDocument
_DeliveryDocument _DeliveryDocument
_BillingDocument _BillingDocument
SDDocumentasSDDocument
KEY PartnerFunction
KEY Personnel P_SlsDocFlfmtSDDocContacts1 Personnel
KEY ContactPerson P_SlsDocFlfmtSDDocContacts1 ContactPerson
KEY Customer P_SlsDocFlfmtSDDocContacts1 Customer
KEY CustomerContact P_SlsDocFlfmtSDDocContacts1 CustomerContact
AddressID
AddressPersonID
ContactFunctionName
FamilyName180asadfullnameasFullName
FamilyName
FirstName
EmailAddress
MobilePhoneNumber
PhoneNumber
ContactIsInternal
ContactIsExternal
_SalesDocument _SalesDocument
_DeliveryDocument _DeliveryDocument
_BillingDocument _BillingDocument
_PartnerFunction _PartnerFunction
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #S
@EndUserText.label: 'Sales Doc Fulfillment: Contacts'
@VDM.viewType: #CONSUMPTION
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED
@Metadata.allowExtensions: true
@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName: 'CSOFSDDOCCONT'

define view C_SlsDocFlfmtSDDocContacts

  //   +-------------------+

  //   | Internal Contacts |

  //   +-------------------+

  as select from I_SDDocumentCompletePartners as SDPartner

  association [0..1] to I_PersonWorkAgreement_1 as _PersonWorkAgreement   on $projection.Personnel = _PersonWorkAgreement.PersonWorkAgreement
  association [1..1] to I_SalesDocument         as _SalesDocument         on $projection.SDDocument = _SalesDocument.SalesDocument
  association [1..1] to I_DeliveryDocument      as _DeliveryDocument      on $projection.SDDocument = _DeliveryDocument.DeliveryDocument
  association [1..1] to I_BillingDocument       as _BillingDocument       on $projection.SDDocument = _BillingDocument.BillingDocument
  
  association [0..1] to I_AddrCurDfltLandlinePhoneNmbr as _CurrentDfltLandlinePhoneNmbr on  $projection.AddressID       = _CurrentDfltLandlinePhoneNmbr.AddressID
                                                                                        and $projection.AddressPersonID = _CurrentDfltLandlinePhoneNmbr.AddressPersonID 

  association [0..1] to I_AddrCurDefaultEmailAddress   as _CurrentDfltEmailAddress      on  $projection.AddressID       = _CurrentDfltEmailAddress.AddressID
                                                                                        and $projection.AddressPersonID = _CurrentDfltEmailAddress.AddressPersonID

  association [0..1] to I_AddrCurDfltMobilePhoneNumber as _CurrentDfltMobilePhoneNumber on  $projection.AddressID       = _CurrentDfltMobilePhoneNumber.AddressID
                                                                                        and $projection.AddressPersonID = _CurrentDfltMobilePhoneNumber.AddressPersonID
  association [0..*] to I_PartnerFunctionText          as _PartnerFunctionText          on $projection.PartnerFunction = _PartnerFunctionText.PartnerFunction
//  association [0..1] to I_ContactPersonFunction as _ContactPersonFunction on $projection.ContactPersonFunction = _ContactPersonFunction.ContactPersonFunction


{
  key SDDocument,
  key PartnerFunction,
  key Personnel,
  key ContactPerson,
  key Customer,
  key cast (' ' as bu_partner )                                        as   CustomerContact,
  
      @UI.hidden: true
      SDPartner.AddressID,
      @UI.hidden: true
      SDPartner.AddressPersonID,

//      cast ('' as bu_pafkt)                                            as   ContactPersonFunction,


//      cast (_PartnerFunction._Text[1:Language=$session.system_language].PartnerFunctionName as contactfunctionname)

//                                                                       as   ContactFunctionName,

      //Change Text expose from text view to imporve Performance                                                                

      _PartnerFunctionText[1:Language=$session.system_language].PartnerFunctionName   as   ContactFunctionName,                                                              
      @Semantics.name.fullName: true
      cast (
      case
        when ContactPerson != '0000000000'
          then cast(substring(replace(concat(_ContactPerson.FirstName,
          concat(' &@', _ContactPerson.LastName)), '&@', ''),1,80)
          as adfullname )
      else
        case AddressID
         when ''
            then _PersonWorkAgreement._WorkforcePerson.PersonFullName
         else _DfltAddrRprstn.AddresseeFullName
         end
      end as ad_namtext )                                              as   FullName,

      @Semantics.name.familyName: true
      cast (
      case
        when ContactPerson != '0000000000'
          then _ContactPerson.LastName
      else
        case AddressID
         when ''
            then _PersonWorkAgreement._WorkforcePerson.LastName
         else _DfltAddrRprstn.PersonFamilyName
         end
      end as ad_namelas )                                              as   FamilyName,

      @Semantics.name.givenName: true
      cast (
      case
        when ContactPerson != '0000000000'
          then _ContactPerson.FirstName
      else
        case AddressID
         when ''
            then _PersonWorkAgreement._WorkforcePerson.FirstName
         else _DfltAddrRprstn.PersonGivenName
         end
      end as ad_namefir )                                              as   FirstName,

      @Semantics.eMail.address: true
      @Semantics.eMail.type:  #WORK
      cast (
      case AddressID
         when ''
            then _PersonWorkAgreement._WorkforcePerson._WorkplaceAddress.DefaultEmailAddress
         //else _Address._DefaultEmailAddress.EmailAddress

         else _CurrentDfltEmailAddress.EmailAddress
      end as ad_smtpadr )                                              as   EmailAddress,

      @Semantics.telephone.type: #CELL
      cast (
      case AddressID
         when ''
            then _PersonWorkAgreement._WorkforcePerson._WorkplaceAddress.MobilePhoneNumber
         //else _Address._DefaultMobilePhoneNumber.InternationalPhoneNumber

         else _CurrentDfltMobilePhoneNumber.InternationalPhoneNumber
      end as ad_mbnmbr1 )                                              as   MobilePhoneNumber,

      @Semantics.telephone.type: #WORK
      cast (
      case AddressID
         when ''
            then _PersonWorkAgreement._WorkforcePerson._WorkplaceAddress.NormalizedPhoneNumber
         //else _Address._DefaultPhoneNumber.InternationalPhoneNumber

         else _CurrentDfltLandlinePhoneNmbr.InternationalPhoneNumber
      end as ad_tlnmbr )                                               as   PhoneNumber,

      cast('X' as internalcontact)                                     as   ContactIsInternal,
      cast(' ' as externalcontact)                                     as   ContactIsExternal,

      @Consumption.hidden: true
      _SalesDocument,
      _DeliveryDocument,
      _BillingDocument,
      _PartnerFunction
//      _ContactPersonFunction

}
where
  (
       Personnel != '00000000'
    or ContactPerson != '0000000000'
  )
  and  SDDocumentItem = '000000'


union all
//   +-------------------+

//   | External Contacts |

//   +-------------------+

select from P_SlsDocFlfmtSDDocContacts1 as ExContacts

association [1..1] to I_SalesDocument    as _SalesDocument    on $projection.SDDocument = _SalesDocument.SalesDocument
association [1..1] to I_DeliveryDocument as _DeliveryDocument on $projection.SDDocument = _DeliveryDocument.DeliveryDocument
association [1..1] to I_BillingDocument  as _BillingDocument  on $projection.SDDocument = _BillingDocument.BillingDocument
association [0..1] to I_PartnerFunction  as _PartnerFunction  on $projection.PartnerFunction = _PartnerFunction.PartnerFunction

{
  key ExContacts.SDDocument                                           as   SDDocument,
  key ''                                                              as   PartnerFunction,
  key ExContacts.Personnel                                            as   Personnel,
  key ExContacts.ContactPerson                                        as   ContactPerson,
  key ExContacts.Customer                                             as   Customer,
  key ExContacts.CustomerContact                                      as   CustomerContact,
      @UI.hidden: true
      cast(' ' as ad_addrnum)                                         as AddressID,
      @UI.hidden: true
      cast(' ' as ad_persnum)                                    as AddressPersonID,

//      ContactPersonFunction,


      cast ( ExContacts._ContactPersonFunction._Text[1:Language=$session.system_language].ContactPersonFunctionName as contactfunctionname )
                                                                      as   ContactFunctionName,
      @Semantics.name.fullName: true
      cast(substring(replace(concat(ExContacts.FirstName,
           concat(' &@', ExContacts.FamilyName)), '&@', ''),1,80)
           as adfullname )                                            as   FullName,

      @Semantics.name.familyName: true
      cast ( ExContacts.FamilyName as ad_namelas )                    as   FamilyName,

      @Semantics.name.givenName: true
      cast ( ExContacts.FirstName  as ad_namefir )                    as   FirstName,

      @Semantics.eMail.address: true
      @Semantics.eMail.type:  #WORK
      cast ( ExContacts.EmailAddress as ad_smtpadr )                  as   EmailAddress,

      @Semantics.telephone.type: #CELL
      cast (ExContacts.MobilePhoneNumber as ad_mbnmbr1 )              as   MobilePhoneNumber,

      @Semantics.telephone.type: #WORK
      cast ( ExContacts.PhoneNumber as ad_tlnmbr )                    as   PhoneNumber,

      cast(' ' as internalcontact)                                    as   ContactIsInternal,
      cast('X' as externalcontact)                                    as   ContactIsExternal,

      @Consumption.hidden: true
      _SalesDocument,
      _DeliveryDocument,
      _BillingDocument,
      _PartnerFunction
//      _ContactPersonFunction

}