I_PT_SAFTDeliveryHeader
SAFT Movement of Goods Header Portugal
I_PT_SAFTDeliveryHeader is a Composite CDS View that provides data about "SAFT Movement of Goods Header Portugal" in SAP S/4HANA. It reads from 2 data sources (I_DeliveryDocument, I_PT_DeliveryDgtlSgntr) and exposes 41 fields with key field PortugueseDeliveryNumber. It has 7 associations to related views. Part of development package GLO-LOG-PT.
Data Sources (2)
| Source | Alias | Join Type |
|---|---|---|
| I_DeliveryDocument | DeliveryDocument | inner |
| I_PT_DeliveryDgtlSgntr | DigitalSignature | from |
Associations (7)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [0..1] | I_PT_DeliveryNumberRange | _MovementType | _MovementType.CompanyCode = DigitalSignature.CompanyCode and _MovementType.DeliveryDocumentType = DigitalSignature.DeliveryDocumentType |
| [0..1] | I_PT_DeliveryShipFromAddress | _ShipFromAddress | _ShipFromAddress.DeliveryDocument = $projection.DeliveryDocument |
| [0..*] | I_PT_SAFTDeliveryCustDetail | _ShipToAddress | _ShipToAddress.PortugueseDeliveryNumber = DigitalSignature.PortugueseDeliveryNumber |
| [0..1] | I_PT_SDDocumentProcessFlow | _SDDocumentProcessFlow | _SDDocumentProcessFlow.DeliveryDocument = $projection.DeliveryDocument |
| [0..1] | I_PT_SAFTHeaderGrossTotal | _TotalForeignCurrency | _TotalForeignCurrency.PortugueseDeliveryNumber = $projection.PortugueseDeliveryNumber |
| [1..1] | I_PT_SAFTDeliveryHeaderAmt | _AmountTotals | _AmountTotals.PortugueseDeliveryNumber = $projection.PortugueseDeliveryNumber |
| [0..1] | I_SAFTDeliverySupplier | _DelSupplier | _DelSupplier.PortugueseDeliveryNumber = $projection.PortugueseDeliveryNumber |
Annotations (12)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | IPTSAFTDELHDR | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| VDM.viewType | #COMPOSITE | view | |
| AccessControl.authorizationCheck | #CHECK | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| Metadata.ignorePropagatedAnnotations | true | view | |
| ObjectModel.usageType.sizeCategory | #XL | view | |
| ObjectModel.usageType.serviceQuality | #X | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| AccessControl.personalData.blocking | #NOT_REQUIRED | view | |
| EndUserText.label | SAFT Movement of Goods Header Portugal | view |
Fields (41)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | PortugueseDeliveryNumber | PortugueseDeliveryNumber | ||
| DeliveryDocument | I_DeliveryDocument | DeliveryDocument | ||
| ShipToParty | ShipToParty | |||
| CreationDate | I_PT_DeliveryDgtlSgntr | PortugueseDigitalSignatureDate | ||
| CreationTime | I_PT_DeliveryDgtlSgntr | PortugueseDigitalSignatureTime | ||
| CompanyCode | I_PT_DeliveryDgtlSgntr | CompanyCode | ||
| DeliveryDocumentType | I_PT_DeliveryDgtlSgntr | DeliveryDocumentType | ||
| PortugueseReferenceDocument | I_PT_DeliveryDgtlSgntr | ReferenceDocumentNumber | ||
| PT_SeriesIdentifier | ||||
| PTDgtlSgntrSystemDateTimeText | PTDgtlSgntrSystemDateTimeText | |||
| CreatedByUser | I_DeliveryDocument | CreatedByUser | ||
| BillingPriceSource | ||||
| PortugueseDigitalSignature | PortugueseDigitalSignature | |||
| PortugueseDgtlSgntrKeyVersion | PortugueseDgtlSgntrKeyVersion | |||
| TransportationPlanningDate | I_DeliveryDocument | TransportationPlanningDate | ||
| PT_SeriesDocumentNumber | I_PT_DeliveryDgtlSgntr | PT_SeriesDocumentNumber | ||
| PortugueseSgntrCertificate | PortugueseSgntrCertificate | |||
| Supplier | _DelSupplier | Supplier | ||
| DeliveryDate | I_PT_DeliveryDgtlSgntr | DeliveryDate | ||
| CityNameendasShipToPartyCityName | ||||
| CountryendasShipToPartyCountry | ||||
| PostalCodeendasShipToPartyPostalCode | ||||
| StreetNameendasShipToPartyStreetName | ||||
| ShipToPartyHouseNumber | ||||
| HouseNumberendasCustAddressNumber | ||||
| CustomerRegion | ||||
| HouseNumber | _ShipFromAddress | HouseNumber | ||
| StreetName | _ShipFromAddress | StreetName | ||
| SupplierAddress | _ShipFromAddress | SupplierAddress | ||
| CityName | _ShipFromAddress | CityName | ||
| PostalCode | _ShipFromAddress | PostalCode | ||
| Region | _ShipFromAddress | Region | ||
| Country | _ShipFromAddress | Country | ||
| TransportationPlanningTimeZone | ||||
| TotalTaxAmount | ||||
| TotalNetAmount | ||||
| TotalGrossAmount | ||||
| InvoiceAmountInFrgnCurrency | _TotalForeignCurrency | InvoiceAmountInFrgnCurrency | ||
| GoodsIssueTime | I_DeliveryDocument | GoodsIssueTime | ||
| ExchangeRateelse0endasExchangeRate | ||||
| _SDDocumentProcessFlow | _SDDocumentProcessFlow |
@AbapCatalog.sqlViewName: 'IPTSAFTDELHDR'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #CHECK
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations:true
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.dataClass: #MIXED
@AccessControl.personalData.blocking: #NOT_REQUIRED
@EndUserText.label: 'SAFT Movement of Goods Header Portugal'
define view I_PT_SAFTDeliveryHeader
as select from I_PT_DeliveryDgtlSgntr as DigitalSignature
inner join I_DeliveryDocument as DeliveryDocument on DeliveryDocument.DeliveryDocument = DigitalSignature.DeliveryDocument
// ATCUD change for VAT determination
// inner join I_CompanyCode as _CompanyCode on _CompanyCode.CompanyCode = DigitalSignature.CompanyCode
association [0..1] to I_PT_DeliveryNumberRange as _MovementType on _MovementType.CompanyCode = DigitalSignature.CompanyCode
and _MovementType.DeliveryDocumentType = DigitalSignature.DeliveryDocumentType
association [0..1] to I_PT_DeliveryShipFromAddress as _ShipFromAddress on _ShipFromAddress.DeliveryDocument = $projection.DeliveryDocument
association [0..*] to I_PT_SAFTDeliveryCustDetail as _ShipToAddress on _ShipToAddress.PortugueseDeliveryNumber = DigitalSignature.PortugueseDeliveryNumber
association [0..1] to I_PT_SDDocumentProcessFlow as _SDDocumentProcessFlow on _SDDocumentProcessFlow.DeliveryDocument = $projection.DeliveryDocument
// association [0..1] to I_DeliveryDocumentItem as DeliveryDocumentItem on DeliveryDocumentItem.DeliveryDocument = $projection.DeliveryDocument
association [0..1] to I_PT_SAFTHeaderGrossTotal as _TotalForeignCurrency on _TotalForeignCurrency.PortugueseDeliveryNumber = $projection.PortugueseDeliveryNumber
//association [0..1] to I_PurchasingDocument as _PurchasingDocument on _PurchasingDocument.PurchasingDocument = DeliveryDocument._Item
//association [0..1] to C_PT_SAFTDeliveryDocTotCheck as _SAFTDeliveryDocTotCheck on _SAFTDeliveryDocTotCheck.CompanyCode = $projection.CompanyCode
association [1..1] to I_PT_SAFTDeliveryHeaderAmt as _AmountTotals on _AmountTotals.PortugueseDeliveryNumber = $projection.PortugueseDeliveryNumber
association [0..1] to I_SAFTDeliverySupplier as _DelSupplier on _DelSupplier.PortugueseDeliveryNumber = $projection.PortugueseDeliveryNumber
{
key PortugueseDeliveryNumber as PortugueseDeliveryNumber,
DeliveryDocument.DeliveryDocument,
ShipToParty,
DigitalSignature.PortugueseDigitalSignatureDate as CreationDate,
DigitalSignature.PortugueseDigitalSignatureTime as CreationTime,
DigitalSignature.CompanyCode,
DigitalSignature.DeliveryDocumentType,
// ATCUD relevant changes
DigitalSignature.ReferenceDocumentNumber as PortugueseReferenceDocument,
// cast( substring(_CompanyCode.VATRegistration, 3, 18) as stceg) as VATRegistration,
cast( DigitalSignature.PortugueseDgtlSignatureSeries as glo_pt_series_id) as PT_SeriesIdentifier,
// 0 as DocumentIndex,
case
when _SDDocumentProcessFlow.PrecedingDocumentCategory is null or _SDDocumentProcessFlow.PrecedingDocumentCategory = ''
then
cast( case when DigitalSignature.GoodsMovementIsCancelled = 'X'
then 'A'
else 'N'
end as char1)
else
case
when _SDDocumentProcessFlow.PrecedingDocumentCategory = 'R'
then 'N'
else 'A'
end
end as GoodsMovementStatus,
PTDgtlSgntrSystemDateTimeText,
DeliveryDocument.CreatedByUser as CreatedByUser,
'P' as BillingPriceSource,
PortugueseDigitalSignature,
PortugueseDgtlSgntrKeyVersion,
DeliveryDocument.TransportationPlanningDate,
//ATCUD Changes
cast (case
when DigitalSignature.PT_SeriesDocumentType <> ''
then
DigitalSignature.PT_SeriesDocumentType
else
_MovementType.DeliveryType
end as glo_pt_series_dt) as PT_SeriesDocumentType,
DigitalSignature.PT_SeriesDocumentNumber,
PortugueseSgntrCertificate,
//CustomerID
case _ShipToAddress.IsOneTimeAccount
when 'X'
then
// case
// when _ShipToAddress._OnetimeCustomer.PortugueseCustomerWithVersion is not initial
// then _ShipToAddress._OnetimeCustomer.PortugueseCustomerWithVersion
// else ShipToParty //concat(ShipToParty,'_0') //ShipToParty
// end
coalesce( _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'AG' ].PortugueseCustomerWithVersion, coalesce( _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'WE' ].PortugueseCustomerWithVersion, $projection.shiptoparty ) )
else
case
when _ShipToAddress.PortugueseCustomerWithVersion is not initial
then _ShipToAddress.PortugueseCustomerWithVersion
else ShipToParty //concat(ShipToParty,'_0') //ShipToParty
end
end as PortugueseCustomerWithVersion,
// **SupplierID - Check the Vendor from the corresponding Purchase Order. EKKO-LIFNR
_DelSupplier.Supplier as Supplier,
//EACCode - Out of Scope
//MovementComments - Out of scope
DigitalSignature.DeliveryDate as DeliveryDate,
//Ship To Address - From VBPA get the PARVW 'WE' details and extract VBPA-ADRNR. Also extract the details from the History table for all the fields
case _ShipToAddress.IsOneTimeAccount
when 'X'
// then _ShipToAddress._OnetimeCustomer.CityName
then coalesce( _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'AG' ].CityName, _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'WE' ].CityName)
else
_ShipToAddress.CityName
end as ShipToPartyCityName,
case _ShipToAddress.IsOneTimeAccount
when 'X'
// then _ShipToAddress._OnetimeCustomer.country
then coalesce( _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'AG' ].Country, _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'WE' ].Country)
else
_ShipToAddress.Country
end as ShipToPartyCountry,
case _ShipToAddress.IsOneTimeAccount
when 'X'
// then _ShipToAddress._OnetimeCustomer.PostalCode
then coalesce( _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'AG' ].PostalCode, _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'WE' ].PostalCode)
else
_ShipToAddress.PostalCode
end as ShipToPartyPostalCode,
case _ShipToAddress.IsOneTimeAccount
when 'X'
// then _ShipToAddress._OnetimeCustomer.StreetName
then coalesce( _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'AG' ].StreetName, _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'WE' ].StreetName)
else
_ShipToAddress.StreetName
end as ShipToPartyStreetName,
_ShipToAddress._Addr.HouseNumber as ShipToPartyHouseNumber,
case _ShipToAddress.IsOneTimeAccount
when 'X'
// then concat ( _ShipToAddress._OnetimeCustomer.StreetName, _ShipToAddress._OnetimeCustomer.HouseNumber)
then concat ( coalesce( _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'AG' ].StreetName, _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'WE' ].StreetName ),
coalesce( _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'AG' ].HouseNumber, _ShipToAddress._OnetimeCustomer[ PartnerFunction = 'WE' ].HouseNumber ))
else concat ( _ShipToAddress._Addr.StreetName, _ShipToAddress._Addr.HouseNumber)
end as CustAddressNumber,
_ShipToAddress._Addr.Region as CustomerRegion,
// Ship From Address - "Get the Shipping Point Details from LIKP-VSTEL. Get adress number from TVST-ADRNR. If doc_category is 'GS' Get the Plant Details from LIKP-WERKS. Get adress number from T001w-ADRNR
_ShipFromAddress.HouseNumber as HouseNumber,
_ShipFromAddress.StreetName as StreetName,
_ShipFromAddress.SupplierAddress as SupplierAddress,
_ShipFromAddress.CityName as CityName,
_ShipFromAddress.PostalCode as PostalCode,
_ShipFromAddress.Region as Region,
_ShipFromAddress.Country as Country,
concat (concat(DeliveryDocument.TransportationPlanningDate,'/'), DeliveryDocument.TransportationPlanningTime) as TransportationPlanningTimeZone,
// Totals
cast( round(_AmountTotals.TotalTaxAmount, 2) as abap.dec(11,2) ) as TotalTaxAmount,
cast( round(_AmountTotals.TotalNetAmount, 2) as abap.dec(11,2) ) as TotalNetAmount,
round(( round(_AmountTotals.TotalTaxAmount, 2) + round(_AmountTotals.TotalNetAmount, 2)), 2) as TotalGrossAmount,
_TotalForeignCurrency.InvoiceAmountInFrgnCurrency as InvoiceAmountInFrgnCurrency,
DeliveryDocument.GoodsIssueTime as GoodsIssueTime,
case
when DeliveryDocument._SalesOrganization._CompanyCode.Currency <> _DelSupplier.TransactionCurrency
then abs(_DelSupplier.ExchangeRate)
else 0
end as ExchangeRate,
case
when DeliveryDocument._SalesOrganization._CompanyCode.Currency <> _DelSupplier.TransactionCurrency
then _DelSupplier.TransactionCurrency
else ''
end as TransactionCurrency,
_SDDocumentProcessFlow
}
where
PortugueseDigitalSignature <> ''
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA