P_PL_SAFTFileHeading

DDL: P_PL_SAFTFILEHEADING Type: view_entity CONSUMPTION

P_PL_SAFTFileHeading is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (I_CompanyCode, I_PL_SAFTGeneralSettings) and exposes 16 fields with key field CompanyCode.

Data Sources (2)

SourceAliasJoin Type
I_CompanyCode Company from
I_PL_SAFTGeneralSettings Settings inner

Parameters (2)

NameTypeDefault
P_StartDate datum
P_EndDate datum

Annotations (7)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #CONSUMPTION view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.usageType.dataClass #MIXED view

Fields (16)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_CompanyCode CompanyCode Receiver Company Code
AddresseeFullNameendasCompanyName
CityName1endasCompanyCodeAddress
RegionNameendendelseendasRegion
StreetNameendasStreetName
HouseNumberendasHouseNumber
CityNameendasHomeCityName
PostalCodeendasPostalCode
CityName
PhoneNumber
CompanyVATRegistration
EmailAddress I_PL_SAFTGeneralSettings EmailAddress E-Mail Address
PL_TaxOfficeCode I_PL_SAFTGeneralSettings PL_TaxOfficeCode Tax Office Code
CompanyCodeCurrency I_CompanyCode Currency Valuation Crcy
Country I_CompanyCode Country Venue: Ctry/Reg
_Currency I_CompanyCode _Currency

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 P_PL_SAFTFileHeading.
-- 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.
-- Parameters: P_StartDate : datum, P_EndDate : datum

CREATE VIEW P_PL_SAFTFileHeading AS
SELECT
  Company.CompanyCode AS CompanyCode,
  case when Company.Country = 'PL' then concat_with_space( concat_with_space( concat_with_space( Company._Address.BusinessPartnerName1, Company._Address.BusinessPartnerName2, 1), Company._Address.BusinessPartnerName3, 1), Company._Address.BusinessPartnerName4, 1) else P_PL_SAFTCompanyCodeCountry._Address.AddresseeFullName end as CompanyName AS AddresseeFullNameendasCompanyName,
  case when Company.Country = 'PL' then concat_with_space(concat_with_space(concat_with_space( Company._Address.StreetName, Company._Address.HouseNumber, 1), Company._Address.PostalCode, 1), Company._Address.CityName, 1) else concat_with_space(concat_with_space(concat_with_space( P_PL_SAFTCompanyCodeCountry._Address.StreetName, P_PL_SAFTCompanyCodeCountry._Address.HouseNumber, 1), P_PL_SAFTCompanyCodeCountry._Address.PostalCode, 1), P_PL_SAFTCompanyCodeCountry._Address.CityName, 1) end as CompanyCodeAddress AS CityName1endasCompanyCodeAddress,
  case when Company.Country = 'PL' then case when Company._Address.Region is initial then 'Nie dotyczy' else case when Company._Address._Region._RegionText[1: Language = 'L'].RegionName is not initial then Company._Address._Region._RegionText[1: Language = 'L'].RegionName when Company._Address._Region._RegionText[1: Language = 'L'].RegionName is initial then Company._Address._Region._RegionText[1: Language = $session.system_language].RegionName else Company._Address._Region._RegionText[1: Language = 'E'].RegionName end end when P_PL_SAFTCompanyCodeCountry._Address.Country = 'PL' then case when P_PL_SAFTCompanyCodeCountry._Address.Region is initial then 'Nie dotyczy' else case when P_PL_SAFTCompanyCodeCountry._Address._Region._RegionText[1: Language = 'L'].RegionName is not initial then P_PL_SAFTCompanyCodeCountry._Address._Region._RegionText[1: Language = 'L'].RegionName when P_PL_SAFTCompanyCodeCountry._Address._Region._RegionText[1: Language = 'L'].RegionName is initial then P_PL_SAFTCompanyCodeCountry._Address._Region._RegionText[1: Language = $session.system_language].RegionName else P_PL_SAFTCompanyCodeCountry._Address._Region._RegionText[1: Language = 'E'].RegionName end end else '' end as Region AS RegionNameendendelseendasRegion,
  case when Company.Country = 'PL' then Company._Address.StreetName when Company.Country <> 'PL' then P_PL_SAFTCompanyCodeCountry._Address.StreetName end as StreetName AS StreetNameendasStreetName,
  case when Company.Country = 'PL' then Company._Address.HouseNumber when Company.Country <> 'PL' then P_PL_SAFTCompanyCodeCountry._Address.HouseNumber end as HouseNumber AS HouseNumberendasHouseNumber,
  case when Company.Country = 'PL' then case when Company._Address.HomeCityName is initial then Company._Address.CityName else Company._Address.HomeCityName end when Company.Country <> 'PL' then P_PL_SAFTCompanyCodeCountry._Address.CityName end as HomeCityName AS CityNameendasHomeCityName,
  case when Company.Country = 'PL' then Company._Address.PostalCode when Company.Country <> 'PL' then P_PL_SAFTCompanyCodeCountry._Address.PostalCode end as PostalCode AS PostalCodeendasPostalCode,
  Company._Address.CityName AS CityName,
  Company._Address.PhoneNumber AS PhoneNumber,
  replace(Company.VATRegistration, Company.Country,'') AS CompanyVATRegistration,
  Settings.EmailAddress AS EmailAddress,
  Settings.PL_TaxOfficeCode AS PL_TaxOfficeCode,
  Company.Currency AS CompanyCodeCurrency,
  Company.Country AS Country,
  Company._Currency AS _Currency
FROM I_CompanyCode AS Company
INNER JOIN I_PL_SAFTGeneralSettings AS Settings ON /* join condition not captured in parsed metadata */
;