I_GrossPartNetByCostCtrC

DDL: I_GROSSPARTNETBYCOSTCTRC SQL: IGRSSNETCOC Type: view COMPOSITE

Gross Partner Net By Cost Center

I_GrossPartNetByCostCtrC is a Composite CDS View (Cube) that provides data about "Gross Partner Net By Cost Center" in SAP S/4HANA. It reads from 6 data sources and exposes 54 fields with key fields CompanyCode, Ledger, FiscalYear, AccountingDocument, LedgerGLLineItem. It has 1 association to related views.

Data Sources (6)

SourceAliasJoin Type
I_JntVntrEquityGrp EqGroup left_outer
I_JntVntrPartOwnrEquityShr I_JntVntrPartOwnrEquityShr inner
I_JVALineItemCube JVItem from
I_JntVntrCoCodeParam JVPars inner
I_JntVntrPartOwnrEquityShr PShare left_outer
I_JointVentureMasterFld Venture inner

Parameters (3)

NameTypeDefault
P_LedgerFiscalYear gjahr
P_FiscalPeriod poper
P_JointVenturePartner jv_part

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_JntVntrBusinessPartner _JntVntrBusinessPartner $projection.CompanyCode = _JntVntrBusinessPartner.CompanyCode and $projection.JointVenturePartner = _JntVntrBusinessPartner.JointVenturePartner

Annotations (14)

NameValueLevelField
AbapCatalog.sqlViewName IGRSSNETCOC view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
EndUserText.label Gross Partner Net By Cost Center view
VDM.viewType #COMPOSITE view
Analytics.dataCategory #CUBE view
Metadata.ignorePropagatedAnnotations true view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
AccessControl.personalData.blocking #BLOCKED_DATA_EXCLUDED view
Metadata.allowExtensions true view
Analytics.internalName #LOCAL view

Fields (54)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_JVALineItemCube CompanyCode
KEY Ledger I_JVALineItemCube Ledger
KEY FiscalYear I_JVALineItemCube FiscalYear
KEY AccountingDocument I_JVALineItemCube AccountingDocument
KEY LedgerGLLineItem I_JVALineItemCube LedgerGLLineItem
FiscalYearVariant I_JVALineItemCube FiscalYearVariant
FiscalPeriod I_JVALineItemCube FiscalPeriod
PostingDate I_JVALineItemCube PostingDate
LedgerFiscalYear I_JVALineItemCube LedgerFiscalYear
GLRecordType I_JVALineItemCube GLRecordType
ChartOfAccounts I_JVALineItemCube ChartOfAccounts
GLAccount I_JVALineItemCube GLAccount
DebitCreditCode I_JVALineItemCube DebitCreditCode
ControllingArea I_JVALineItemCube ControllingArea
CostCenter I_JVALineItemCube CostCenter
ProfitCenter I_JVALineItemCube ProfitCenter
BusinessArea I_JVALineItemCube BusinessArea
MasterFixedAsset I_JVALineItemCube MasterFixedAsset
FixedAsset I_JVALineItemCube FixedAsset
AssetTransactionType I_JVALineItemCube AssetTransactionType
OrderID I_JVALineItemCube OrderID
ProjectNetwork I_JVALineItemCube ProjectNetwork
WBSElementInternalID I_JVALineItemCube WBSElementInternalID
WBSElementExternalID I_JVALineItemCube WBSElementExternalID
JointVenture I_JVALineItemCube JointVenture
JointVentureType I_JointVentureMasterFld JointVentureType
JointVentureEquityGroup I_JVALineItemCube JointVentureEquityGroup
JointVentureEquityType I_JVALineItemCube JointVentureEquityType
JntVntrOperatedShare I_JntVntrEquityGrp JntVntrOperatedShare
JntVntrEquityShare I_JntVntrPartOwnrEquityShr JntVntrEquityShare
JointVentureCostRecoveryCode I_JVALineItemCube JointVentureCostRecoveryCode
JointVenturePartner
Operator I_JntVntrCoCodeParam Operator
JointVentureBillingType I_JVALineItemCube JointVentureBillingType
BaseUnit I_JVALineItemCube BaseUnit
Quantity I_JVALineItemCube Quantity
Supplier I_JVALineItemCube Supplier
AccountingDocumentType I_JVALineItemCube AccountingDocumentType
FinancialAccountType I_JVALineItemCube FinancialAccountType
Segment I_JVALineItemCube Segment
Customer I_JVALineItemCube Customer
SalesOrganization I_JVALineItemCube SalesOrganization
ValuationArea I_JVALineItemCube ValuationArea
Plant I_JVALineItemCube Plant
DistributionChannel I_JVALineItemCube DistributionChannel
OrganizationDivision I_JVALineItemCube OrganizationDivision
ServiceDocument I_JVALineItemCube ServiceDocument
SalesDocument I_JVALineItemCube SalesDocument
AssetClass I_JVALineItemCube AssetClass
JntVntrInterestType I_JntVntrPartOwnrEquityShr JntVntrInterestType
TransactionCurrency I_JVALineItemCube TransactionCurrency
CompanyCodeCurrency I_JVALineItemCube CompanyCodeCurrency
GlobalCurrency I_JVALineItemCube GlobalCurrency
BalanceTransactionCurrency I_JVALineItemCube BalanceTransactionCurrency
@AbapCatalog.sqlViewName: 'IGRSSNETCOC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Gross Partner Net By Cost Center'
@VDM.viewType: #COMPOSITE
@Analytics: { dataCategory: #CUBE }
@Metadata.ignorePropagatedAnnotations: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED
@Metadata.allowExtensions:true
@Analytics.internalName:#LOCAL

define view I_GrossPartNetByCostCtrC
  with parameters
    P_LedgerFiscalYear    : gjahr,
    P_FiscalPeriod        : poper,
    P_JointVenturePartner : jv_part

  as select from    I_JVALineItemCube          as JVItem

    inner join      I_JntVntrCoCodeParam       as JVPars  on JVPars.CompanyCode = JVItem.CompanyCode

    inner join      I_JointVentureMasterFld    as Venture on  Venture.CompanyCode  = JVItem.CompanyCode
                                                          and Venture.JointVenture = JVItem.JointVenture

  //Select only data with a venture and an equity group with the given partner

    inner join      I_JntVntrPartOwnrEquityShr            on  I_JntVntrPartOwnrEquityShr.CompanyCode          = JVItem.CompanyCode
                                                          and I_JntVntrPartOwnrEquityShr.JointVenture         = JVItem.JointVenture
                                                          and I_JntVntrPartOwnrEquityShr.JntOpgAgrmtEquityGrp = JVItem.JointVentureEquityGroup
                                                          and I_JntVntrPartOwnrEquityShr.JointVenturePartner  = $parameters.P_JointVenturePartner

    left outer join I_JntVntrEquityGrp         as EqGroup on  EqGroup.CompanyCode          = JVItem.CompanyCode
                                                          and EqGroup.JointVenture         = JVItem.JointVenture
                                                          and EqGroup.JntOpgAgrmtEquityGrp = JVItem.JointVentureEquityGroup

    left outer join I_JntVntrPartOwnrEquityShr as PShare  on  PShare.CompanyCode           = JVItem.CompanyCode
                                                          and PShare.JointVenture          = JVItem.JointVenture
                                                          and PShare.JntOpgAgrmtEquityGrp  = JVItem.JointVentureEquityGroup
                                                          and (
                                                             PShare.JointVenturePartner    = $parameters.P_JointVenturePartner
                                                             or PShare.JointVenturePartner = '2'
                                                           )

  association [0..1] to I_JntVntrBusinessPartner as _JntVntrBusinessPartner on  $projection.CompanyCode         = _JntVntrBusinessPartner.CompanyCode
                                                                            and $projection.JointVenturePartner = _JntVntrBusinessPartner.JointVenturePartner

{
      @ObjectModel.foreignKey.association: '_CompanyCode'
  key JVItem.CompanyCode,
      @ObjectModel.foreignKey.association: '_Ledger'
  key JVItem.Ledger,
      @ObjectModel.foreignKey.association: '_FiscalYear'
  key JVItem.FiscalYear,
      @ObjectModel.foreignKey.association: '_JournalEntry'
  key JVItem.AccountingDocument,
  key JVItem.LedgerGLLineItem,

      @ObjectModel.foreignKey.association: '_FiscalYearVariant'
      @Semantics.fiscal.yearVariant: true
      JVItem.FiscalYearVariant,

      JVItem.FiscalPeriod,

      JVItem.PostingDate,

      @Semantics.fiscal.year: true
      JVItem.LedgerFiscalYear,

      JVItem.GLRecordType,

      @ObjectModel.foreignKey.association: '_ChartOfAccounts'
      JVItem.ChartOfAccounts,

      @ObjectModel.foreignKey.association: '_GLAccountInChartOfAccounts'
      JVItem.GLAccount,

      @ObjectModel.foreignKey.association: '_DebitCreditCode'
      JVItem.DebitCreditCode,

      @ObjectModel.foreignKey.association: '_ControllingArea'
      JVItem.ControllingArea,

      @ObjectModel.foreignKey.association: '_CostCenter'
      JVItem.CostCenter,

      @ObjectModel.foreignKey.association: '_ProfitCenter'
      JVItem.ProfitCenter,

      @ObjectModel.foreignKey.association: '_BusinessArea'
      JVItem.BusinessArea,

      @ObjectModel.foreignKey.association: '_MasterFixedAsset'
      JVItem.MasterFixedAsset,

      JVItem.FixedAsset,
      @ObjectModel.foreignKey.association: '_AssetTransactionType'
      JVItem.AssetTransactionType,

      @ObjectModel.foreignKey.association: '_Order'
      JVItem.OrderID,

      @ObjectModel.foreignKey.association: '_ProjectNetwork'
      JVItem.ProjectNetwork,

      @ObjectModel.foreignKey.association: '_WBSElementBasicData'
      JVItem.WBSElementInternalID,

      @ObjectModel.foreignKey.association: '_WBSElementExternalID'
      JVItem.WBSElementExternalID,

      @ObjectModel.foreignKey.association: '_JointVentureMasterFld'
      JVItem.JointVenture,

      Venture.JointVentureType,

      @ObjectModel.foreignKey.association: '_JntVntrEquityGrp'
      JVItem.JointVentureEquityGroup,

      @ObjectModel.foreignKey.association: '_JntVntrEquityTypeMaster'
      JVItem.JointVentureEquityType,

      EqGroup.JntVntrOperatedShare,

      PShare.JntVntrEquityShare,

      @ObjectModel.foreignKey.association: '_JntVntrRecoveryInd'
      JVItem.JointVentureCostRecoveryCode,

      @ObjectModel.foreignKey.association: '_JntVntrBusinessPartner'
      cast( $parameters.P_JointVenturePartner as jv_part_cds preserving type ) as JointVenturePartner,

      JVPars.Operator,

      @ObjectModel.foreignKey.association: '_JointVenturePayrollType'
      JVItem.JointVentureBillingType,

      @Semantics.unitOfMeasure:true
      @ObjectModel.foreignKey.association: '_BaseUnit'
      JVItem.BaseUnit,

      @Aggregation.default: #SUM
      @Semantics: { quantity : {unitOfMeasure: 'BaseUnit'} }
      JVItem.Quantity,



      //fields added to fulfill DCL check from I_GLAccountLineItemCube

      JVItem.Supplier,
      JVItem.AccountingDocumentType,
      JVItem.FinancialAccountType,
      JVItem.Segment,
      JVItem.Customer,
      JVItem.SalesOrganization,
      JVItem.ValuationArea,
      JVItem.Plant,
      JVItem.DistributionChannel,
      JVItem.OrganizationDivision,
      JVItem.ServiceDocument,
      JVItem.SalesDocument,
      JVItem.AssetClass,

      PShare.JntVntrInterestType,



      //--------------------Transaction Currency-----------------------

      @Semantics.currencyCode: true
      @ObjectModel.foreignKey.association: '_TransactionCurrency'
      JVItem.TransactionCurrency,

      //Gross amounts in transaction currency


      @Aggregation.default: #SUM
      @Semantics: { amount : { currencyCode: 'TransactionCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                JVItem.FiscalPeriod     = $parameters.P_FiscalPeriod     and
                PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInTransactionCurrency as jv_cpamt_tc preserving type )
        else
          cast( 0 as jv_cpamt_tc )
      end                                                                      as CurPerdAmtInTC,

      @Aggregation.default: #SUM
      @Semantics: { amount : { currencyCode: 'TransactionCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInTransactionCurrency as jv_ytdamt_tc preserving type )
        else
          cast( 0 as jv_ytdamt_tc )
      end                                                                      as YrToDteAmtInTransacCrcy,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
      case when PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInTransactionCurrency as jv_itdamt_tc preserving type )
        else
          cast( 0 as jv_itdamt_tc )
      end                                                                      as ITDAmtInTC,

      //Net amounts in transaction currency


      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'TransactionCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                JVItem.FiscalPeriod     = $parameters.P_FiscalPeriod     and
                PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInTransactionCurrency * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_tc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInTransactionCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInTransactionCurrency end
          else cast( 0 as jv_cp_netamt_tc ) end
        else cast( 0 as jv_cp_netamt_tc )
      end                                                                      as CurPerdNetAmtInTC,

      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'TransactionCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInTransactionCurrency * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_tc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInTransactionCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInTransactionCurrency end
          else cast( 0 as jv_ytd_netamt_tc ) end
        else cast( 0 as jv_ytd_netamt_tc )
      end                                                                      as YTDNetAmtInTC,

      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'TransactionCurrency'} }
      case when PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInTransactionCurrency * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_tc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInTransactionCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInTransactionCurrency end
          else cast( 0 as jv_itd_netamt_tc ) end
        else cast( 0 as jv_itd_netamt_tc )
      end                                                                      as ITDNetAmtInTC,


      //Suspension Share Amount

      @Semantics: { amount : { currencyCode: 'TransactionCurrency'} }
      @DefaultAggregation: #SUM
      case $parameters.P_JointVenturePartner
        when PShare.JointVenturePartner then
           division( ( JVItem.AmountInTransactionCurrency * PShare.JntVntrEquityShare ), 100, 2 )
        when JVPars.Operator then
          division( ( JVItem.AmountInTransactionCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
        else cast( 0 as jv_sus_shramt_tc )
      end                                                                      as SuspShrAmtInTC,

      //Net Profit Share Amount

      @Semantics: { amount : { currencyCode: 'TransactionCurrency'} }
      @DefaultAggregation: #SUM
      case when PShare.JntVntrInterestType = '2'
        then division( ( JVItem.AmountInTransactionCurrency * PShare.JntVntrEquityShare ), 100, 2 )
        else cast( 0 as jv_npi_shramt_tc )
      end                                                                      as NetProfitIntrstShrAmtInTC,



      //-------------------Company Code Currency-------------------

      @Semantics.currencyCode: true
      @ObjectModel.foreignKey.association: '_CompanyCodeCurrency'
      JVItem.CompanyCodeCurrency,

      //Gross amounts in company code currency


      @Aggregation.default: #SUM
      @Semantics: { amount : { currencyCode: 'CompanyCodeCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                JVItem.FiscalPeriod     = $parameters.P_FiscalPeriod     and
                PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInCompanyCodeCurrency as jv_cpamt_cc preserving type )
        else
          cast( 0 as jv_cpamt_cc )
      end                                                                      as CurPerdAmtInCCrcy,

      @Aggregation.default: #SUM
      @Semantics: { amount : { currencyCode: 'CompanyCodeCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInCompanyCodeCurrency as jv_ytdamt_cc preserving type )
        else
          cast( 0 as jv_ytdamt_cc )
      end                                                                      as YearToDateAmountInCoCodeCrcy,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
      case when PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInCompanyCodeCurrency as jv_itdamt_cc preserving type )
        else
          cast( 0 as jv_itdamt_cc )
      end                                                                      as ITDAmtInCCrcy,

      //Net amounts in company code currency


      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'CompanyCodeCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                JVItem.FiscalPeriod     = $parameters.P_FiscalPeriod     and
                PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInCompanyCodeCurrency * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_cc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInCompanyCodeCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInCompanyCodeCurrency end
          else cast( 0 as jv_cp_netamt_cc ) end
        else cast( 0 as jv_cp_netamt_cc )
      end                                                                      as CurPerdNetAmtInCCrcy,

      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'CompanyCodeCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInCompanyCodeCurrency * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_cc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInCompanyCodeCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInCompanyCodeCurrency end
          else cast( 0 as jv_ytd_netamt_cc ) end
        else cast( 0 as jv_ytd_netamt_cc )
      end                                                                      as YTDNetAmtInCCrcy,

      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'CompanyCodeCurrency'} }
      case when PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInCompanyCodeCurrency * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_cc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInCompanyCodeCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInCompanyCodeCurrency end
          else cast( 0 as jv_itd_netamt_cc ) end
        else cast( 0 as jv_itd_netamt_cc )
      end                                                                      as ITDNetAmtInCCrcy,


      //Suspension Share Amount

      @Semantics: { amount : { currencyCode: 'CompanyCodeCurrency'} }
      @DefaultAggregation: #SUM
      case $parameters.P_JointVenturePartner
        when PShare.JointVenturePartner then
           division( ( JVItem.AmountInCompanyCodeCurrency * PShare.JntVntrEquityShare ), 100, 2 )
        when JVPars.Operator then
          division( ( JVItem.AmountInCompanyCodeCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
        else cast( 0 as jv_sus_shramt_cc )
      end                                                                      as SuspShrAmtInCCrcy,

      //Net Profit Share Amount

      @Semantics: { amount : { currencyCode: 'CompanyCodeCurrency'} }
      @DefaultAggregation: #SUM
      case when PShare.JntVntrInterestType = '2'
        then division( ( JVItem.AmountInCompanyCodeCurrency * PShare.JntVntrEquityShare ), 100, 2 )
        else cast( 0 as jv_npi_shramt_cc )
      end                                                                      as NetProfitIntrstShrAmtInCCrcy,



      //------------------------Global Currency-----------------------

      @ObjectModel.foreignKey.association: '_GlobalCurrency'
      @Semantics.currencyCode: true
      JVItem.GlobalCurrency,

      //Gross amounts in global currency


      @Aggregation.default: #SUM
      @Semantics: { amount : { currencyCode: 'GlobalCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                JVItem.FiscalPeriod     = $parameters.P_FiscalPeriod     and
                PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInGlobalCurrency as jv_cpamt_gc preserving type )
        else
          cast( 0 as jv_cpamt_gc )
      end                                                                      as CurPerdAmtInGCrcy,

      @Aggregation.default: #SUM
      @Semantics: { amount : { currencyCode: 'GlobalCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInGlobalCurrency as jv_ytdamt_gc preserving type )
        else
          cast( 0 as jv_ytdamt_gc )
      end                                                                      as YearToDateAmountInGlobalCrcy,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
      case when PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInGlobalCurrency as jv_itdamt_gc preserving type )
        else
          cast( 0 as jv_itdamt_gc )
      end                                                                      as ITDAmtInGCrcy,

      //Net amounts in global currency


      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'GlobalCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                JVItem.FiscalPeriod     = $parameters.P_FiscalPeriod     and
                PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInGlobalCurrency * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_gc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInGlobalCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInGlobalCurrency end
          else cast( 0 as jv_cp_netamt_gc ) end
        else cast( 0 as jv_cp_netamt_gc )
      end                                                                      as CurPerdNetAmtInGCrcy,

      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'GlobalCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInGlobalCurrency * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_gc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInGlobalCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInGlobalCurrency end
          else cast( 0 as jv_ytd_netamt_gc ) end
        else cast( 0 as jv_ytd_netamt_gc )
      end                                                                      as YTDNetAmtInGCrcy,

      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'GlobalCurrency'} }
      case when PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInGlobalCurrency * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_gc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInGlobalCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInGlobalCurrency end
          else cast( 0 as jv_itd_netamt_gc ) end
        else cast( 0 as jv_itd_netamt_gc )
      end                                                                      as ITDNetAmtInGCrcy,


      //Suspension Share Amount

      @Semantics: { amount : { currencyCode: 'GlobalCurrency'} }
      @DefaultAggregation: #SUM
      case $parameters.P_JointVenturePartner
        when PShare.JointVenturePartner then
           division( ( JVItem.AmountInGlobalCurrency * PShare.JntVntrEquityShare ), 100, 2 )
        when JVPars.Operator then
          division( ( JVItem.AmountInGlobalCurrency * EqGroup.JntVntrOperatedShare ), 100, 2 )
        else cast( 0 as jv_sus_shramt_gc )
      end                                                                      as SuspShrAmtInGCrcy,

      //Net Profit Share Amount

      @Semantics: { amount : { currencyCode: 'GlobalCurrency'} }
      @DefaultAggregation: #SUM
      case when PShare.JntVntrInterestType = '2'
        then division( ( JVItem.AmountInGlobalCurrency * PShare.JntVntrEquityShare ), 100, 2 )
        else cast( 0 as jv_npi_shramt_gc )
      end                                                                      as NetProfitIntrstShrAmtInGCrcy,



      //-------------Balance Transaction Currency---------------

      @ObjectModel.foreignKey.association: '_BalanceTransactionCurrency'
      @Semantics.currencyCode:true
      JVItem.BalanceTransactionCurrency,

      //Gross amounts in balance transaction currency


      @Aggregation.default: #SUM
      @Semantics: { amount : { currencyCode: 'BalanceTransactionCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                JVItem.FiscalPeriod     = $parameters.P_FiscalPeriod     and
                PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInBalanceTransacCrcy as jv_cpamt_btc preserving type )
        else
          cast( 0 as jv_cpamt_btc )
      end                                                                      as CurPerdAmtInBlTCrcy,

      @Aggregation.default: #SUM
      @Semantics: { amount : { currencyCode: 'BalanceTransactionCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInBalanceTransacCrcy as jv_ytdamt_btc preserving type )
        else
          cast( 0 as jv_ytdamt_btc )
      end                                                                      as YearToDateAmountInBalTransCrcy,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'BalanceTransactionCurrency'} }
      case when PShare.JntVntrInterestType <> '2' then
          cast( JVItem.AmountInBalanceTransacCrcy as jv_itdamt_btc preserving type )
        else
          cast( 0 as jv_itdamt_btc )
      end                                                                      as ITDAmtInBlTCrcy,

      //Net amounts in balance transaction currency


      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'BalanceTransactionCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                JVItem.FiscalPeriod     = $parameters.P_FiscalPeriod     and
                PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInBalanceTransacCrcy * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_btc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInBalanceTransacCrcy * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInBalanceTransacCrcy end
          else cast( 0 as jv_cp_netamt_btc ) end
        else cast( 0 as jv_cp_netamt_btc )
      end                                                                      as CurPerdNetAmtInBlTCrcy,

      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'BalanceTransactionCurrency'} }
      case when JVItem.LedgerFiscalYear = $parameters.P_LedgerFiscalYear and
                PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInBalanceTransacCrcy * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_btc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInBalanceTransacCrcy * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInBalanceTransacCrcy end
          else cast( 0 as jv_ytd_netamt_btc ) end
        else cast( 0 as jv_ytd_netamt_btc )
      end                                                                      as YTDNetAmtInBlTCrcy,

      @Aggregation.default:#SUM
      @Semantics: { amount : { currencyCode: 'BalanceTransactionCurrency'} }
      case when PShare.JntVntrInterestType <> '2' then
        case $parameters.P_JointVenturePartner
          when PShare.JointVenturePartner then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
               division( ( JVItem.AmountInBalanceTransacCrcy * PShare.JntVntrEquityShare ), 100, 2 )
            else cast( 0 as jv_cp_netamt_btc ) end
          when JVPars.Operator then
            case when JVItem.JntVntrRcvryCodeIsBillable = 'X' then
                   division( ( JVItem.AmountInBalanceTransacCrcy * EqGroup.JntVntrOperatedShare ), 100, 2 )
                 else
                   JVItem.AmountInBalanceTransacCrcy end
          else cast( 0 as jv_itd_netamt_btc ) end
        else cast( 0 as jv_itd_netamt_btc )
      end                                                                      as ITDNetAmtInBlTCrcy,


      //Suspension Share Amount

      @Semantics: { amount : { currencyCode: 'BalanceTransactionCurrency'} }
      @DefaultAggregation: #SUM
      case $parameters.P_JointVenturePartner
        when PShare.JointVenturePartner then
           division( ( JVItem.AmountInBalanceTransacCrcy * PShare.JntVntrEquityShare ), 100, 2 )
        when JVPars.Operator then
          division( ( JVItem.AmountInBalanceTransacCrcy * EqGroup.JntVntrOperatedShare ), 100, 2 )
        else cast( 0 as jv_sus_shramt_btc )
      end