I_PT_SAFTCUSTADDRHIST

CDS View

SAF-T PT Customer Address History

I_PT_SAFTCUSTADDRHIST is a CDS View in S/4HANA. SAF-T PT Customer Address History. It contains 12 fields. 4 CDS views read from this table.

CDS Views using this table (4)

ViewTypeJoinVDMDescription
I_PT_DelDocCustAddrHist view inner COMPOSITE SAF-T PT Delivery Doc CustAddr History
I_PT_SAFTAcctgDocCustAddrHist view inner COMPOSITE SAF-T PT AccountingDoc CustAddr History
I_PT_SAFTBillgDocCustAddrHist view inner COMPOSITE SAF-T PT BillingDoc CustAddr History
I_PT_SAFTSelfBillgCustAddrHist view left_outer COMPOSITE SAF-T PT Self-Billing CustAddr History

Fields (12)

KeyField CDS FieldsUsed in Views
KEY Customer Customer 2
_Customer _Customer 2
CityName CityName 3
CompanyName CompanyName 3
Country Country 3
CustomerSupplierAddress CustomerSupplierAddress 3
CustomerVATRegistration CustomerVATRegistration 3
EmailAddress EmailAddress 3
FaxNumber FaxNumber 3
PhoneNumber PhoneNumber 3
PostalCode PostalCode 3
SearchURLAddress SearchURLAddress 3
@AbapCatalog.sqlViewName: 'IPTSAFTADRHST'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #COMPOSITE
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.serviceQuality: #D
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@EndUserText.label: 'SAF-T PT Customer Address History'
define view I_PT_SAFTCustAddrHist  
  as select from I_PT_CustomerAddressHistory as History                                                                              
  association [0..*] to I_ContactPerson as _ContactPerson on History.Customer = _ContactPerson.Customer

{
  key History.Customer                                                                                              as Customer,
  key PortugueseCustomerVersion                                                                                     as PortugueseCustomerVersion,

      History.AddressID                                                                                             as AddressID,

      cast(case
      when _Customer.VATRegistration is not initial
      then substring(_Customer.VATRegistration,3,18)
      when _Customer.TaxNumber1 is not initial
      then _Customer.TaxNumber1
      when _Customer.IsOneTimeAccount is initial
      then 'Desconhecido'
      else ''
      end as stceg)                                                                                                 as CustomerVATRegistration,

      cast(case
      when OrganizationBPName1 is not initial and OrganizationBPName2 is not initial
      then concat_with_space(OrganizationBPName1,OrganizationBPName2,1)
      when OrganizationBPName1 is not initial
      then OrganizationBPName1
      when OrganizationBPName2 is not initial
      then OrganizationBPName2
      end as bu_name1tx)                                                                                            as CompanyName,

//      min(_ContactPerson.FirstName) 

       _ContactPerson.FirstName                                                                                     as PartnerFirstName,

//      min(_ContactPerson.LastName)                                                                                as PartnerLastName,

       _ContactPerson.LastName                                                                                      as PartnerLastName,

      cast(concat_with_space(concat_with_space((concat_with_space(
           concat_with_space(StreetName,StreetPrefixName,1),
           concat_with_space(AdditionalStreetPrefixName,StreetSuffixName,1),1)
           ),AdditionalStreetSuffixName,1),HouseNumber,1)
      as fieu_address)                                                                                              as CustomerSupplierAddress,

      CityName                                                                                                      as CityName,

      cast(case
      when PostalCode is not initial
      then PostalCode
      when POBox is not initial
      then concat_with_space('Caixa Postal',POBox,1)
      else 'Omisso'
      end as ad_pstcd1)                                                                                             as PostalCode,

      Country                                                                                                       as Country,

      _Address._PhoneNumber.PhoneAreaCodeSubscriberNumber                                                           as PhoneNumber,

      _Address._FaxNumber.FaxAreaCodeSubscriberNumber                                                               as FaxNumber,

      _Address._EmailAddress.EmailAddress                                                                           as EmailAddress,
      
//    _Address._UniformResourceIdentifier.UniformResourceIdentifier                                               as SearchURLAddress,

      
      cast('' as ad_uri2)                                                                                           as SearchURLAddress,
      
      /* Associations */
      //FOR DPP AUTHORIZATION CHECK

      History._Customer

}
//group by

//  History.Customer,

//  PortugueseCustomerVersion,

//  AddressID,

//  _Customer.VATRegistration,

//  _Customer.TaxNumber1,

//  _Customer.IsOneTimeAccount,

//  OrganizationBPName1,

//  OrganizationBPName2,

//  StreetName,

//  StreetPrefixName,

//  AdditionalStreetPrefixName,

//  StreetSuffixName,

//  AdditionalStreetSuffixName,

//  HouseNumber,

//  CityName,

//  PostalCode,

//  POBox,

//  Country,

//  _Address._PhoneNumber.PhoneAreaCodeSubscriberNumber,

//  _Address._FaxNumber.FaxAreaCodeSubscriberNumber,

//  _Address._EmailAddress.EmailAddress

//  

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDRESSEMAILADDRESS_2",
"I_ADDRESSFAXNUMBER_2",
"I_ADDRESSPHONENUMBER_2",
"I_ADDRESS_2",
"I_CONTACTPERSON",
"I_CUSTOMER",
"I_PT_CUSTOMERADDRESSHISTORY"
],
"ASSOCIATED":
[
"I_CONTACTPERSON",
"I_CUSTOMER"
],
"BASE":
[
"I_PT_CUSTOMERADDRESSHISTORY"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/