I_PURCHASEORDERNETAMOUNT

CDS View

Calculation of net amount on purchase order header level

I_PURCHASEORDERNETAMOUNT is a CDS View in S/4HANA. Calculation of net amount on purchase order header level. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
C_PurchaseOrderWorkflowEmail view left_outer CONSUMPTION Purchase Order Details for Workflow Deadline Email

@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName: 'IPURORDNETAMOUNT'
@EndUserText.label: 'Calculation of net amount on purchase order header level'
@AbapCatalog.compiler.compareFilter: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #CHECK

@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.semanticKey: 'PurchaseOrder'
@ObjectModel.representativeKey: 'PurchaseOrder'


define view I_PurchaseOrderNetAmount
  as select from I_PurchaseOrderItem

  association [0..1] to I_Currency as _Currency on $projection.DocumentCurrency = _Currency.Currency
  association [1..1] to I_PurchaseOrder               as _PurchaseOrder               on  $projection.PurchaseOrder = _PurchaseOrder.PurchaseOrder

{
  key PurchaseOrder,

      @Semantics.currencyCode: true
      DocumentCurrency,
      @Semantics.amount.currencyCode: 'DocumentCurrency'
      @DefaultAggregation: #SUM
      sum(
          case PurchasingDocumentDeletionCode
              when 'L' then cast(0 as mm_pur_order_tot_net_amount)
              when 'X' then cast(0 as mm_pur_order_tot_net_amount)
              else case IsStatisticalItem
                  when 'X' then cast(0 as mm_pur_order_tot_net_amount)
                  else case IsReturnsItem
                      when 'X' then cast(-NetAmount as mm_pur_order_tot_net_amount)
                      else NetAmount
                  end
              end
          end
      ) as PurchaseOrderNetAmount,

      _Currency,
      _PurchaseOrder
}
group by
  PurchaseOrder,
  DocumentCurrency  

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_PURCHASEORDERITEM"
],
"ASSOCIATED":
[
"I_CURRENCY",
"I_PURCHASEORDER"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/