@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog: {
sqlViewName: 'ISLSDOCITMNSPT',
preserveKey: true,
compiler.compareFilter: true
}
@AccessControl: {
authorizationCheck: #CHECK,
personalData.blocking: #('TRANSACTIONAL_DATA'),
privilegedAssociations: [ '_DfltAddrRprstn' ]
}
@VDM: {
viewType: #COMPOSITE,
lifecycle.contract.type: #PUBLIC_LOCAL_API
}
@ObjectModel: {
representativeKey: 'PartnerFunction',
usageType: {
dataClass: #TRANSACTIONAL,
serviceQuality: #C,
sizeCategory: #XL
}
}
@Metadata.ignorePropagatedAnnotations:true
@EndUserText.label: 'Sls Doc Item Non Std Complete Partners'
define view I_SlsDocItmNonStdPartner
as select from I_SalesDocItemCompletePartner as ItemPartner
association [1] to I_PersonWorkAgreement_1 as _WorkAgreement on $projection.Personnel = _WorkAgreement.PersonWorkAgreement
association [1] to I_ContactPerson as _ContactPerson on $projection.ContactPerson = _ContactPerson.ContactPerson
{
@ObjectModel.foreignKey.association: '_SalesDocument'
key ItemPartner.SalesDocument,
@ObjectModel.foreignKey.association: '_SalesDocumentItem'
key ItemPartner.SalesDocumentItem,
@ObjectModel.foreignKey.association: '_PartnerFunction'
key cast(ItemPartner.PartnerFunction as parvw_unv preserving type ) as PartnerFunction,
_PartnerFunction._Text[1:Language = $session.system_language ].PartnerFunctionName as PartnerFunctionName,
_PartnerFunction.SDDocumentPartnerType,
ItemPartner.Customer,
ItemPartner.Supplier,
ItemPartner.ContactPerson,
ItemPartner.Personnel,
ItemPartner.AddressID,
ItemPartner.AddressPersonID,
case
when Customer != ''
then Customer
when Supplier != ''
then Supplier
when Personnel != '00000000'
then cast(Personnel as kunnr) // cast to get the same data element length and also APLHA conversion done
when ContactPerson != '0000000000'
then cast(ContactPerson as kunnr) // cast to get the same data element length and also APLHA conversion done
else
''
end as BusinessPartner,
// ItemPartner.Partner as BusinessPartner,
@Semantics.name.fullName: true
@Semantics.text: true
// ItemPartner.FullName as BusinessPartnerFullName,
case
when ContactPerson != '0000000000'
then coalesce(_DfltAddrRprstn.AddresseeFullName, cast(substring(replace(concat(_ContactPerson.FirstName, concat(' &@', _ContactPerson.LastName)), '&@', ''),1,80) as ad_namtext ) )
when Personnel != '00000000'
then
case when _WorkAgreement.PersonFullName is initial
then cast( _WorkAgreement._WorkforcePerson.LastName as ad_namtext )
else
_WorkAgreement.PersonFullName
end
else
_DfltAddrRprstn.AddresseeFullName
end as BusinessPartnerFullName,
// case AddressID
// when ''
// then
// case
// when ContactPerson != '0000000000'
// then cast(substring(replace(concat(_ContactPerson.FirstName,
// concat(' &@', _ContactPerson.LastName)), '&@', '') ,1,80) as ad_namtext )
// when Personnel != '00000000'
// then coalesce(_WorkAgreement.PersonFullName,
// _WorkAgreement._WorkforcePerson.LastName)
// else ''
// end
// else
// case
// when ItemPartner.AddressObjectType = '1'
// then cast(concat_with_space(_OrganizationAddress.AddresseeName1,
// _OrganizationAddress.AddresseeName2, 1) as ad_namtext )
// when ItemPartner.AddressObjectType = '2'
// then _PersonAddress.PersonFullName
// when ItemPartner.AddressObjectType = '3'
// then _PersonWorkplaceAddress.PersonFullName
// else ''
// end
// end as FullName,
@Semantics.telephone.type: #WORK
case AddressID
when ''
then _WorkAgreement._WorkforcePerson._WorkplaceAddress.NormalizedPhoneNumber
else _DfltAddrRprstn._CurrentDfltLandlinePhoneNmbr.InternationalPhoneNumber
end as InternationalPhoneNumber,
@Semantics.telephone.type: #CELL
case AddressID
when ''
then _WorkAgreement._WorkforcePerson._WorkplaceAddress.MblNormalizedPhoneNumber
else _DfltAddrRprstn._CurrentDfltMobilePhoneNumber.InternationalPhoneNumber
end as InternationalMobilePhoneNumber,
@Semantics.eMail.address: true
@Semantics.eMail.type: #WORK
case AddressID
when ''
then _WorkAgreement._WorkforcePerson._WorkplaceAddress.DefaultEmailAddress
else _DfltAddrRprstn._CurrentDfltEmailAddress.EmailAddress
end as EmailAddress,
@Semantics.address.country: true
case AddressID
when ''
then _WorkAgreement._WorkforcePerson._WorkplaceAddress.DestinationLocationCountry
else _DfltAddrRprstn.Country
end as Country,
PartnerIsSpecificForSDDocItem,
ItemPartner._DfltAddrRprstn,
ItemPartner._SalesDocument,
ItemPartner._SalesDocumentItem,
ItemPartner._PartnerFunction
//for address 2202
// @Semantics.text:true
// @Consumption.filter.hidden: true
// @ObjectModel.virtualElement: true
// @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_MCC_SLS_DOC_VE'
// cast( ' ' as ad_line_s ) as FormattedPostalAddressDesc
}
where
PartnerFunction != 'AG'
and PartnerFunction != 'WE'
and PartnerFunction != 'RE'
and PartnerFunction != 'RG'
and PartnerFunction != 'VE'
and PartnerFunction != 'ZM'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDRCURDEFAULTEMAILADDRESS",
"I_ADDRCURDFLTLANDLINEPHONENMBR",
"I_ADDRCURDFLTMOBILEPHONENUMBER",
"I_ADDRESS_2",
"I_CONTACTPERSON",
"I_PARTNERFUNCTION",
"I_PARTNERFUNCTIONTEXT",
"I_PERSONWORKAGREEMENT_1",
"I_SALESDOCITEMCOMPLETEPARTNER",
"I_WORKFORCEPERSON",
"I_WORKPLACEADDRESS"
],
"ASSOCIATED":
[
"I_ADDRESS_2",
"I_CONTACTPERSON",
"I_PARTNERFUNCTION",
"I_PERSONWORKAGREEMENT_1",
"I_SALESDOCUMENT",
"I_SALESDOCUMENTITEM"
],
"BASE":
[
"I_SALESDOCITEMCOMPLETEPARTNER"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/