I_SalesDocItemCompletePartner

DDL: I_SALESDOCITEMCOMPLETEPARTNER Type: view COMPOSITE

Sales Doc Item and Inherited Partners

I_SalesDocItemCompletePartner is a Composite CDS View that provides data about "Sales Doc Item and Inherited Partners" in SAP S/4HANA. It reads from 1 data source (P_SalesDocItemCompletePartner) and exposes 31 fields with key fields SalesDocument, SalesDocumentItem, PartnerFunction. It has 10 associations to related views.

Data Sources (1)

SourceAliasJoin Type
P_SalesDocItemCompletePartner ItemPartner from

Associations (10)

CardinalityTargetAliasCondition
[1] I_WorkAssignment _WorkAssignment $projection.Personnel = _WorkAssignment.WorkAssignment
[0..1] I_OrganizationAddress _OrganizationAddress $projection.AddressID = _OrganizationAddress.AddressID and $projection.AddressPersonID = _OrganizationAddress.AddressPersonID and $projection.AddressObjectType = '1' and _OrganizationAddress.AddressRepresentationCode is initial
[0..1] I_PersonAddress _PersonAddress $projection.AddressID = _PersonAddress.AddressID and $projection.AddressPersonID = _PersonAddress.AddressPersonID and $projection.AddressObjectType = '2' and _PersonAddress.AddressRepresentationCode is initial
[0..1] I_PersonWorkplaceAddress _PersonWorkplaceAddress $projection.AddressID = _PersonWorkplaceAddress.AddressID and $projection.AddressPersonID = _PersonWorkplaceAddress.AddressPersonID and $projection.AddressObjectType = '3' and _PersonWorkplaceAddress.AddressRepresentationCode is initial
[0..1] I_AddrOrgNamePostalAddress _OrgNamePostalAddress $projection.AddressID = _OrgNamePostalAddress.AddressID and _OrgNamePostalAddress.AddressRepresentationCode is initial
[0..1] I_AddressPersonName _PersonName $projection.AddressPersonID = _PersonName.AddressPersonID and _PersonName.AddressRepresentationCode is initial
[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..1] I_AddrCurDefaultFaxNumber _CurrentDfltFaxNumber $projection.AddressID = _CurrentDfltFaxNumber.AddressID and $projection.AddressPersonID = _CurrentDfltFaxNumber.AddressPersonID

Annotations (12)

NameValueLevelField
AbapCatalog.sqlViewName ISLSDOCITMCMPLPT view
AbapCatalog.compiler.compareFilter true view
VDM.viewType #COMPOSITE view
VDM.lifecycle.contract.type #PUBLIC_LOCAL_API view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.authorizationCheck #CHECK view
ObjectModel.representativeKey PartnerFunction view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XL view
Metadata.ignorePropagatedAnnotations true view
EndUserText.label Sales Doc Item and Inherited Partners view

Fields (31)

KeyFieldSource TableSource FieldDescription
KEY SalesDocument P_SalesDocItemCompletePartner SalesDocument
KEY SalesDocumentItem P_SalesDocItemCompletePartner SalesDocumentItem
KEY PartnerFunction P_SalesDocItemCompletePartner PartnerFunction
Customer P_SalesDocItemCompletePartner Customer
Supplier P_SalesDocItemCompletePartner Supplier
ContactPerson P_SalesDocItemCompletePartner ContactPerson
Personnel P_SalesDocItemCompletePartner Personnel
VATRegistration P_SalesDocItemCompletePartner VATRegistration
UnloadingPointName P_SalesDocItemCompletePartner UnloadingPointName
ContactPersonaskunnrelseendasPartner
ReferenceBusinessPartner P_SalesDocItemCompletePartner ReferenceBusinessPartner
AddressID P_SalesDocItemCompletePartner AddressID
AddressPersonID P_SalesDocItemCompletePartner AddressPersonID
AddressObjectType P_SalesDocItemCompletePartner AddressObjectType
SDDocPartnerAddressRefType P_SalesDocItemCompletePartner SDDocPartnerAddressRefType
BPAddrDeterminationTransaction P_SalesDocItemCompletePartner BPAddrDeterminationTransaction
BPRefAddressIDForDocSpcfcAddr P_SalesDocItemCompletePartner BPRefAddressIDForDocSpcfcAddr
PartnerIsSpecificForSDDocItem P_SalesDocItemCompletePartner PartnerIsSpecificForSDDocItem
Country _OrgNamePostalAddress Country
_Address P_SalesDocItemCompletePartner _Address
_DfltAddrRprstn P_SalesDocItemCompletePartner _DfltAddrRprstn
_BusinessPartnerAddress P_SalesDocItemCompletePartner _BusinessPartnerAddress
_BPRefAddressForDocSpcfcAddr P_SalesDocItemCompletePartner _BPRefAddressForDocSpcfcAddr
_SalesDocument P_SalesDocItemCompletePartner _SalesDocument
_SalesDocumentItem P_SalesDocItemCompletePartner _SalesDocumentItem
_PartnerFunction P_SalesDocItemCompletePartner _PartnerFunction
_ContactPerson _ContactPerson
_PersonAddress _PersonAddress
_PersonName _PersonName
_OrganizationAddress _OrganizationAddress
_OrgNamePostalAddress _OrgNamePostalAddress
@AbapCatalog: {
  sqlViewName: 'ISLSDOCITMCMPLPT',
  compiler.compareFilter: true
}

@VDM: {
  viewType: #COMPOSITE,
  lifecycle.contract.type: #PUBLIC_LOCAL_API
}

@ClientHandling.algorithm: #SESSION_VARIABLE

@AccessControl: {
  authorizationCheck: #CHECK,
  personalData.blocking: #('TRANSACTIONAL_DATA'),
  privilegedAssociations:  [ '_Address', '_DfltAddrRprstn', '_PersonAddress', '_PersonName', '_OrganizationAddress', '_OrgNamePostalAddress' ]
}

@ObjectModel: {
   representativeKey: 'PartnerFunction',
   usageType: {
     dataClass:      #TRANSACTIONAL,
     serviceQuality: #C,
     sizeCategory:   #XL
   }
}

@Metadata.ignorePropagatedAnnotations:true

@EndUserText.label: 'Sales Doc Item and Inherited Partners'
define view I_SalesDocItemCompletePartner
  as select from P_SalesDocItemCompletePartner as ItemPartner

  association [1]    to I_WorkAssignment               as _WorkAssignment               on  $projection.Personnel = _WorkAssignment.WorkAssignment

  association [0..1] to I_OrganizationAddress          as _OrganizationAddress          on  $projection.AddressID                          = _OrganizationAddress.AddressID
                                                                                        and $projection.AddressPersonID                    = _OrganizationAddress.AddressPersonID
                                                                                        and $projection.AddressObjectType                  = '1'
                                                                                        and _OrganizationAddress.AddressRepresentationCode is initial

  association [0..1] to I_PersonAddress                as _PersonAddress                on  $projection.AddressID                    = _PersonAddress.AddressID
                                                                                        and $projection.AddressPersonID              = _PersonAddress.AddressPersonID
                                                                                        and $projection.AddressObjectType            = '2'
                                                                                        and _PersonAddress.AddressRepresentationCode is initial

  association [0..1] to I_PersonWorkplaceAddress       as _PersonWorkplaceAddress       on  $projection.AddressID                             = _PersonWorkplaceAddress.AddressID
                                                                                        and $projection.AddressPersonID                       = _PersonWorkplaceAddress.AddressPersonID
                                                                                        and $projection.AddressObjectType                     = '3'
                                                                                        and _PersonWorkplaceAddress.AddressRepresentationCode is initial

  association [0..1] to I_AddrOrgNamePostalAddress     as _OrgNamePostalAddress         on  $projection.AddressID                           = _OrgNamePostalAddress.AddressID
                                                                                        and _OrgNamePostalAddress.AddressRepresentationCode is initial

  association [0..1] to I_AddressPersonName            as _PersonName                   on  $projection.AddressPersonID           = _PersonName.AddressPersonID
                                                                                        and _PersonName.AddressRepresentationCode is initial

  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_AddrCurDefaultFaxNumber      as _CurrentDfltFaxNumber         on  $projection.AddressID       = _CurrentDfltFaxNumber.AddressID
                                                                                        and $projection.AddressPersonID = _CurrentDfltFaxNumber.AddressPersonID


{
      @ObjectModel.foreignKey.association: '_SalesDocument'
  key ItemPartner.SalesDocument,
      @ObjectModel.foreignKey.association: '_SalesDocumentItem'
  key ItemPartner.SalesDocumentItem,
      @ObjectModel.foreignKey.association: '_PartnerFunction'
  key ItemPartner.PartnerFunction,

      ItemPartner.Customer,

      ItemPartner.Supplier,

      ItemPartner.ContactPerson,

      ItemPartner.Personnel,

      ItemPartner.VATRegistration,

      @Semantics.text: true
      ItemPartner.UnloadingPointName,

      case
        when ItemPartner.Customer != ''
            then ItemPartner.Customer
        when ItemPartner.Supplier != ''
            then ItemPartner.Supplier
        when ItemPartner.Personnel != '00000000'
            then cast(ItemPartner.Personnel as kunnr)
        when ItemPartner.ContactPerson != '0000000000'
            then cast(ItemPartner.ContactPerson as kunnr)
        else
            ''
        end                                                            as Partner,
       
      cast( 
      case AddressID
        when ''
          then
            case
              when Personnel != '00000000'
               then coalesce(_WorkAssignment.PersonFullName,
                             _WorkAssignment._BusinessPartner.LastName)
            end
        else
          case
            when ItemPartner.AddressObjectType = '1'
              then
                case
                  when ItemPartner.ContactPerson != '0000000000'
                    then 
                      cast(substring(replace(concat(ItemPartner._ContactPerson.FirstName, 
                                             concat(' &@', ItemPartner._ContactPerson.LastName) ), '&@', '') ,1,80) as ad_namtext )
                  when ItemPartner.Personnel != '00000000'
                    then _OrganizationAddress.AddresseeName1  //Document specific personnel                                

                  else 
                    cast(concat_with_space(_OrganizationAddress.AddresseeName1, 
                                           _OrganizationAddress.AddresseeName2, 1) as ad_namtext )
                  end
            when ItemPartner.AddressObjectType = '2'
              then _PersonAddress.PersonFullName
            when ItemPartner.AddressObjectType = '3'
              then _PersonWorkplaceAddress.PersonFullName
          end
      end as ad_namtext )                                                            as FullName,

      ItemPartner.ReferenceBusinessPartner,

      ItemPartner.AddressID,

      ItemPartner.AddressPersonID,

      ItemPartner.AddressObjectType,

      ItemPartner.SDDocPartnerAddressRefType,

      ItemPartner.BPAddrDeterminationTransaction,

      ItemPartner.BPRefAddressIDForDocSpcfcAddr,

      ItemPartner.PartnerIsSpecificForSDDocItem,

      cast(
      case ItemPartner.SDDocPartnerAddressRefType
        when 'E' then 'X'
        when 'F' then 'X'
        else ' '
      end                 as sd_pd_doc_spec_addr_flag)                 as SDDocPartnerAddrIsDocSpecific,

      _OrgNamePostalAddress.Country,

      cast(
        coalesce( _PersonName.FormOfAddress,
                  _OrgNamePostalAddress.FormOfAddress )  
         as ad_title preserving type )                                 as FormOfAddress,
      
      coalesce( _PersonName.CorrespondenceLanguage,
                _OrgNamePostalAddress.CorrespondenceLanguage )         as CorrespondenceLanguage,

      /* Communication Related Data */
      cast(
        coalesce( _CurrentDfltLandlinePhoneNmbr.InternationalPhoneNumber,
                  _WorkAssignment._WorkplaceAddress.NormalizedPhoneNumber ) 
         as ad_telnrlg preserving type )                               as InternationalPhoneNumber,
      
      cast(
        coalesce( _CurrentDfltMobilePhoneNumber.InternationalPhoneNumber,
                  _WorkAssignment._WorkplaceAddress.MblNormalizedPhoneNumber )
         as ad_telnrlg preserving type )                               as InternationalMobilePhoneNumber,
      
      cast(
        coalesce( _CurrentDfltFaxNumber.InternationalFaxNumber,
                  _WorkAssignment._WorkplaceAddress.InternationalFaxNumber )   
         as ad_fxnrlng preserving type )                               as InternationalFaxNumber,

      cast(
        coalesce( _CurrentDfltEmailAddress.EmailAddress,
                  _WorkAssignment._WorkplaceAddress.DefaultEmailAddress )  
        as vdm_sd_ad_smtpadr preserving type )                         as EmailAddress,

      ItemPartner._Address,

      ItemPartner._DfltAddrRprstn,

      ItemPartner._BusinessPartnerAddress,

      ItemPartner._BPRefAddressForDocSpcfcAddr,

      ItemPartner._SalesDocument,

      ItemPartner._SalesDocumentItem,

      ItemPartner._PartnerFunction,

      _ContactPerson,
      _PersonAddress,
      _PersonName,
      _OrganizationAddress,
      _OrgNamePostalAddress
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDRCURDEFAULTEMAILADDRESS",
"I_ADDRCURDEFAULTFAXNUMBER",
"I_ADDRCURDFLTLANDLINEPHONENMBR",
"I_ADDRCURDFLTMOBILEPHONENUMBER",
"I_ADDRESSPERSONNAME",
"I_ADDRORGNAMEPOSTALADDRESS",
"I_BUSINESSPARTNER",
"I_CONTACTPERSON",
"I_ORGANIZATIONADDRESS",
"I_PERSONADDRESS",
"I_PERSONWORKPLACEADDRESS",
"I_WORKASSIGNMENT",
"I_WORKPLACEADDRESS",
"P_SALESDOCITEMCOMPLETEPARTNER"
],
"ASSOCIATED":
[
"I_ADDRCURDEFAULTEMAILADDRESS",
"I_ADDRCURDEFAULTFAXNUMBER",
"I_ADDRCURDFLTLANDLINEPHONENMBR",
"I_ADDRCURDFLTMOBILEPHONENUMBER",
"I_ADDRESS",
"I_ADDRESSPERSONNAME",
"I_ADDRESS_2",
"I_ADDRORGNAMEPOSTALADDRESS",
"I_BUSPARTADDRESS",
"I_CONTACTPERSON",
"I_ORGANIZATIONADDRESS",
"I_PARTNERFUNCTION",
"I_PERSONADDRESS",
"I_PERSONWORKPLACEADDRESS",
"I_SALESDOCUMENT",
"I_SALESDOCUMENTITEM",
"I_WORKASSIGNMENT"
],
"BASE":
[
"P_SALESDOCITEMCOMPLETEPARTNER"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/