P_PL_SAFTInvoiceFileHeading

DDL: P_PL_SAFTINVOICEFILEHEADING SQL: PPLSAFTINVFILEH Type: view CONSUMPTION Package: GLO_FIN_IS_SAFT_PL

SAF-T PL Invoice File Heading data

P_PL_SAFTInvoiceFileHeading is a Consumption CDS View that provides data about "SAF-T PL Invoice File Heading data" in SAP S/4HANA. It reads from 2 data sources (I_CompanyCode, I_PL_SAFTGeneralSettings) and exposes 15 fields with key field CompanyCode. Part of development package GLO_FIN_IS_SAFT_PL.

Data Sources (2)

SourceAliasJoin Type
I_CompanyCode Company from
I_PL_SAFTGeneralSettings Settings inner

Parameters (2)

NameTypeDefault
P_StartDate datum
P_EndDate datum

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PPLSAFTINVFILEH view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
VDM.private true view
VDM.viewType #CONSUMPTION view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #P view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (15)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_CompanyCode CompanyCode
AddresseeFullNameendasCompanyName
CityName1endasCompanyCodeAddress
RegionNameendelseendasRegion
StreetNameendasStreetName
HouseNumberendasHouseNumber
CityNameendasHomeCityName
PostalCodeendasPostalCode
CityName
PhoneNumber
EmailAddress I_PL_SAFTGeneralSettings EmailAddress
PL_TaxOfficeCode I_PL_SAFTGeneralSettings PL_TaxOfficeCode
CompanyCodeCurrency I_CompanyCode Currency
Country I_CompanyCode Country
_Currency _Currency
@AbapCatalog.sqlViewName: 'PPLSAFTINVFILEH'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass:  #MIXED
@ObjectModel.usageType.serviceQuality: #P
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_PL_SAFTInvoiceFileHeading
  with parameters
    P_StartDate : datum,
    P_EndDate   : datum
  as select from           I_CompanyCode            as Company
    inner join             I_PL_SAFTGeneralSettings as Settings on  Settings.CompanyCode       = Company.CompanyCode
                                                                and Settings.ValidityEndDate   >= $parameters.P_StartDate
                                                                and Settings.ValidityStartDate <= $parameters.P_EndDate
    left outer to one join P_PL_SAFTCoCodeCountry               on Company.CompanyCode = P_PL_SAFTCoCodeCountry.CompanyCode
{
  key Company.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_SAFTCoCodeCountry._Address.AddresseeFullName
        end                                                as CompanyName,

      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_SAFTCoCodeCountry._Address.StreetName,
             P_PL_SAFTCoCodeCountry._Address.HouseNumber, 1),
             P_PL_SAFTCoCodeCountry._Address.PostalCode, 1),
             P_PL_SAFTCoCodeCountry._Address.CityName, 1)
          end                                           as CompanyCodeAddress,


      case
        when Company.Country = 'PL'
         then
            case
              when Company._Address.Region is initial
                then 'Nie dotyczy'
              else Company._Address._Region._RegionText[1: Language = 'L'].RegionName
             end
          when P_PL_SAFTCoCodeCountry._Address.Country = 'PL'
            then
            case
              when P_PL_SAFTCoCodeCountry._Address.Region is initial
                then 'Nie dotyczy'
              else P_PL_SAFTCoCodeCountry._Address._Region._RegionText[1: Language = 'L'].RegionName
             end
           else
           ''
          end                                              as Region,

      case
       when Company.Country = 'PL'
        then
           Settings.PL_CompanyDistrictName
        when P_PL_SAFTCoCodeCountry._Address.Country = 'PL'
              then Settings.PL_CompanyDistrictName
         else
           ''
         end                                               as PL_CompanyDistrictName,

      case
       when Company.Country = 'PL'
        then
           Settings.PL_CompanySubDistrictName
       when P_PL_SAFTCoCodeCountry._Address.Country = 'PL'
        then Settings.PL_CompanySubDistrictName
         else
          ''
         end                                               as PL_CompanySubDistrictName,

      case
        when Company.Country = 'PL'
          then Company._Address.StreetName
       when Company.Country <> 'PL'
          then P_PL_SAFTCoCodeCountry._Address.StreetName
        end                                                as StreetName,

      case
      when Company.Country = 'PL'
        then Company._Address.HouseNumber
      when Company.Country <> 'PL'
        then P_PL_SAFTCoCodeCountry._Address.HouseNumber
      end                                                  as HouseNumber,

      case
       when Company.Country = 'PL'
         then Company._Address.HouseNumberSupplementText
       when Company.Country <> 'PL'
         then P_PL_SAFTCoCodeCountry._Address.HouseNumberSupplementText
       end                                                 as HouseNumberSupplementText,

      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_SAFTCoCodeCountry._Address.CityName
       end                                                 as HomeCityName,

      case
       when Company.Country = 'PL'
         then Company._Address.PostalCode
         when Company.Country <> 'PL'
          then P_PL_SAFTCoCodeCountry._Address.PostalCode
         end                                               as PostalCode,

      // X means Podmiot1 and '' means Podmiot2

      case
      when Company.Country <> 'PL'
        then
          case
            when P_PL_SAFTCoCodeCountry._Address.Country = 'PL'
              then 'Y'
            else
               'N'
          end
      when Company.Country = 'PL'
      then 'Y'
      end                                                  as PL_IndicatorIsTrueOrFalse,


      Company._Address.CityName                            as CityName,
      Company._Address.PhoneNumber                         as PhoneNumber,
      case
        when Company.Country = 'PL'
          then
            replace(Company.VATRegistration, Company.Country,'')
          else
            replace(P_PL_SAFTCoCodeCountry.VATRegistration, P_PL_SAFTCoCodeCountry.VATRegistrationCountry, '' )
          end                                          as CompanyVATRegistration,

      Settings.EmailAddress,
      Settings.PL_TaxOfficeCode,
      Company.Currency                                     as CompanyCodeCurrency,
      Company.Country,

      _Currency

}