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_MassChangeSalesOrder.
-- 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_MassChangeSalesOrder AS
SELECT
cast(SalesDocument as vdm_sales_order preserving type) AS SalesOrder,
SoldToParty,
_StandardPartner.ShipToParty AS ShipToParty,
PurchaseOrderByCustomer,
_SalesOrganization._Text[1:Language = $session.system_language ].SalesOrganizationName AS SalesOrganizationName,
SalesOrganization,
DistributionChannel,
OverallSDProcessStatus,
_OverallTotalDeliveryStatus._Text[1:Language = $session.system_language ].OverallTotalDeliveryStatusDesc AS OverallTotalDeliveryStatusDesc,
OverallTotalDeliveryStatus,
CreationDate,
CreatedByUser,
cast( SalesDocumentType as sales_order_type preserving type ) AS SalesOrderType,
SDDocumentReason,
CustomerPurchaseOrderDate,
CustomerGroup,
AdditionalCustomerGroup1,
AdditionalCustomerGroup2,
AdditionalCustomerGroup3,
AdditionalCustomerGroup4,
AdditionalCustomerGroup5,
OrderID,
BusinessSolutionOrder,
cast(OrganizationDivision as organization_division preserving type ) AS OrganizationDivision,
SalesGroup,
SalesOffice,
SalesDistrict,
BusinessArea,
CostCenter,
_CostCenterText.CostCenterDescription AS CostCenterDescription,
ControllingArea,
BillingCompanyCode,
CreditControlArea,
cast(OverallSDDocumentRejectionSts as ovrl_sd_doc_rejection_status preserving type ) AS OverallSDDocumentRejectionSts,
_OverallDeliveryStatus._Text[1:Language = $session.system_language ].OverallDeliveryStatusDesc AS OverallDeliveryStatusDesc,
cast(OverallDeliveryStatus as overall_delivery_status preserving type ) AS OverallDeliveryStatus,
cast(OverallOrdReltdBillgStatus as ovrl_ord_rel_billg_status preserving type ) AS OverallOrdReltdBillgStatus,
TotalBlockStatus,
cast(TotalCreditCheckStatus as overall_credit_check_status preserving type ) AS TotalCreditCheckStatus,
cast(OverallDeliveryBlockStatus as overall_delivery_block_status preserving type ) AS OverallDeliveryBlockStatus,
cast(OverallBillingBlockStatus as overall_billing_block_status preserving type ) AS OverallBillingBlockStatus,
cast(HdrGeneralIncompletionStatus as hdr_general_incompltn_status preserving type ) AS HdrGeneralIncompletionStatus,
cast(HeaderBillgIncompletionStatus as hdrbillgincompletionstatus preserving type) AS HeaderBillgIncompletionStatus,
cast(OverallPricingIncompletionSts as ovrl_pricing_incompletion_sts preserving type ) AS OverallPricingIncompletionSts,
cast(HeaderDelivIncompletionStatus as hdrdelivincompletionstatus preserving type) AS HeaderDelivIncompletionStatus,
cast(OverallDelivConfStatus as overall_delivery_conf_status preserving type) AS OverallDelivConfStatus,
cast(OverallTrdCmplncEmbargoSts as overall_embargo_status preserving type ) AS OverallTrdCmplncEmbargoSts,
cast(OvrlTrdCmplncSnctndListChkSts as ovrl_watchlist_screening_sts preserving type ) AS OvrlTrdCmplncSnctndListChkSts,
cast(OvrlTrdCmplncLegalCtrlChkSts as overall_legal_control_status preserving type ) AS OvrlTrdCmplncLegalCtrlChkSts,
cast(OverallChmlCmplncStatus as ovrl_product_marketability_sts preserving type ) AS OverallChmlCmplncStatus,
cast(OverallDangerousGoodsStatus as overall_dangerous_goods_status preserving type ) AS OverallDangerousGoodsStatus,
cast(OverallSafetyDataSheetStatus as ovrl_safety_data_sheet_sts preserving type ) AS OverallSafetyDataSheetStatus,
cast(ContractDownPaymentStatus as hdr_down_payment_status preserving type) AS ContractDownPaymentStatus,
SalesDocApprovalStatus,
_StandardPartner.PayerParty AS PayerParty,
_StandardPartner.BillToParty AS BillToParty,
_StandardPartner.ResponsibleEmployee AS ResponsibleEmployee,
_StandardPartner.SalesEmployee AS SalesEmployee,
cast('' as ad_namtext ) AS ShipToPartyName,
cast('' as ad_namtext ) AS SoldToPartyName,
cast('' as ad_namtext ) AS BillToPartyName,
cast('' as ad_namtext ) AS PayerPartyName,
cast('' as ad_namtext ) AS ResponsibleEmployeeName,
cast('' as ad_namtext ) AS SalesEmployeeName,
cast( ' ' as abap.char( 100 )) AS AdditionalPartnerName,
cast( ' ' as parvw_unv preserving type ) AS PartnerFunction,
cast( ' ' as kunnr) AS Customer,
cast( ' ' as lifnr) AS Supplier,
cast( '00000000' as pernr_d) AS Personnel,
cast( '0000000000' as parnr) AS ContactPerson,
cast( ' ' as ettyp ) AS ScheduleLineCategory,
cast( ' ' as lifsp_ep ) AS DelivBlockReasonForSchedLine,
cast( RequestedDeliveryDate as ovrl_reqd_delivery_date) AS RequestedDeliveryDate,
cast( RequestedDeliveryDate as ovrl_reqd_delivery_date) AS RequestedDeliveryDateForFilter,
SalesDocumentDate AS SalesOrderDate,
BillingDocumentDate,
PricingDate,
ShippingCondition,
ShippingType AS SlsOrdShippingType,
cast( CustomerPaymentTerms as hdr_dzterm preserving type ) AS CustomerPaymentTerms,
PaymentMethod,
cast(SalesOrder.IncotermsClassification as vdm_header_incoterm1 preserving type ) AS HeaderIncotermsClassification,
IncotermsLocation1,
IncotermsLocation2,
IncotermsVersion,
cast( DeliveryBlockReason as header_delivery_block_reason preserving type ) AS DeliveryBlockReason,
TotalNetAmount,
TransactionCurrency,
cast(HeaderBillingBlockReason as header_billing_block_reason preserving type ) AS HeaderBillingBlockReason,
cast( SalesDocApprovalReason as sd_apm_approval_reason_vdm preserving type ) AS SalesOrderApprovalReason,
MasterSalesContract,
_SoldToParty.OrganizationBPName1 AS OrganizationBPName1,
_SoldToParty.OrganizationBPName2 AS OrganizationBPName2,
SalesOrder.SalesDocumentType AS SalesDocumentType,
SalesOrder.SDDocumentCategory AS SDDocumentCategory,
cast( ' ' as ps_posid_edit ) AS WBSElementExternalID,
cast( ' ' as productnumber ) AS Product,
cast( ' ' as charg_d) AS Batch,
cast( ' ' as spart) AS Division,
cast( '00' as lprio preserving type ) AS DeliveryPriority,
cast( ' ' as lfrel preserving type ) AS ItemIsDeliveryRelevant,
cast( ' ' as werks_ext) AS Plant,
cast( ' ' as abap.char(6)) AS Route,
cast( ' ' as abgru_va preserving type ) AS SalesDocumentRjcnReason,
cast( ' ' as abap.char(4)) AS ShippingPoint,
cast( ' ' as abap.char(4)) AS StorageLocation,
cast( ' ' as prctr ) AS ProfitCenter,
cast( ' ' as itm_vsarttr ) AS ShippingType,
cast( ' ' as xfeld ) AS SlsDocMassChgItmIsHigherLvl,
cast( '' as lfsta preserving type ) AS DeliveryStatus,
cast( '' as gbsta preserving type ) AS SDProcessStatus,
cast( ' ' as lfgsa preserving type ) AS TotalDeliveryStatus,
cast( ' ' as fksaa preserving type) AS OrderRelatedBillingStatus,
cast( ' ' as absta_vb preserving type ) AS SDDocumentRejectionStatus,
cast( ' ' as delivery_block_status preserving type ) AS DeliveryBlockStatus,
cast( ' ' as fssta preserving type ) AS BillingBlockStatus,
cast( ' ' as uvall_up preserving type ) AS ItemGeneralIncompletionStatus,
cast( ' ' as uvfak_up preserving type ) AS ItemBillingIncompletionStatus,
cast( ' ' as uvprs_up preserving type ) AS PricingIncompletionStatus,
cast('' as uvvlk_up preserving type ) AS ItemDeliveryIncompletionStatus,
cast('' as besta preserving type ) AS DeliveryConfirmationStatus,
cast('' as mon_tdd_dgsta preserving type ) AS SDDocReferenceStatus,
cast( ' ' as rfgsa preserving type ) AS TotalSDDocReferenceStatus,
cast('' as embargochksts preserving type ) AS TrdCmplncEmbargoSts,
cast('' as watchlistscrngchksts preserving type ) AS TrdCmplncSnctndListChkSts,
cast('' as mon_tdd_pcsta preserving type ) AS ChmlCmplncStatus,
cast('' as mon_tdd_dgsta preserving type ) AS DangerousGoodsStatus,
cast('' as mon_tdd_sdssta preserving type ) AS SafetyDataSheetStatus,
cast('' as dp_clear_sta preserving type ) AS ContractItemDownPaymentStatus
FROM I_SalesDocument AS SalesOrder
LEFT OUTER JOIN I_SDDocStandardPartner AS _StandardPartner ON SalesOrder = _StandardPartner.SDDocument -- association [0..1]
LEFT OUTER JOIN I_SlsDocNonStdPartner AS _NonStdPartner ON SalesOrder = _NonStdPartner.SDDocument -- association [0..*]
LEFT OUTER JOIN I_SDDocumentPartner AS _SDDocumentPartner ON SalesOrder = _SDDocumentPartner.SDDocument -- association [1..*]
LEFT OUTER JOIN I_SalesDocumentItem AS _SalesOrderItem ON SalesOrder = _SalesOrderItem.SalesDocument -- association [0..*]
LEFT OUTER JOIN C_SalesDocumentItemWl AS _SalesDocumentItem ON SalesOrder = _SalesDocumentItem.SalesDocument -- association [0..*]
LEFT OUTER JOIN C_MassChgSalesDocumentItemWl AS _MassChgSalesDocumentItemWL ON SalesOrder = _MassChgSalesDocumentItemWL.SalesDocument -- association [0..*]
LEFT OUTER JOIN I_SalesDocumentScheduleLine AS _ScheduleLine ON SalesOrder = _ScheduleLine.SalesDocument -- association [0..*]
LEFT OUTER JOIN E_SalesDocumentBasic AS _Extension ON SalesOrder = _Extension.SalesDocument -- association [0..1]
LEFT OUTER JOIN C_SalesDocumentUserVH AS _CreatedByUser ON CreatedByUser = _CreatedByUser.UserID -- association [0..1]
LEFT OUTER JOIN I_CostCenterText AS _CostCenterText ON CostCenter = _CostCenterText.CostCenter AND ControllingArea = _CostCenterText.ControllingArea AND _CostCenterText.ValidityEndDate >= $session.system_date AND _CostCenterText.Language = $session.system_language -- association [1]
LEFT OUTER JOIN C_SalesDocPaymentMethodVH AS _PaymentMethod ON PaymentMethod = _PaymentMethod.PaymentMethod AND BillingCompanyCode = _PaymentMethod.BillingCompanyCode -- association [0..1]
;