@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #S
@EndUserText.label: 'SOFM Sales Order'
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #CHECK
@AccessControl.privilegedAssociations: [ '_CreatedByUser' ]
@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED
@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName: 'ISOFSLSORD'
define view I_SlsOrdFlfmtSalesOrder
as
select from I_SalesDocument as SalesDocument
left outer to one join I_SDDocStandardPartner as Partner
on SalesDocument.SalesDocument = SDDocument
//left outer to one join P_SDDocCtrlgObjStsBlkdInfo as ConObjStatusDelBlocked
//on SalesDocument.ControllingObject = ConObjStatusDelBlocked.ControllingObject and
// ConObjStatusDelBlocked.BusinessTransactionType = 'SDDN' and
// ConObjStatusDelBlocked.BusTransacExecutionAllowance = '3' and
// ConObjStatusDelBlocked.ControllingObjectCategory = 'VBK' and
// not ConObjStatusDelBlocked.StatusIsInactive = 'X'
//
//left outer to one join P_SDDocCtrlgObjStsBlkdInfo as ConObjStatusInvBlocked
//on SalesDocument.ControllingObject = ConObjStatusInvBlocked.ControllingObject and
// ConObjStatusInvBlocked.BusinessTransactionType = 'SDIN' and
// ConObjStatusInvBlocked.BusTransacExecutionAllowance = '3' and
// ConObjStatusInvBlocked.ControllingObjectCategory = 'VBK' and
// not ConObjStatusInvBlocked.StatusIsInactive = 'X'
association[0..1] to I_SDDocCtrlgObjStsBlkdInfo as _ConObjStatusDelBlocked
on $projection.ControllingObject = _ConObjStatusDelBlocked.ControllingObject and
_ConObjStatusDelBlocked.BusinessTransactionType = 'SDDN' and
_ConObjStatusDelBlocked.BusTransacExecutionAllowance = '3' and
_ConObjStatusDelBlocked.ControllingObjectCategory = 'VBK' and
not _ConObjStatusDelBlocked.StatusIsInactive = 'X'
association[0..1] to I_SDDocCtrlgObjStsBlkdInfo as _ConObjStatusBillgBlocked
on $projection.ControllingObject = _ConObjStatusBillgBlocked.ControllingObject and
_ConObjStatusBillgBlocked.BusinessTransactionType = 'SDIN' and
_ConObjStatusBillgBlocked.BusTransacExecutionAllowance = '3' and
_ConObjStatusBillgBlocked.ControllingObjectCategory = 'VBK' and
not _ConObjStatusBillgBlocked.StatusIsInactive = 'X'
association[0..1] to I_CreditControlArea2Segment as _CreditControlArea2Segment on $projection.CreditControlArea = _CreditControlArea2Segment.CreditControlArea
{
//Key
key cast(SalesDocument as vdm_sales_order) as SalesOrder,
//Category
@ObjectModel.foreignKey.association: '_SalesOrderType'
SalesDocumentType as SalesOrderType,
_SalesDocumentType as _SalesOrderType,
SDDocumentCategory,
//Admin
CreatedByUser,
_CreatedByUser,
@Semantics.systemDate.createdAt: true
CreationDate,
CreationTime,
@Semantics.systemDate.lastChangedAt: true
LastChangeDate,
//Organization
@ObjectModel.foreignKey.association: '_OrganizationDivision'
OrganizationDivision,
_OrganizationDivision,
@ObjectModel.foreignKey.association: '_SalesOrganization'
SalesOrganization,
_SalesOrganization,
@ObjectModel.foreignKey.association: '_DistributionChannel'
DistributionChannel,
_DistributionChannel,
SalesGroup,
_SalesGroup,
SalesOffice,
_SalesOffice,
//Partner
@ObjectModel.text.element: [ 'SoldToPartyName' ]
SalesDocument.SoldToParty,
@Semantics.text: true
cast (SalesDocument._SoldToParty.CustomerName as vdm_sold_to_name) as SoldToPartyName,
@ObjectModel.text.element: [ 'ShipToPartyName' ]
Partner.ShipToParty,
@Semantics.text: true
cast (Partner._ShipToParty.CustomerName as ship_to_name) as ShipToPartyName,
@ObjectModel.text.element: [ 'BillToPartyName' ]
Partner.BillToParty,
@Semantics.text: true
cast (Partner._BillToParty.CustomerName as bill_to_name) as BillToPartyName,
@ObjectModel.text.element: [ 'PayerPartyName' ]
Partner.PayerParty,
@Semantics.text: true
cast (Partner._PayerParty.CustomerName as payer_name) as PayerPartyName,
@ObjectModel.text.element: [ 'ResponsibleEmployeeName' ]
Partner.ResponsibleEmployee,
@Semantics.text: true
Partner._ResponsibleEmployee.PersonFullName as ResponsibleEmployeeName,
@ObjectModel.foreignKey.association: '_CustomerClassification'
SalesDocument._SoldToParty.CustomerClassification,
SalesDocument._SoldToParty._CustomerClassification,
//Sales
SalesDocumentDate as SalesOrderDate,
PurchaseOrderByCustomer,
@ObjectModel.foreignKey.association: '_CreditControlArea2Segment'
CreditControlArea,
_CreditControlArea2Segment.CreditSegment,
_CreditControlArea2Segment,
NextCreditCheckDate,
//Pricing
@DefaultAggregation: #SUM
@Semantics.amount.currencyCode: 'TransactionCurrency'
TotalNetAmount,
@Semantics.currencyCode: true
@ObjectModel.foreignKey.association: '_TransactionCurrency'
TransactionCurrency,
@Semantics.currencyCode: true
@ObjectModel.foreignKey.association: '_StatisticsCurrency'
StatisticsCurrency,
//Shipping
CompleteDeliveryIsDefined,
@ObjectModel.foreignKey.association: '_DeliveryBlockReason'
DeliveryBlockReason,
_DeliveryBlockReason,
RequestedDeliveryDate,
@ObjectModel.foreignKey.association: '_ShippingCondition'
ShippingCondition,
_ShippingCondition,
@ObjectModel.foreignKey.association: '_IncotermsClassification'
IncotermsClassification,
_IncotermsClassification,
IncotermsTransferLocation,
IncotermsLocation1,
IncotermsLocation2,
@ObjectModel.foreignKey.association: '_IncotermsVersion'
IncotermsVersion,
_IncotermsVersion,
@ObjectModel.foreignKey.association: '_ShippingType'
ShippingType,
_ShippingType,
@ObjectModel.foreignKey.association: '_HeaderBillingBlockReason'
HeaderBillingBlockReason,
_HeaderBillingBlockReason,
//Billing
BillingDocumentDate,
//Payment
@ObjectModel.foreignKey.association: '_CustomerPaymentTerms'
CustomerPaymentTerms,
_CustomerPaymentTerms,
//Status
OverallSDDocumentRejectionSts,
OverallDelivConfStatus,
OverallDeliveryStatus,
@ObjectModel.foreignKey.association: '_HdrGeneralIncompletionStatus'
HdrGeneralIncompletionStatus,
_HdrGeneralIncompletionStatus,
@ObjectModel.foreignKey.association: '_HeaderDelivIncompletionStatus'
HeaderDelivIncompletionStatus,
_HeaderDelivIncompletionStatus,
@ObjectModel.foreignKey.association: '_OverallPricingIncompletionSts'
OverallPricingIncompletionSts,
_OverallPricingIncompletionSts,
@ObjectModel.foreignKey.association: '_HeaderBillgIncompletionStatus'
HeaderBillgIncompletionStatus,
_HeaderBillgIncompletionStatus,
@ObjectModel.foreignKey.association: '_OvrlItmGeneralIncompletionSts'
OvrlItmGeneralIncompletionSts,
_OvrlItmGeneralIncompletionSts,
@ObjectModel.foreignKey.association: '_OvrlItmBillingIncompletionSts'
OvrlItmBillingIncompletionSts,
_OvrlItmBillingIncompletionSts,
@ObjectModel.foreignKey.association: '_OvrlItmDelivIncompletionSts'
OvrlItmDelivIncompletionSts,
_OvrlItmDelivIncompletionSts,
@ObjectModel.foreignKey.association: '_FinDocCreditCheckStatus'
FinDocCreditCheckStatus,
_FinDocCreditCheckStatus,
@ObjectModel.foreignKey.association: '_ExprtInsurCreditCheckStatus'
ExprtInsurCreditCheckStatus,
_ExprtInsurCreditCheckStatus,
@ObjectModel.foreignKey.association: '_PaytAuthsnCreditCheckSts'
PaytAuthsnCreditCheckSts,
_PaytAuthsnCreditCheckSts,
@ObjectModel.foreignKey.association: '_CentralCreditCheckStatus'
cast(CentralCreditCheckStatus as central_credit_check_status preserving type) as CentralCreditCheckStatus,
_CentralCreditCheckStatus,
// cast( ConObjStatusDelBlocked.CtrlgObjStatusIsDeliveryBlkd as user_status_deliv_block ) as CtrlgObjStatusIsDeliveryBlkd,
// cast( ConObjStatusInvBlocked.CtrlgObjStatusIsBillingBlkd as user_status_inv_block ) as CtrlgObjStatusIsBillingBlkd,
SalesDocument.ControllingObject,
_ConObjStatusDelBlocked,
_ConObjStatusBillgBlocked,
//Project
_EngagementProjectItem.EngagementProjectUUID as CustomerProjectUUID,
@ObjectModel.text.element: [ 'CustomerProjectName' ]
_EngagementProjectItem.EngagementProject as CustomerProject,
@Semantics.text: true
_EngagementProjectItem._EngagementProject.EngagementProjectName as CustomerProjectName,
_TransactionCurrency,
_StatisticsCurrency
}
where ( SalesDocument.SDDocumentCategory = 'C' or --> Order
SalesDocument.SDDocumentCategory = 'I' or --> Order w/o charge
SalesDocument.SDDocumentCategory = 'L' ) --> Debit Memo Request
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CREDITCONTROLAREA2SEGMENT",
"I_CUSTOMER",
"I_ENGAGEMENTPROJECT",
"I_ENGAGEMENTPROJECTITEM",
"I_PERSONWORKAGREEMENT_1",
"I_SALESDOCUMENT",
"I_SDDOCSTANDARDPARTNER"
],
"ASSOCIATED":
[
"I_BILLINGBLOCKREASON",
"I_CENTRALCREDITCHECKSTATUS",
"I_CREDITCONTROLAREA2SEGMENT",
"I_CURRENCY",
"I_CUSTOMERCLASSIFICATION",
"I_CUSTOMERPAYMENTTERMS",
"I_DELIVERYBLOCKREASON",
"I_DISTRIBUTIONCHANNEL",
"I_DIVISION",
"I_EXPRTINSURCREDITCHECKSTATUS",
"I_FINDOCCREDITCHECKSTATUS",
"I_HDRBILLGINCOMPLETIONSTATUS",
"I_HDRDELIVINCOMPLETIONSTATUS",
"I_HDRGENINCOMPLETIONSTATUS",
"I_INCOTERMSCLASSIFICATION",
"I_INCOTERMSVERSION",
"I_OVERALLPRCINCOMPLETIONSTS",
"I_OVRLITMBILLGINCOMPLTNSTS",
"I_OVRLITMDELIVINCOMPLETIONSTS",
"I_OVRLITMGENINCOMPLETIONSTS",
"I_PAYTAUTHSNCREDITCHECKSTS",
"I_SALESDOCUMENTTYPE",
"I_SALESGROUP",
"I_SALESOFFICE",
"I_SALESORGANIZATION",
"I_SDDOCCTRLGOBJSTSBLKDINFO",
"I_SHIPPINGCONDITION",
"I_SHIPPINGTYPE",
"I_USER"
],
"BASE":
[
"I_CUSTOMER",
"I_SALESDOCUMENT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/