I_PT_SAFTDeliveryOneTimeCust_2

DDL: I_PT_SAFTDELIVERYONETIMECUST_2 Type: view_entity COMPOSITE Package: GLO-LOG-PT

One Time Customer for SAFT

I_PT_SAFTDeliveryOneTimeCust_2 is a Composite CDS View that provides data about "One Time Customer for SAFT" in SAP S/4HANA. It reads from 1 data source (I_PT_SAFTCustPartnerFunction) and exposes 16 fields with key fields Customer, CompanyCode, PortugueseDeliveryNumber, DeliveryDocument. Part of development package GLO-LOG-PT.

Data Sources (1)

SourceAliasJoin Type
I_PT_SAFTCustPartnerFunction cust from

Annotations (8)

NameValueLevelField
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #MANDATORY view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.dataClass #MIXED view
AccessControl.personalData.blocking #REQUIRED view
EndUserText.label One Time Customer for SAFT view

Fields (16)

KeyFieldSource TableSource FieldDescription
KEY Customer Customer
KEY CompanyCode CompanyCode
KEY PortugueseDeliveryNumber PortugueseDeliveryNumber
KEY DeliveryDocument I_PT_SAFTCustPartnerFunction DeliveryDocument
DeliveryDate DeliveryDate
IsOneTimeAccount
CustomerVATRegistration CustomerVATRegistration
Country
InternationalPhoneNumberendasPhoneNumber
ShipToPartyRegionelseendasRegion
PT_ShipToPartyAddressAsText I_PT_SAFTCustPartnerFunction PT_ShipToPartyAddressAsText
AddressID
_DfltAddrRprstn
AddressPersonID
FaxNumber I_PT_SAFTCustPartnerFunction FaxNumber
WebsiteURL I_PT_SAFTCustPartnerFunction WebsiteURL
@VDM.viewType:#COMPOSITE // #BASIC

@AccessControl.authorizationCheck: #MANDATORY
@Metadata.ignorePropagatedAnnotations:true
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.dataClass: #MIXED
@AccessControl.personalData.blocking: #REQUIRED
@EndUserText.label:'One Time Customer for SAFT'

define view entity I_PT_SAFTDeliveryOneTimeCust_2
  as select from I_PT_SAFTCustPartnerFunction as cust 
{

  key Customer                              as Customer,
  key CompanyCode                           as CompanyCode,
  key PortugueseDeliveryNumber              as PortugueseDeliveryNumber,
  key cust.DeliveryDocument,
      DeliveryDate                          as DeliveryDate,

      cast( cust.IsOneTimeAccount as xcpdk) as IsOneTimeAccount,
      CustomerVATRegistration,

   /* case
        when cust.VATRegistration is initial or cust.VATRegistration is null
         then concat(cust.Customer, concat('/',  '999999990'))
        else concat(cust.Customer, concat('/',  cust.VATRegistration))
      end                                   as BusinessPartnerCustomer, */
       

      case
         when cust.ShipToPartyStreetName is not null and cust.ShipToPartyStreetName is not initial
           then cust.ShipToPartyStreetName
         else 'Desconhecido'
      end                                   as StreetName,


      case
           when cust.ShipToPartyHouseNumber is not null and cust.ShipToPartyHouseNumber is not initial
             then cust.ShipToPartyHouseNumber
          else ''
      end                                   as HouseNumber,

      case
           when cust.ShipToPartyCityName is not null and cust.ShipToPartyCityName is not initial
               then cust.ShipToPartyCityName
           else 'Desconhecido'
      end                                   as CityName,


      case
          when cust.ShipToPartyPostalCode is not null and cust.ShipToPartyPostalCode is not initial
          then cust.ShipToPartyPostalCode
          else '0000-000'
      end                                   as PostalCode,

      cast( cust.ShipToPartyCountry as land1) as Country,

      case
           when cust._CustPartner._DfltAddrRprstn._PhoneNumber.InternationalPhoneNumber is not null and cust._CustPartner._DfltAddrRprstn._PhoneNumber.InternationalPhoneNumber is not initial
           then cust._CustPartner._DfltAddrRprstn._PhoneNumber.InternationalPhoneNumber
      end                                   as PhoneNumber,

      case
          when cust.ShipToPartyRegion is not null and cust.ShipToPartyRegion is not initial
          then cust.ShipToPartyRegion
          else ''
      end                                   as Region,  
      
     case
           when cust.PT_ShipToPartyCompanyName is not null and cust.PT_ShipToPartyCompanyName is not initial
             then cust.PT_ShipToPartyCompanyName
          else ''
      end                                   as CompanyName,
   

 case
  when (  CustomerVATRegistration is initial 
         and ( HouseNumber is initial 
               and StreetName  is initial
               and CityName    is initial
               and PostalCode  is initial
               and Country     is initial ) )
    then cust.Customer

  when ( CustomerVATRegistration is initial 
         and ( HouseNumber is not initial
               or StreetName  is not initial
               or CityName    is not initial
               or PostalCode  is not initial
               or Country     is not initial ) )
    then concat( cust.Customer, concat( '_', cust.DeliveryDocument ) )

 when ( CustomerVATRegistration is not initial )
    then concat( CustomerVATRegistration,
                 concat( '_', cust.DeliveryDocument ) )              
 
     else ''                     

    end as BusinessPartnerCustomer, 
      cust.PT_ShipToPartyAddressAsText,     
      cust._CustPartner.AddressID,
      cust._CustPartner._DfltAddrRprstn,
      cust._CustPartner.AddressPersonID,
      cust.FaxNumber,
     // cust.EmailAddress,

      cust.WebsiteURL 

}
where
      cust.IsOneTimeAccount           =  'X'
  and cust.PortugueseDigitalSignature <> ''