Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.
-- Derived SQL interpretation of CDS view C_SlsDocFlfmtDelivDoc.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.
-- SQL view name: CSOFDELIVDOC
CREATE VIEW C_SlsDocFlfmtDelivDoc AS
SELECT
DelivDoc.DeliveryDocument AS DeliveryDocument,
DelivDoc.DeliveryDocumentType AS DeliveryDocumentType,
DelivDoc.ShippingPoint AS ShippingPoint,
DelivDoc._ShippingPoint._Text[1:Language=$session.system_language].ShippingPointName AS ShippingPointName,
DelivDoc.SalesOrganization AS SalesOrganization,
DelivDoc.CompleteDeliveryIsDefined AS CompleteDeliveryIsDefined,
DelivDoc.DeliveryBlockReason AS DeliveryBlockReason,
DelivDoc.HeaderGrossWeight AS HeaderGrossWeight,
DelivDoc.HeaderWeightUnit AS HeaderWeightUnit,
DelivDoc.TotalNumberOfPackage AS TotalNumberOfPackage,
DelivDocItemAmount.ActualDeliveryAmount AS ActualDeliveryAmount,
DelivDocItemAmount.TransactionCurrency AS TransactionCurrency,
DelivDoc.SoldToParty AS SoldToParty,
cast (DelivDoc._SoldToParty.CustomerName as vdm_sold_to_name) AS SoldToPartyName,
SoldToPartyAddressInfo.AddressObjectType AS AddressObjectType,
SoldToPartyAddressInfo.AddressPersonID AS AddressPersonID,
cast (DelivDoc._ShipToParty.CustomerName as ship_to_name) AS ShipToPartyName,
ShipToPartyAddressInfo.AddressObjectType AS ShipToPartyAddressObjectType,
ShipToPartyAddressInfo.AddressPersonID AS ShipToPartyAddressPersonID,
cast (Partner._BillToParty.CustomerName as bill_to_name) AS BillToPartyName,
Partner.PayerParty AS PayerParty,
cast (Partner._PayerParty.CustomerName as payer_name) AS PayerPartyName,
DelivDoc.PickingDate AS PickingDate,
DelivDoc.LoadingDate AS LoadingDate,
DelivDoc.ShippingType AS ShippingType,
DelivDoc.DeliveryDate AS DeliveryDate,
cast(DelivDoc.TransportationPlanningDate as tddat_plan) AS TransportationPlanningDate,
DelivDoc.ShippingCondition AS ShippingCondition,
cast(DelivDoc.PlannedGoodsIssueDate as wadak_plan) AS PlannedGoodsIssueDate,
cast(ActualGoodsMovementDate as vdm_actualgmdate) AS ActualGoodsMovementDate,
ProofOfDeliveryDate,
DelivDoc.BillingDocumentDate AS BillingDocumentDate,
DelivDoc.OverallSDProcessStatus AS OverallSDProcessStatus,
DelivDoc.TransportationPlanningStatus AS TransportationPlanningStatus,
cast(DelivDoc.OverallDelivReltdBillgStatus as deliv_rel_billg_status preserving type) AS OverallDelivReltdBillgStatus,
DelivDoc.OverallGoodsMovementStatus AS OverallGoodsMovementStatus,
cast(DelivDoc.OverallWarehouseActivityStatus as vdm_lvstk preserving type) AS OverallWarehouseActivityStatus,
DelivDoc.OverallProofOfDeliveryStatus AS OverallProofOfDeliveryStatus,
DelivDoc.OverallPackingStatus AS OverallPackingStatus,
DelivDoc.OverallPickingStatus AS OverallPickingStatus,
DelivDoc.HdrGeneralIncompletionStatus AS HdrGeneralIncompletionStatus,
DelivDoc.HeaderDelivIncompletionStatus AS HeaderDelivIncompletionStatus,
DelivDoc.HeaderBillgIncompletionStatus AS HeaderBillgIncompletionStatus,
DelivDoc.HeaderPackingIncompletionSts AS HeaderPackingIncompletionSts,
cast(DelivDoc.HeaderPickgIncompletionStatus as hdr_pickg_incompletion_status preserving type ) AS HeaderPickgIncompletionStatus,
cast(DelivDoc.HdrGoodsMvtIncompletionStatus as hdr_gdsmvt_incompletion_status preserving type) AS HdrGoodsMvtIncompletionStatus,
DelivDoc.OvrlItmGeneralIncompletionSts AS OvrlItmGeneralIncompletionSts,
DelivDoc.OvrlItmDelivIncompletionSts AS OvrlItmDelivIncompletionSts,
DelivDoc.OvrlItmPackingIncompletionSts AS OvrlItmPackingIncompletionSts,
cast(DelivDoc.OvrlItmPickingIncompletionSts as ovrlitm_pickg_incompltn_sts preserving type ) AS OvrlItmPickingIncompletionSts,
cast(DelivDoc.OvrlItmGdsMvtIncompletionSts as ovrlitm_gdsmvt_incompltn_sts preserving type ) AS OvrlItmGdsMvtIncompletionSts,
cast(DelivDoc.CentralCreditCheckStatus as central_credit_check_status preserving type) AS CentralCreditCheckStatus,
DelivDoc.FinDocCreditCheckStatus AS FinDocCreditCheckStatus,
DelivDoc.ExprtInsurCreditCheckStatus AS ExprtInsurCreditCheckStatus,
DelivDoc.PaytAuthsnCreditCheckSts AS PaytAuthsnCreditCheckSts,
cast(DelivDoc.OverallChmlCmplncStatus as mon_tdd_total_pcsta preserving type) AS OverallChmlCmplncStatus,
cast(DelivDoc.OverallDangerousGoodsStatus as mon_tdd_total_dgsta preserving type) AS OverallDangerousGoodsStatus,
cast(DelivDoc.OverallSafetyDataSheetStatus as mon_tdd_total_sdssta preserving type) AS OverallSafetyDataSheetStatus,
cast(DelivDoc.OverallTrdCmplncEmbargoSts as totembargochksts preserving type) AS OverallTrdCmplncEmbargoSts,
cast(DelivDoc.OvrlTrdCmplncSnctndListChkSts as totwatchlistscrngchksts preserving type) AS OvrlTrdCmplncSnctndListChkSts,
cast(DelivDoc.OvrlTrdCmplncLegalCtrlChkSts as totlglctrlchksts preserving type) AS OvrlTrdCmplncLegalCtrlChkSts,
cast( case when DeliveryBlockReason <> '' then 1 else 9 end as abap.int1 ) as DeliveryBlockReasonCriticality AS int1asDeliveryBlockReasonCriticality,
cast( case when DelivDoc.CentralCreditCheckStatus = 'D' or DelivDoc.CentralCreditCheckStatus = 'A' then 3 when DelivDoc.CentralCreditCheckStatus = '' then 0 else 1 end as abap.int1 ) as CentralCreditChkStsCriticality AS int1asCentralCreditChkStsCriticality,
cast( case when PaytAuthsnCreditCheckSts = 'D' or PaytAuthsnCreditCheckSts = 'A' then 3 when PaytAuthsnCreditCheckSts = '' then 0 else 1 end as abap.int1 ) as PaytAuthCrdtChkStsCriticality AS int1asPaytAuthCrdtChkStsCriticality,
cast( case when FinDocCreditCheckStatus = 'D' or FinDocCreditCheckStatus = 'A' then 3 when FinDocCreditCheckStatus = '' then 0 else 1 end as abap.int1 ) as FinDocCrdtCheckStsCriticality AS int1asFinDocCrdtCheckStsCriticality,
cast( case when ExprtInsurCreditCheckStatus = 'D' or ExprtInsurCreditCheckStatus = 'A' then 3 when ExprtInsurCreditCheckStatus = '' then 0 else 1 end as abap.int1 ) as ExprtInsurCrdtChkStsCritlty AS int1asExprtInsurCrdtChkStsCritlty,
cast( case when HdrGeneralIncompletionStatus <> 'C' then 1 else 3 end as abap.int1 ) as HdrGenIncompltnStsCriticality AS int1asHdrGenIncompltnStsCriticality,
cast( case when HeaderDelivIncompletionStatus <> 'C' then 1 else 3 end as abap.int1 ) as HdrDelivIncompltnStsCritlty AS int1asHdrDelivIncompltnStsCritlty,
cast( case when HeaderPickgIncompletionStatus <> 'C' then 1 else 3 end as abap.int1 ) as HdrPickingIncompltnStsCritlty AS int1asHdrPickingIncompltnStsCritlty,
cast( case when HeaderPackingIncompletionSts <> 'C' then 1 else 3 end as abap.int1 ) as HdrPackgIncompltnStsCritlty AS int1asHdrPackgIncompltnStsCritlty,
cast( case when HdrGoodsMvtIncompletionStatus <> 'C' then 1 else 3 end as abap.int1 ) as HdrGdsMvtIncompltnStsCritlty AS int1asHdrGdsMvtIncompltnStsCritlty,
cast( case when HeaderBillgIncompletionStatus <> 'C' then 1 else 3 end as abap.int1 ) as HdrBillgIncompltnStsCritlty AS int1asHdrBillgIncompltnStsCritlty,
cast( case when OvrlItmGeneralIncompletionSts <> 'C' then 1 else 3 end as abap.int1 ) as OvrlItmGenIncompltnStsCritlty AS int1asOvrlItmGenIncompltnStsCritlty,
cast( case when OvrlItmDelivIncompletionSts <> 'C' then 1 else 3 end as abap.int1 ) as OvrlItmDelivIncompltnCritlty AS int1asOvrlItmDelivIncompltnCritlty,
cast( case when OvrlItmPickingIncompletionSts <> 'C' then 1 else 3 end as abap.int1 ) as OvrlItmPickingIncompltnCritlty AS int1asOvrlItmPickingIncompltnCritlty,
cast( case when OvrlItmPackingIncompletionSts <> 'C' then 1 else 3 end as abap.int1 ) as OvrlItmPackgIncompltnCritlty AS int1asOvrlItmPackgIncompltnCritlty,
cast( case when OvrlItmGdsMvtIncompletionSts <> 'C' then 1 else 3 end as abap.int1 ) as OvrlItmGdsMvtIncompltnCritlty AS int1asOvrlItmGdsMvtIncompltnCritlty,
cast( case when OverallDelivReltdBillgStatus = 'C' then 3 when OverallDelivReltdBillgStatus = '' then 0 when OverallDelivReltdBillgStatus = 'A' and DelivDoc.BillingDocumentDate < $session.system_date or OverallDelivReltdBillgStatus = 'B' and DelivDoc.BillingDocumentDate < $session.system_date then 1 else 2 end as abap.int1 ) as OvrlDelivReltdBillgStsCritlty AS int1asOvrlDelivReltdBillgStsCritlty,
cast( case when TransportationPlanningStatus = 'C' then 3 when TransportationPlanningStatus = '' then 0 when TransportationPlanningStatus = 'A' and DelivDoc.TransportationPlanningDate < $session.system_date or TransportationPlanningStatus = 'B' and DelivDoc.TransportationPlanningDate < $session.system_date then 1 else 2 end as abap.int1 ) as TransportationPlngStsCritlty AS int1asTransportationPlngStsCritlty,
cast( case when OverallPickingStatus = 'C' then 3 when OverallPickingStatus = '' then 0 when OverallPickingStatus = 'A' and DelivDoc.PickingDate < $session.system_date or OverallPickingStatus = 'B' and DelivDoc.PickingDate < $session.system_date then 1 else 2 end as abap.int1 ) as OverallPickingStsCriticality AS int1asOverallPickingStsCriticality,
cast( case when OverallGoodsMovementStatus = 'C' then 3 when OverallGoodsMovementStatus = '' then 0 when OverallGoodsMovementStatus = 'A' and DelivDoc.ActualGoodsMovementDate < $session.system_date or OverallGoodsMovementStatus = 'B' and DelivDoc.ActualGoodsMovementDate < $session.system_date then 1 else 2 end as abap.int1 ) as OvrlGdsMovementStsCriticality AS int1asOvrlGdsMovementStsCriticality,
cast( case when OverallChmlCmplncStatus = 'A' then 3 when OverallChmlCmplncStatus = '' then 0 else 1 end as abap.int1 ) as OvrlChmlCmplncStsCriticality AS int1asOvrlChmlCmplncStsCriticality,
cast( case when OverallDangerousGoodsStatus = 'A' then 3 when OverallDangerousGoodsStatus = '' or OverallDangerousGoodsStatus = 'B' then 0 else 1 end as abap.int1 ) as OvrlDngrsGdsStsCriticality AS int1asOvrlDngrsGdsStsCriticality,
cast( case when OverallSafetyDataSheetStatus = 'A' then 3 when OverallSafetyDataSheetStatus = '' or OverallSafetyDataSheetStatus = 'B' then 0 else 1 end as abap.int1 ) as OvrlSftyDataSheetStsCritlty AS int1asOvrlSftyDataSheetStsCritlty,
cast( case when OverallTrdCmplncEmbargoSts = 'A' then 3 when OverallTrdCmplncEmbargoSts = '' then 0 else 1 end as abap.int1 ) as OvrlTrdCmplncEmbargoStsCritlty AS int1asOvrlTrdCmplncEmbargoStsCritlty,
cast( case when OvrlTrdCmplncSnctndListChkSts = 'A' then 3 when OvrlTrdCmplncSnctndListChkSts = '' then 0 else 1 end as abap.int1 ) as OvrlTrdCmplncSnctndListCritlty AS int1asOvrlTrdCmplncSnctndListCritlty,
cast( case when OvrlTrdCmplncLegalCtrlChkSts = 'A' then 3 when OvrlTrdCmplncLegalCtrlChkSts = '' then 0 else 1 end as abap.int1 ) as OvrlTrdCmplncLglCtrlStsCritlty AS int1asOvrlTrdCmplncLglCtrlStsCritlty,
cast('' as boole_d preserving type ) AS TradeComplianceIsActive,
DelivDocItemAmount._TransactionCurrency AS _TransactionCurrency,
DelivDoc._SoldToParty._CustomerClassification AS _CustomerClassification
FROM I_DeliveryDocument AS DelivDoc
LEFT OUTER JOIN E_DeliveryDocument AS _Extension ON DeliveryDocument = _Extension.DeliveryDocument -- association [0..1]
;