@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..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,
@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
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDRCURDEFAULTEMAILADDRESS",
"I_ADDRCURDFLTLANDLINEPHONENMBR",
"I_ADDRCURDFLTMOBILEPHONENUMBER",
"I_ADDRESS_2",
"I_CONTACTPERSON",
"I_CONTACTPERSONFUNCTION",
"I_CONTACTPERSONFUNCTIONT",
"I_PARTNERFUNCTION",
"I_PARTNERFUNCTIONTEXT",
"I_PERSONWORKAGREEMENT_1",
"I_SDDOCUMENTCOMPLETEPARTNERS",
"I_WORKFORCEPERSON",
"I_WORKPLACEADDRESS",
"P_SLSDOCFLFMTSDDOCCONTACTS1"
],
"ASSOCIATED":
[
"I_ADDRCURDEFAULTEMAILADDRESS",
"I_ADDRCURDFLTLANDLINEPHONENMBR",
"I_ADDRCURDFLTMOBILEPHONENUMBER",
"I_BILLINGDOCUMENT",
"I_DELIVERYDOCUMENT",
"I_PARTNERFUNCTION",
"I_PERSONWORKAGREEMENT_1",
"I_SALESDOCUMENT"
],
"BASE":
[
"I_SDDOCUMENTCOMPLETEPARTNERS"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/