Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.
-- Derived SQL interpretation of CDS view I_BusinessPartnerContact.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.
-- SQL view name: I_BP_CONTACTS
CREATE VIEW I_BusinessPartnerContact AS
SELECT
I_BPContact.RelationshipNumber AS RelationshipNumber,
I_BPContact.BusinessPartnerCompany AS BusinessPartnerCompany,
I_BPContact.BusinessPartnerPerson AS BusinessPartnerPerson,
I_BPContact.ValidityEndDate AS ValidityEndDate,
I_BPContact.ValidityStartDate AS ValidityStartDate,
I_BPContact.IsStandardRelationship AS IsStandardRelationship,
I_BPContact._BusinessPartnerPerson.FormOfAddress AS FormOfAddress,
I_BPContact._BusinessPartnerPerson.FirstName AS FirstName,
I_BPContact._BusinessPartnerPerson.LastName AS LastName,
I_BPContact._BusinessPartnerPerson.BirthDate AS BirthDate,
I_BPContact._ContactRelationship.ContactPersonFunction AS ContactPersonFunction,
I_BPContact._ContactRelationship.BPContactPersonFunction AS BPContactPersonFunction,
I_BPContact._ContactRelationship.ContactPersonDepartment AS ContactPersonDepartment,
I_BPContact._ContactRelationship.ContactPersonVIPType AS ContactPersonVIPType,
I_BPContact._ContactRelationship.ContactPersonAuthorityType AS ContactPersonAuthorityType,
I_BPContact._ContactRelationship.ContactPersonRemarkText AS ContactPersonRemarkText,
I_BPContact._ContactAddress.Floor AS Floor,
I_BPContact._ContactAddress.Building AS Building,
I_BPContact._ContactAddress.RoomNumber AS RoomNumber,
I_BPContact._ContactAddress.InternationalPhoneNumber AS InternationalPhoneNumber,
I_BPContact. _ContactAddress.PhoneNumberCountry AS PhoneNumberCountry,
case when _BusinessPartnerCompany.BusinessPartnerCategory = '1' then I_BPContact._ContactRelationship.PhoneNumber when _BusinessPartnerCompany.BusinessPartnerCategory != '1' and I_BPContact._ContactAddress.PhoneNumber is not null then I_BPContact._ContactAddress.PhoneNumber when _BusinessPartnerCompany.BusinessPartnerCategory != '1' and I_BPContact._ContactAddress.PhoneNumber is null then I_BPContact._ContactRelationship.PhoneNumber end as PhoneNumber AS PhoneNumberendasPhoneNumber,
I_BPContact._ContactRelationship.PhoneNumberExtension AS PhoneNumberExtension,
I_BPContact._ContactAddress.InternationalMobilePhoneNumber AS InternationalMobilePhoneNumber,
I_BPContact._ContactAddress.MobilePhoneCountry AS MobilePhoneCountry,
I_BPContact._ContactAddress.MobilePhoneNumber AS MobilePhoneNumber,
I_BPContact._ContactAddress.MobilePhoneNumberExtension AS MobilePhoneNumberExtension,
I_BPContact._ContactAddress.FaxCountry AS FaxCountry,
I_BPContact._ContactAddress.InternationalFaxNumber AS InternationalFaxNumber,
I_BPContact._ContactRelationship.FaxNumber AS FaxNumber,
I_BPContact._ContactRelationship.FaxNumberExtension AS FaxNumberExtension,
I_BPContact._ContactRelationship.EmailAddress AS EmailAddress,
I_BPContact._ContactAddress.AuthorizationGroup AS AuthorizationGroup,
I_BPContact._ContactAddress.IsBusinessPurposeCompleted AS IsBusinessPurposeCompleted,
I_BPContact._ContactAddress.IsDefaultAddress AS IsDefaultAddress,
_BusinessPartnerPerson.BusinessPartnerName AS BusinessPartnerName,
I_BPContact._BusinessPartnerCompany.BusinessPartnerUUID AS PartnerUUID,
I_BPContact._BusinessPartnerPerson.BusinessPartnerUUID AS PersonUUID,
_BusinessPartnerPerson._CurrentDefaultAddress.AddressID AS AddressID,
I_BPContact._ContactRelationship._CntctPersnFuncValueHelp AS _CntctPersnFuncValueHelp,
I_BPContact._ContactRelationship._ContactPersonFunctionText AS _ContactPersonFunctionText,
I_BPContact._ContactRelationship._CntctPersnDeptValueHelp AS _CntctPersnDeptValueHelp,
I_BPContact._ContactRelationship._ContactPersonDepartmentText AS _ContactPersonDepartmentText,
_BusinessPartnerPerson._CurrentDefaultAddress._StandardAddress AS _StandardAddress
FROM I_BPContact
LEFT OUTER JOIN I_BusinessPartner AS _BusinessPartnerCompany ON _BusinessPartnerCompany.BusinessPartner = BusinessPartnerCompany -- association [1..1]
LEFT OUTER JOIN I_BusinessPartner AS _BusinessPartnerPerson ON _BusinessPartnerPerson.BusinessPartner = BusinessPartnerPerson -- association [1..1]
LEFT OUTER JOIN I_ContactPersondepartment AS _ContactPersonDepartment ON _ContactPersonDepartment.ContactPersonDepartment = contactpersondepartment -- association [1..1]
LEFT OUTER JOIN I_ContactPersonFunction AS _ContactPersonFunction ON _ContactPersonFunction.ContactPersonFunction = contactpersonfunction -- association [1..1]
;