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_SlsDocItemOverdueDeliv.
-- 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: CSLSDOCITEMSO05
CREATE VIEW C_SlsDocItemOverdueDeliv AS
SELECT
Item.SalesDocument AS SalesDocument,
cast(Item.SalesDocumentItem as sales_doc_item preserving type) AS SalesDocumentItem,
Issue.DueDays AS DueDays,
Item.SalesDocumentItemCategory AS SalesDocumentItemCategory,
cast(Item.Material as productnumber preserving type ) AS Material,
Item._MaterialText[1:Language=$session.system_language].MaterialName AS MaterialName,
cast(Item.MaterialGroup as productgroup preserving type ) AS MaterialGroup,
Item.Batch AS Batch,
Item.Plant AS Plant,
Item.MaterialByCustomer AS MaterialByCustomer,
Item.SalesDocumentItemText AS SalesDocumentItemText,
Item.RequestedQuantity AS RequestedQuantity,
Item.RequestedQuantityUnit AS RequestedQuantityUnit,
Item.ConfdDelivQtyInOrderQtyUnit AS ConfdDelivQtyInOrderQtyUnit,
Item.OrderQuantityUnit AS OrderQuantityUnit,
Item.NetAmount AS NetAmount,
Item.TransactionCurrency AS TransactionCurrency,
Item.ShippingPoint AS ShippingPoint,
Item._ShippingPointText[1:Language=$session.system_language].ShippingPointName AS ShippingPointName,
Item.StorageLocation AS StorageLocation,
cast( Item._SlsDocItemEnhancedFields._RequestedDeliveryDate.RequestedDeliveryDate as reqd_deliv_date) AS RequestedDeliveryDate,
cast(Item._SlsDocItemEnhancedFields._DeliveryCreationDate.DeliveryCreationDate as planneddeliverycreationdate) AS DeliveryCreationDate,
cast(Item._ShippingPoint._ActiveDepartureCountry.Country as shippingpointcountry) AS ShippingPointCountry,
cast(Item._ShippingPoint._ActiveDepartureCountry._Text[1:Language=$session.system_language].CountryName as shippingpointcountryname) AS ShippingPointCountryName,
cast(Item._Plant._Address.Country as shipfrompartycountry) AS ShipFromPartyCountry,
cast(Item._Plant._Address._Country._Text[1:Language=$session.system_language].CountryName as shipfrompartycountryname) AS ShipFromPartyCountryName,
Item.ShipToParty AS ShipToParty,
Item._ShipToParty.CustomerName AS ShipToPartyName,
cast( '' as shiptopartycountry ) AS ShipToPartyCountry,
cast( '' as shiptopartycountryname ) AS ShipToPartyCountryName,
Item.TotalDeliveryStatus AS TotalDeliveryStatus,
Item.DeliveryStatus AS DeliveryStatus,
Item.SDProcessStatus AS SDProcessStatus,
cast(Item.PurchaseConfirmationStatus as purchaseconfsts preserving type ) AS PurchaseConfirmationStatus,
Item.OrderRelatedBillingStatus AS OrderRelatedBillingStatus,
cast( Item.ChmlCmplncStatus as mon_tdd_pcsta preserving type ) AS ChmlCmplncStatus,
cast( Item.DangerousGoodsStatus as mon_tdd_dgsta preserving type ) AS DangerousGoodsStatus,
cast( Item.SafetyDataSheetStatus as mon_tdd_sdssta preserving type ) AS SafetyDataSheetStatus,
cast( Item.TrdCmplncEmbargoSts as embargochksts preserving type ) AS TrdCmplncEmbargoSts,
cast( Item.TrdCmplncSnctndListChkSts as watchlistscrngchksts preserving type ) AS TrdCmplncSnctndListChkSts,
cast( Item.OvrlTrdCmplncLegalCtrlChkSts as lglctrlchksts preserving type ) AS OvrlTrdCmplncLegalCtrlChkSts,
cast(Prediction.Rr_DeliveryDelayInDays as predicteddeliverycreationdelay ) AS PrdtdDelivCrtnDelayInDays,
cast(Prediction.Bar_Rr_DeliveryDelayInDays as prdtddelivcrtndelayconfidence) AS PrdtdDelivCrtnDelayConfidence,
cast(ProcgDelay.Rr_DelivProcgDelayInDays as predicteddeliveryprocgdelay ) AS PrdtdDelivProcgDelayInDays,
cast( case when TotalDeliveryStatus = 'A' and DueDays > 0 or TotalDeliveryStatus = 'B' and DueDays > 0 then 2 when TotalDeliveryStatus = 'A' and DueDays <= 0 or TotalDeliveryStatus = 'B' and DueDays <= 0 then 1 else 3 end as abap.int1 ) as TotalDeliveryStatusCriticality AS int1asTotalDeliveryStatusCriticality,
cast( case when Item.ChmlCmplncStatus = 'A' or Item.ChmlCmplncStatus = 'B' then 3 when ( Item.ChmlCmplncStatus = 'C' or Item.ChmlCmplncStatus = 'D' or Item.ChmlCmplncStatus = 'G' ) and DueDays > 0 then 2 when ( Item.ChmlCmplncStatus = 'C' or Item.ChmlCmplncStatus = 'D' or Item.ChmlCmplncStatus = 'G' ) and DueDays <= 0 then 1 else 9 end as abap.int1 ) as ChmlCmplncStsCriticality AS int1asChmlCmplncStsCriticality,
cast( case when Item.DangerousGoodsStatus = 'A' or Item.DangerousGoodsStatus = 'B' or Item.DangerousGoodsStatus = 'D' then 3 when ( Item.DangerousGoodsStatus = 'F' or Item.DangerousGoodsStatus = 'G' ) and DueDays > 0 then 2 when ( Item.DangerousGoodsStatus = 'F' or Item.DangerousGoodsStatus = 'G' ) and DueDays <= 0 then 1 else 9 end as abap.int1 ) as DngrsGdsStsCriticality AS int1asDngrsGdsStsCriticality,
Item._ChmlCmplncStatus AS _ChmlCmplncStatus,
Item._DangerousGoodsStatus AS _DangerousGoodsStatus,
Item._SafetyDataSheetStatus AS _SafetyDataSheetStatus,
Item._TrdCmplncEmbargoSts AS _TrdCmplncEmbargoSts,
Item._TrdCmplncSnctndListChkSts AS _TrdCmplncSnctndListChkSts,
Item._OvrlTrdCmplncLegalCtrlChkSts AS _OvrlTrdCmplncLegalCtrlChkSts
FROM I_SalesDocumentItem AS Item
INNER JOIN I_SalesOrderOverdueDelivery AS Issue ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN E_SalesDocumentItemBasic AS _Extension ON SalesDocument = _Extension.SalesDocument AND SalesDocumentItem = _Extension.SalesDocumentItem -- association [0..1]
;