P_PL_SAFTFileHeading is a Consumption CDS View that provides data about "SAF-T PL KR PD File Heading" in SAP S/4HANA. It reads from 2 data sources (I_CompanyCode, I_PL_SAFTGeneralSettings) and exposes 16 fields with key field CompanyCode. Part of development package GLO_FIN_IS_SAFT_PL.
@AbapCatalog.viewEnhancementCategory: [#NONE]@AccessControl.authorizationCheck: #NOT_REQUIRED@VDM.private: true@VDM.viewType: #CONSUMPTION@Metadata.ignorePropagatedAnnotations: true@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}defineviewentity P_PL_SAFTFileHeading withparameters
P_StartDate : datum,
P_EndDate : datum
asselectfrom I_CompanyCode as Company
innerjoin I_PL_SAFTGeneralSettings as Settings on Settings.CompanyCode = Company.CompanyCode
and Settings.ValidityEndDate >= $parameters.P_StartDate
and Settings.ValidityStartDate <= $parameters.P_EndDate
leftouter to one join P_PL_SAFTCompanyCodeCountry on Company.CompanyCode = P_PL_SAFTCompanyCodeCountry.CompanyCode
{
key Company.CompanyCode,
casewhen 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
endas CompanyName,
casewhen 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)
endas CompanyCodeAddress,
casewhen Company.Country = 'PL'
thencasewhen Company._Address.Region is initial
then 'Nie dotyczy'
else Company._Address._Region._RegionText[1: Language = 'L'].RegionName
endwhen P_PL_SAFTCompanyCodeCountry._Address.Country = 'PL'
thencasewhen P_PL_SAFTCompanyCodeCountry._Address.Region is initial
then 'Nie dotyczy'
else P_PL_SAFTCompanyCodeCountry._Address._Region._RegionText[1: Language = 'L'].RegionName
endelse
''
endas Region,
casewhen Company.Country = 'PL'
then
Settings.PL_CompanyDistrictName
when P_PL_SAFTCompanyCodeCountry._Address.Country = 'PL'
then Settings.PL_CompanyDistrictName
else
''
endas PL_CompanyDistrictName,
casewhen Company.Country = 'PL'
then
Settings.PL_CompanySubDistrictName
when P_PL_SAFTCompanyCodeCountry._Address.Country = 'PL'
then Settings.PL_CompanySubDistrictName
else
''
endas PL_CompanySubDistrictName,
casewhen Company.Country = 'PL'
then Company._Address.StreetName
when Company.Country <> 'PL'
then P_PL_SAFTCompanyCodeCountry._Address.StreetName
endas StreetName,
casewhen Company.Country = 'PL'
then Company._Address.HouseNumber
when Company.Country <> 'PL'
then P_PL_SAFTCompanyCodeCountry._Address.HouseNumber
endas HouseNumber,
casewhen Company.Country = 'PL'
then Company._Address.HouseNumberSupplementText
when Company.Country <> 'PL'
then P_PL_SAFTCompanyCodeCountry._Address.HouseNumberSupplementText
endas HouseNumberSupplementText,
casewhen Company.Country = 'PL'
thencasewhen Company._Address.HomeCityName is initial
then Company._Address.CityName
else Company._Address.HomeCityName
endwhen Company.Country <> 'PL'
then P_PL_SAFTCompanyCodeCountry._Address.CityName
endas HomeCityName,
casewhen Company.Country = 'PL'
then Company._Address.PostalCode
when Company.Country <> 'PL'
then P_PL_SAFTCompanyCodeCountry._Address.PostalCode
endas PostalCode,
// X means Podmiot1 and '' means Podmiot2
casewhen Company.Country <> 'PL'
thencasewhen P_PL_SAFTCompanyCodeCountry._Address.Country = 'PL'
then 'Y'
else
'N'
endwhen Company.Country = 'PL'
then 'Y'
endas PL_IndicatorIsTrueOrFalse,
Company._Address.CityName as CityName,
Company._Address.PhoneNumber as PhoneNumber,
replace(Company.VATRegistration, Company.Country,'') as CompanyVATRegistration,
Settings.EmailAddress,
Settings.PL_TaxOfficeCode,
Company.Currency as CompanyCodeCurrency,
Company.Country,
Company._Currency
}