Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.19 KB | None | 0 0
  1. @AbapCatalog.sqlViewName: 'IPPMFGORDOPCOMPC'
  2. @AccessControl.authorizationCheck: #CHECK
  3. @Analytics: {dataCategory: #CUBE, dataExtraction.enabled: true}
  4. @ClientHandling.algorithm: #SESSION_VARIABLE
  5. @ObjectModel.usageType: {serviceQuality: #C, sizeCategory: #XL, dataClass: #MIXED}
  6. @VDM.viewType: #COMPOSITE
  7. @EndUserText.label: 'Manufacturing Order Operation Component Cube'
  8.  
  9. define view I_MfgOrderOperationCompCube
  10. as select from I_MfgOrderOperationComponent as comp
  11. inner join P_PPH_ReportingDate3 as repdate on MatlCompRequirementDate = repdate.ReportingDate
  12. inner join I_MfgOrderStatus as status on comp.ManufacturingOrder = status.ManufacturingOrder
  13.  
  14. association [0..1] to I_GLAccount as _GLAccount on $projection.GLAccount = _GLAccount.GLAccount
  15. and $projection.CompanyCode = _GLAccount.CompanyCode
  16. association [1..1] to I_CalendarDate as _RequirementDate on $projection.MatlCompRequirementDate = _RequirementDate.CalendarDate
  17. association [0..1] to I_CalendarMonth as _RequirementDateMonth on $projection.RequirementDateMonth = _RequirementDateMonth.CalendarMonth
  18. association [0..1] to I_CalendarYear as _RequirementDateYear on $projection.RequirementDateYear = _RequirementDateYear.CalendarYear
  19. association [0..1] to I_WeekDay as _RequirementDateWeekDay on $projection.RequirementDateWeekDay = _RequirementDateWeekDay.WeekDay
  20. association [0..1] to I_ReportingPeriod as _ReportingPeriod on $projection.ReportingPeriod = _ReportingPeriod.ReportingPeriod
  21. association [0..1] to I_Currency as _CompanyCodeCurrency on $projection.CompanyCodeCurrency = _CompanyCodeCurrency.Currency
  22. association [0..1] to I_SalesDocumentBasic as _SalesDocumentBasic on $projection.SalesDocument = _SalesDocumentBasic.SalesDocument
  23. association [0..1] to I_SDDocumentCategory as _SDDocumentCategory on $projection.SDDocumentCategory = _SDDocumentCategory.SDDocumentCategory
  24. association [0..1] to I_MRPController as _MRPController on $projection.Plant = _MRPController.Plant
  25. and $projection.MRPController = _MRPController.MRPController
  26. {
  27. // Key
  28. @ObjectModel.foreignKey.association: '_Reservation'
  29. key comp.Reservation,
  30. @ObjectModel.text.element: 'ReservationItemText'
  31. key comp.ReservationItem,
  32.  
  33. // Order and operation data
  34. @ObjectModel.foreignKey.association: '_MfgOrderCategory'
  35. comp.ManufacturingOrderCategory,
  36. @ObjectModel.foreignKey.association: '_MfgOrderType'
  37. comp.ManufacturingOrderType,
  38. @ObjectModel.foreignKey.association: '_MfgOrder'
  39. comp.ManufacturingOrder,
  40. @ObjectModel.foreignKey.association: '_MfgOrderSequence'
  41. comp.ManufacturingOrderSequence,
  42. @ObjectModel.foreignKey.association: '_MfgOrderOperationBySemanKey'
  43. comp.ManufacturingOrderOperation,
  44. @ObjectModel.foreignKey.association: '_ProductionPlant'
  45. comp.ProductionPlant,
  46. @ObjectModel.foreignKey.association: '_OrdInternalBillOfOperations'
  47. OrderInternalBillOfOperations,
  48. @ObjectModel.foreignKey.association: '_MfgOrderOperation'
  49. OrderIntBillOfOperationsItem,
  50. @ObjectModel.foreignKey.association: '_AssemblyMRPController'
  51. comp.AssemblyMRPController,
  52. @ObjectModel.foreignKey.association: '_ProductionSupervisor'
  53. comp.ProductionSupervisor,
  54.  
  55. //Order status
  56. status.OrderIsReleased as OrderIsReleased,
  57. status.OrderIsConfirmed as OrderIsConfirmed,
  58. status.OrderIsDeleted as OrderIsDeleted,
  59. status.OrderIsTechnicallyCompleted as OrderIsTechnicallyCompleted,
  60. status.OrderIsClosed as OrderIsClosed,
  61. status.OrderIsMarkedForDeletion as OrderIsMarkedForDeletion,
  62.  
  63. // Text
  64. @Semantics.text: true
  65. comp.ReservationItemText,
  66.  
  67. // Date and Time
  68. @Semantics.businessDate.at: true
  69. comp.MatlCompRequirementDate,
  70. comp.MatlCompRequirementTime,
  71. @ObjectModel.foreignKey.association: '_RequirementDateWeekDay'
  72. repdate.ReportingDateWeekDay as RequirementDateWeekDay,
  73. @Semantics.calendar.week: true
  74. repdate.ReportingDateWeek as RequirementDateWeek,
  75. @ObjectModel.foreignKey.association: '_RequirementDateMonth'
  76. //@Semantics.calendar.month: true
  77. repdate.ReportingDateMonth as RequirementDateMonth,
  78. @Semantics.calendar.year: true
  79. repdate.ReportingDateYear as RequirementDateYear,
  80. cast(concat(repdate.ReportingDateYear, repdate.ReportingDateMonth) as vdm_yearmonth) as RequirementDateYearMonth,
  81. @ObjectModel.foreignKey.association: '_ReportingPeriod'
  82. cast(repdate.ReportingPeriod as pph_reportingperiod preserving type) as ReportingPeriod,
  83.  
  84. // Attributes
  85. comp.RecordType,
  86. comp.RequirementType,
  87. comp.ReservationItemCreationCode,
  88. comp.ReservationIsFinallyIssued,
  89. comp.MatlCompIsMarkedForDeletion,
  90. comp.MaterialComponentIsMissing,
  91. comp.IsBulkMaterialComponent,
  92. comp.MaterialCompIsVariableSized,
  93. comp.MatlCompIsMarkedForBackflush,
  94. comp.MaterialCompIsAlternativeItem,
  95. comp.MaterialComponentIsPhantomItem,
  96. comp.MatlCompIsTextItem,
  97. comp.MatlCompDiscontinuationType,
  98. comp.MatlCompIsConfigurable,
  99. comp.UsageProbabilityPercent,
  100.  
  101. // Assignments
  102. @ObjectModel.foreignKey.association: '_MaterialGroup'
  103. comp.MaterialGroup,
  104. @ObjectModel.foreignKey.association: '_Material'
  105. comp.Material,
  106. @ObjectModel.foreignKey.association: '_Plant'
  107. comp.Plant,
  108. @ObjectModel.foreignKey.association: '_MRPController'
  109. cast(_MaterialPlant.MRPController as pph_dispo preserving type) as MRPController,
  110. -- @ObjectModel.foreignKey.association: '_RequirementPlan'
  111. comp.RequirementPlan,
  112. @ObjectModel.foreignKey.association: '_SalesOrder'
  113. comp.SalesOrder,
  114. @ObjectModel.foreignKey.association: '_SalesOrderItem'
  115. comp.SalesOrderItem,
  116. @ObjectModel.foreignKey.association: '_SalesDocument'
  117. comp.SalesDocument,
  118. @ObjectModel.foreignKey.association: '_SalesDocumentItem'
  119. comp.SalesDocumentItem,
  120. @ObjectModel.foreignKey.association: '_SDDocumentCategory'
  121. _SalesDocumentBasic.SDDocumentCategory as SDDocumentCategory,
  122. @ObjectModel.foreignKey.association: '_WBSElement'
  123. comp.WBSElementInternalID,
  124. comp.ProductConfiguration,
  125.  
  126. // Assignments BOM
  127. comp.BillOfMaterialCategory,
  128. comp.BillOfMaterialInternalID,
  129. comp.BillOfMaterialVariant,
  130. @ObjectModel.text.element: 'BOMItemDescription'
  131. comp.BOMItem as BillOfMaterialItemNodeNumber,
  132. -- @ObjectModel.foreignKey.association: '_BOMItemCategory'
  133. comp.BOMItemCategory as BillOfMaterialItemCategory,
  134. @ObjectModel.text.element: 'BOMItemDescription'
  135. comp.BillOfMaterialItemNumber,
  136. @Semantics.text: true
  137. comp.BOMItemDescription,
  138. @ObjectModel.foreignKey.association: '_BOMExplosion'
  139. comp.BOMExplosion as BOMExplosionDateID,
  140.  
  141. // Assignments Purchasing
  142. comp.PurchasingInfoRecord,
  143. @ObjectModel.foreignKey.association: '_PurchasingGroup'
  144. comp.PurchasingGroup,
  145. -- @ObjectModel.foreignKey.association: '_PurchaseRequisition'
  146. comp.PurchaseRequisition,
  147. -- @ObjectModel.foreignKey.association: '_PurchaseRequisitionItem'
  148. comp.PurchaseRequisitionItem,
  149. -- @ObjectModel.foreignKey.association: '_PurchaseOrder'
  150. comp.PurchaseOrder,
  151. -- @ObjectModel.foreignKey.association: '_PurchaseOrderItem'
  152. comp.PurchaseOrderItem,
  153.  
  154. @Semantics.calendarItem.duration: true
  155. comp.DeliveryDurationInDays,
  156.  
  157. // Goods movement data
  158. comp.GoodsMovementIsAllowed,
  159. @ObjectModel.foreignKey.association: '_StorageLocation'
  160. comp.StorageLocation,
  161. comp.Batch,
  162. -- @ObjectModel.foreignKey.association: '_DebitCreditCode'
  163. comp.DebitCreditCode,
  164. @ObjectModel.foreignKey.association: '_GoodsMovementType'
  165. comp.GoodsMovementType,
  166. @ObjectModel.foreignKey.association: '_InventorySpecialStockType'
  167. comp.InventorySpecialStockType,
  168. comp.InventorySpecialStockValnType,
  169. comp.ConsumptionPosting,
  170. @ObjectModel.foreignKey.association: '_SupplyArea'
  171. comp.SupplyArea,
  172.  
  173. // Assignments WM
  174. @ObjectModel.foreignKey.association: '_Warehouse'
  175. comp.Warehouse,
  176. comp.StorageType,
  177. comp.StorageBin,
  178.  
  179. // Assignments FI/CO
  180. @ObjectModel.foreignKey.association: '_BusinessArea'
  181. comp.BusinessArea,
  182. @ObjectModel.foreignKey.association: '_CompanyCode'
  183. comp.CompanyCode,
  184. @ObjectModel.foreignKey.association: '_GLAccount'
  185. comp.GLAccount,
  186. -- @ObjectModel.foreignKey.association: '_AccountAssignmentCategory'
  187. comp.AccountAssignmentCategory,
  188. @ObjectModel.foreignKey.association: '_FunctionalArea'
  189. comp.FunctionalArea,
  190.  
  191. // Quantities and UoM
  192. comp.QuantityIsFixed,
  193. comp.IsNetScrap,
  194. @DefaultAggregation: #MAX
  195. comp.ComponentScrapInPercent,
  196. @DefaultAggregation: #MAX
  197. comp.OperationScrapInPercent,
  198. @Semantics.unitOfMeasure: true
  199. comp.BaseUnit,
  200. @Semantics.quantity.unitOfMeasure: 'BaseUnit'
  201. @DefaultAggregation: #SUM
  202. cast(comp.RequiredQuantity as requirementquantity preserving type) as RequiredQuantity,
  203. @Semantics.quantity.unitOfMeasure: 'BaseUnit'
  204. @DefaultAggregation: #SUM
  205. comp.WithdrawnQuantity,
  206. @Semantics.quantity.unitOfMeasure: 'BaseUnit'
  207. @DefaultAggregation: #SUM
  208. (comp.RequiredQuantity - comp.WithdrawnQuantity) as OpenQuantity,
  209. @Semantics.quantity.unitOfMeasure: 'BaseUnit'
  210. @DefaultAggregation: #SUM
  211. cast((comp.WithdrawnQuantity - comp.RequiredQuantity) as deviationquantity) as DeviationQuantity,
  212. @Semantics.quantity.unitOfMeasure: 'BaseUnit'
  213. @DefaultAggregation: #SUM
  214. comp.ConfirmedAvailableQuantity,
  215. @Semantics.quantity.unitOfMeasure: 'BaseUnit'
  216. @DefaultAggregation: #SUM
  217. cast(Division( cast(comp.RequiredQuantity as abap.dec(16,5)),(1 + Division(comp.ComponentScrapInPercent,100,3)),3) as originaldemandquantity) as OriginalDemandQuantity,
  218. @Semantics.quantity.unitOfMeasure: 'BaseUnit'
  219. @DefaultAggregation: #SUM
  220. cast(comp.WithdrawnQuantity -
  221. (Division( cast(comp.RequiredQuantity as abap.dec(16,5)),(1 + Division(comp.ComponentScrapInPercent,100,3)),3)) as excessconsumptionquantity) as ExcessConsumptionQuantity,
  222.  
  223. @Semantics.unitOfMeasure: true
  224. comp.EntryUnit,
  225. @Semantics.quantity.unitOfMeasure: 'EntryUnit'
  226. @DefaultAggregation: #SUM
  227. comp.GoodsMovementEntryQty,
  228.  
  229. // Amounts and Currencies
  230. @Semantics.currencyCode: true
  231. comp.Currency,
  232. @DefaultAggregation: #SUM
  233. @Semantics.amount.currencyCode: 'Currency'
  234. comp.WithdrawnQuantityAmount,
  235.  
  236. @Semantics.currencyCode: true
  237. cast(_CompanyCode.Currency as vdm_v_company_code_currency preserving type) as CompanyCodeCurrency,
  238. @DefaultAggregation: #SUM
  239. @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  240. case
  241. when Currency = _CompanyCode.Currency
  242. then comp.WithdrawnQuantityAmount
  243. else
  244. cast(currency_conversion( amount => comp.WithdrawnQuantityAmount,
  245. source_currency => comp.Currency,
  246. round => 'X',
  247. target_currency => _CompanyCode.Currency,
  248. exchange_rate_date => comp.MatlCompRequirementDate,
  249. error_handling => 'SET_TO_NULL' ) as wihthdrawnamountcocurcy preserving type)
  250. end as WithdrawnQtyAmountInCoCodeCry,
  251. @DefaultAggregation: #MAX
  252. @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  253. 1 as FreeDefinedAmount1, //Hilfsfeld
  254.  
  255. // Associations
  256. _Reservation,
  257. _MfgOrder,
  258. _MfgOrderSequence,
  259. _MfgOrderOperation,
  260. _MfgOrderOperationBySemanKey,
  261. _MfgOrderCategory,
  262. _MfgOrderType,
  263. _OrdInternalBillOfOperations,
  264. _ProductionPlant,
  265. _AssemblyMRPController,
  266. _ProductionSupervisor,
  267. _MaterialGroup,
  268. _Material,
  269. _MaterialPlant,
  270. _Plant,
  271. _MRPController,
  272. _StorageLocation,
  273. _GoodsMovementType,
  274. _InventorySpecialStockType,
  275. _SupplyArea,
  276. _Warehouse,
  277. _BOMExplosion,
  278. _BOMItemCategory,
  279. _SalesOrder,
  280. _SalesOrderItem,
  281. _SalesDocument,
  282. _SalesDocumentItem,
  283. _SDDocumentCategory,
  284. _WBSElement,
  285. _PurchasingGroup,
  286. _PurchaseOrder,
  287. _PurchaseOrderItem,
  288. _PurchaseRequisition,
  289. _PurchaseRequisitionItem,
  290. _CompanyCode,
  291. _BusinessArea,
  292. _FunctionalArea,
  293. _GLAccount,
  294. _BaseUnit,
  295. _EntryUnit,
  296. _Currency,
  297. _CompanyCodeCurrency,
  298. _RequirementDate,
  299. _RequirementDateMonth,
  300. _RequirementDateYear,
  301. _RequirementDateWeekDay,
  302. _ReportingPeriod
  303. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement