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_Customer360SalesOrder.
-- 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.
CREATE VIEW C_Customer360SalesOrder AS
SELECT
SalesOrder.SalesOrder AS SalesOrder,
SalesOrder.SoldToParty AS SoldToParty,
cast('' as ad_namtext ) AS SoldToPartyName,
cast( SalesOrder._Partner[ PartnerFunction = 'WE' ].Customer as kunwe preserving type ) AS ShipToParty,
cast('' as ad_namtext ) AS ShipToPartyName,
cast( SalesOrder._Partner[ PartnerFunction = 'RG' ].Customer as kunrg preserving type ) AS PayerParty,
cast('' as ad_namtext ) AS PayerPartyName,
cast( SalesOrder._Partner[ PartnerFunction = 'RE' ].Customer as kunre preserving type ) AS BillToParty,
cast('' as ad_namtext ) AS BillToPartyName,
cast( SalesOrder._Partner[ PartnerFunction = 'VE' ].Personnel as sales_empl preserving type ) AS SalesEmployee,
cast('' as ad_namtext ) AS SalesEmployeeName,
cast( SalesOrder._Partner[ PartnerFunction = 'ZM' ].Personnel as resp_empl preserving type ) AS ResponsibleEmployee,
cast('' as ad_namtext ) AS ResponsibleEmployeeName,
SalesOrder.PurchaseOrderByCustomer AS PurchaseOrderByCustomer,
SalesOrder.RequestedDeliveryDate AS RequestedDeliveryDate,
SalesOrder.OverallSDProcessStatus AS OverallSDProcessStatus,
SalesOrder._OverallSDProcessStatus._Text[1:Language = $session.system_language].OverallSDProcessStatusDesc AS OverallSDProcessStatusDesc,
SalesOrder.OverallSDDocumentRejectionSts AS OverallSDDocumentRejectionSts,
SalesOrder._OverallSDDocumentRejectionSts._Text[1:Language = $session.system_language].OvrlSDDocumentRejectionStsDesc AS OvrlSDDocumentRejectionStsDesc,
SalesOrder.SalesOrderDownPaymentStatus AS SalesOrderDownPaymentStatus,
SalesOrder._DownPaymentStatus._Text[1:Language = $session.system_language].ContractDownPaymentStatusDesc AS ContractDownPaymentStatusDesc,
SalesOrder.OverallBillingBlockStatus AS OverallBillingBlockStatus,
SalesOrder._OverallBillingBlockStatus._Text[1:Language = $session.system_language].OverallBillingBlockStatusDesc AS OverallBillingBlockStatusDesc,
SalesOrder.SalesDocApprovalStatus AS SalesDocApprovalStatus,
SalesOrder._SalesDocApprovalStatus._Text[1:Language = $session.system_language].SalesDocApprovalStatusDesc AS SalesDocApprovalStatusDesc,
SalesOrder.OverallChmlCmplncStatus AS OverallChmlCmplncStatus,
SalesOrder._OverallChmlCmplncStatus._Text[1:Language = $session.system_language].OverallChmlCmplncStatusDesc AS OverallChmlCmplncStatusDesc,
SalesOrder.OverallDangerousGoodsStatus AS OverallDangerousGoodsStatus,
SalesOrder._OverallDangerousGoodsStatus._Text[1:Language = $session.system_language].OverallDangerousGoodsStsDesc AS OverallDangerousGoodsStsDesc,
SalesOrder.OverallSafetyDataSheetStatus AS OverallSafetyDataSheetStatus,
SalesOrder._OvrlSftyDataSheetSts._Text[1:Language = $session.system_language].OverallSafetyDataSheetStsDesc AS OverallSafetyDataSheetStsDesc,
cast(SalesOrder.OverallTrdCmplncEmbargoSts as totembargochksts preserving type) AS OverallTrdCmplncEmbargoSts,
SalesOrder._OvrlTradeCmplncEmbargoStatus._Text[1: Language=$session.system_language].OverallTrdCmplncEmbargoStsDesc AS OverallTrdCmplncEmbargoStsDesc,
cast(SalesOrder.OvrlTrdCmplncSnctndListChkSts as totwatchlistscrngchksts preserving type) AS OvrlTrdCmplncSnctndListChkSts,
SalesOrder._OvTrdCmplncSnctndListChkSts._Text[1: Language=$session.system_language].OvrlTrdCmplncSnctndListStsDesc AS OvrlTrdCmplncSnctndListStsDesc,
cast(SalesOrder.OvrlTrdCmplncLegalCtrlChkSts as totlglctrlchksts preserving type) AS OvrlTrdCmplncLegalCtrlChkSts,
SalesOrder._OvrlTrdCmplncLegalCtrlChkSts._Text[1: Language=$session.system_language].OvrlTrdCmplncLglCtrlChkStsDesc AS OvrlTrdCmplncLglCtrlChkStsDesc,
cast(SalesOrder.BusinessSolutionOrder as crms4_solo_object_id preserving type ) AS BusinessSolutionOrder,
SalesOrder.TransactionCurrency AS TransactionCurrency,
SalesOrder._TransactionCurrency._Text[1:Language = $session.system_language].CurrencyName AS CurrencyName,
SalesOrder.TotalNetAmount AS TotalNetAmount,
SalesOrder.SalesOrderDate AS SalesOrderDate,
SalesOrder.SalesOrderType AS SalesOrderType,
SalesOrder._SalesOrderType._Text[1:Language = $session.system_language].SalesDocumentTypeName AS SalesDocumentTypeName,
SalesOrder.CreationDate AS CreationDate,
SalesOrder.LastChangeDate AS LastChangeDate,
SalesOrder.CreatedByUser AS CreatedByUser,
SalesOrder._CreatedByUser.UserDescription AS CreatedByUserDescription,
SalesOrder.LastChangedByUser AS LastChangedByUser,
SalesOrder._LastChangedByUser.UserDescription AS LastChangedByUserDescription,
SalesOrder.SalesOrganization AS SalesOrganization,
SalesOrder._SalesOrganization._Text[1:Language = $session.system_language].SalesOrganizationName AS SalesOrganizationName,
SalesOrder.DistributionChannel AS DistributionChannel,
SalesOrder._DistributionChannel._Text[1:Language = $session.system_language].DistributionChannelName AS DistributionChannelName,
SalesOrder.OrganizationDivision AS OrganizationDivision,
SalesOrder._OrganizationDivision._Text[1:Language = $session.system_language].DivisionName AS DivisionName,
SalesOrder.SalesOffice AS SalesOffice,
SalesOrder._SalesOffice._Text[1:Language = $session.system_language].SalesOfficeName AS SalesOfficeName,
SalesOrder.SalesGroup AS SalesGroup,
SalesOrder._SalesGroup._Text[1:Language = $session.system_language].SalesGroupName AS SalesGroupName,
SalesOrder.ReferenceSDDocument AS ReferenceSDDocument,
SalesOrder.SDDocumentReason AS SDDocumentReason,
SalesOrder._SDDocumentReason._Text[1:Language = $session.system_language].SDDocumentReasonText AS SDDocumentReasonText,
SalesOrder.DeliveryBlockReason AS DeliveryBlockReason,
SalesOrder._DeliveryBlockReason._Text[1:Language = $session.system_language].DeliveryBlockReasonText AS DeliveryBlockReasonText,
SalesOrder.HeaderBillingBlockReason AS HeaderBillingBlockReason,
SalesOrder._HeaderBillingBlockReason._Text[1:Language = $session.system_language].BillingBlockReasonDescription AS BillingBlockReasonDescription,
cast ( SalesOrder.OmniChnlSalesPromotionStatus as sd_so_bob_status preserving type ) AS OmniChnlSalesPromotionStatus,
SalesOrder._OmniChnlSalesPromotionStatus._Text[1:Language = $session.system_language].OmniChnlSalesPromotionStsText AS OmniChnlSalesPromotionStsText,
SalesOrder._TransactionCurrency AS _TransactionCurrency,
SalesOrder._OverallSDProcessStatus AS _OverallSDProcessStatus,
SalesOrder._OverallSDDocumentRejectionSts AS _OverallSDDocumentRejectionSts,
SalesOrder._DownPaymentStatus AS _DownPaymentStatus,
SalesOrder._SalesOrganization AS _SalesOrganization,
SalesOrder._OrganizationDivision AS _OrganizationDivision,
SalesOrder._DeliveryBlockReason AS _DeliveryBlockReason,
SalesOrder._HeaderBillingBlockReason AS _HeaderBillingBlockReason,
SalesOrder._SDDocumentReason AS _SDDocumentReason,
SalesOrder._OverallBillingBlockStatus AS _OverallBillingBlockStatus,
SalesOrder._SalesDocApprovalStatus AS _SalesDocApprovalStatus,
SalesOrder._OverallChmlCmplncStatus AS _OverallChmlCmplncStatus,
SalesOrder._OverallDangerousGoodsStatus AS _OverallDangerousGoodsStatus,
SalesOrder._OvrlSftyDataSheetSts AS _OvrlSftyDataSheetSts,
SalesOrder._SolutionOrder AS _SolutionOrder,
SalesOrder._OvrlTradeCmplncEmbargoStatus AS _OvrlTradeCmplncEmbargoStatus,
SalesOrder._OvTrdCmplncSnctndListChkSts AS _OvTrdCmplncSnctndListChkSts,
SalesOrder._OvrlTrdCmplncLegalCtrlChkSts AS _OvrlTrdCmplncLegalCtrlChkSts,
SalesOrder._OmniChnlSalesPromotionStatus AS _OmniChnlSalesPromotionStatus
FROM I_SalesOrder AS SalesOrder
INNER JOIN I_Customer360BusDocSetting AS Customer360BusDocSetting ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN C_SoldToValueHelp AS _SoldToPartyVH ON SoldToParty = _SoldToPartyVH.Customer -- association [0..1]
LEFT OUTER JOIN C_Dischannelvaluehelp AS _DistributionChannel ON SalesOrganization = _DistributionChannel.SalesOrganization AND DistributionChannel = _DistributionChannel.DistributionChannel -- association [0..1]
LEFT OUTER JOIN C_OrgDivisionValueHelp AS _Division ON SalesOrganization = _Division.SalesOrganization AND DistributionChannel = _Division.DistributionChannel AND OrganizationDivision = _Division.Division -- association [0..1]
LEFT OUTER JOIN C_SalesOfficeValueHelp AS _SalesOffice ON SalesOrganization = _SalesOffice.SalesOrganization AND DistributionChannel = _SalesOffice.DistributionChannel AND OrganizationDivision = _SalesOffice.OrganizationDivision AND SalesOffice = _SalesOffice.SalesOffice -- association [0..1]
LEFT OUTER JOIN C_SalesGroupValueHelp AS _SalesGroup ON SalesOffice = _SalesGroup.SalesOffice AND SalesGroup = _SalesGroup.SalesGroup -- association [0..1]
LEFT OUTER JOIN C_SalesOrderTypeVH_F1873 AS _SalesDocumentType ON SalesOrderType = _SalesDocumentType.SalesOrderType -- association [0..1]
LEFT OUTER JOIN C_SalesDocumentUserVH AS _CreatedByUser ON CreatedByUser = _CreatedByUser.UserID -- association [0..1]
LEFT OUTER JOIN C_SalesDocumentUserVH AS _LastChangedByUser ON LastChangedByUser = _LastChangedByUser.UserID -- association [0..1]
LEFT OUTER JOIN E_SalesDocumentBasic AS _Extension ON SalesOrder = _Extension.SalesDocument -- association [1]
;