I_BUSINESSPARTNERRATING

CDS View

Rating of Business Partner

I_BUSINESSPARTNERRATING is a CDS View in S/4HANA. Rating of Business Partner. It contains 11 fields. 7 CDS views read from this table.

CDS Views using this table (7)

ViewTypeJoinVDMDescription
A_BusinessPartnerRating view from BASIC Ratings
I_BusinessPartnerRatingTP view_entity from TRANSACTIONAL Ratings - TP
I_LoanContrBPCurRatgWthDflt view left_outer COMPOSITE Rating data for Business partner with defaulting
I_LoanContrDataBPCurRatWthDflt view left_outer COMPOSITE Loan Contract Business Partner Rating with defaulting
I_TrsyCtptyLmtBPRatingCube view inner COMPOSITE Treasury Counterparty Limit Business Partner Rating - Cube
P_LoanContrBPCurRatg view left_outer COMPOSITE Ratings of Business Partner
R_CrdtMBusPartnerRatingTP view_entity from TRANSACTIONAL Credit Rating of a Business Partner

Fields (11)

KeyField CDS FieldsUsed in Views
KEY BPRatingValidityEndDate BPRatingValidityEndDate 1
KEY BusinessPartner BusinessPartner 1
KEY BusinessPartnerRatingProcedure BusinessPartnerRatingProcedure 2
BPRatingCreationDate BPRatingCreationDate 1
BPRatingIsValidOnKeyDate BPRatingIsValidOnKeyDate 1
BPRatingValidityStartDate BPRatingValidityStartDate 1
BusinessPartnerRatingComment BusinessPartnerRatingComment 1
BusinessPartnerRatingGrade BusinessPartnerRatingGrade 1
BusinessPartnerRatingIsAllowed BusinessPartnerRatingIsAllowed 1
BusinessPartnerRatingIsExpired BusinessPartnerRatingIsExpired 1
BusinessPartnerRatingTrend BusinessPartnerRatingTrend 1
@AbapCatalog: { sqlViewName: 'IBPRATING',
                compiler.compareFilter: true,
                buffering.status: #NOT_ALLOWED
              }
@AccessControl: {authorizationCheck: #MANDATORY,
                 personalData.blocking: #REQUIRED,
                 personalData.blockingIndicator: [ '_BusinessPartner.IsBusinessPurposeCompleted' ]
                }
@ObjectModel: { representativeKey: 'BusinessPartner',
                sapObjectNodeType.name: 'BusinessPartnerRating',
                usageType: { dataClass: #MASTER,
                             serviceQuality: #B,
                             sizeCategory: #XXL
                           },
                supportedCapabilities: [  #ANALYTICAL_DIMENSION,
                                          #CDS_MODELING_DATA_SOURCE,
                                          #CDS_MODELING_ASSOCIATION_TARGET,
                                          #SQL_DATA_SOURCE,
                                          #EXTRACTION_DATA_SOURCE ],
                modelingPattern: #ANALYTICAL_DIMENSION                          
              }
@Analytics: { dataExtraction.enabled: true,
              dataCategory: #DIMENSION,
              internalName: #LOCAL
            }
@Metadata: { ignorePropagatedAnnotations: true,  // For C1-Release

             allowExtensions: true
           }
@Consumption.dbHints: [ 'USE_HEX_PLAN' ]           
@VDM.viewType: #BASIC           
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'Rating of Business Partner'

/*+[hideWarning] { "IDS" :  [ "KEY_CHECK" ] } */
define view I_BusinessPartnerRating
  as select from bp1012
  association [1]    to I_BusinessPartner         as _BusinessPartner          on  $projection.BusinessPartner                = _BusinessPartner.BusinessPartner      // <--- to inherit authorizations in DCL

  association [0..1] to I_BPFinancialServicesExtn as _BPFinancialServicesExtn  on  $projection.BusinessPartner                = _BPFinancialServicesExtn.BusinessPartner // <--- to inherit authorizations in DCL

  association [0..1] to I_BPRatingTrend           as _BPRatingTrend            on  $projection.BusinessPartnerRatingTrend     = _BPRatingTrend.BusinessPartnerRatingTrend 
  association [0..1] to I_BPRatingProcedure       as _BPRatingProcedure        on  $projection.BusinessPartnerRatingProcedure = _BPRatingProcedure.BusinessPartnerRatingProcedure

  association [0..1] to I_BPRatingProcedureGrade  as _BPRatingProcedureGrade   on  $projection.BusinessPartnerRatingProcedure = _BPRatingProcedureGrade.BusinessPartnerRatingProcedure
                                                                               and $projection.BusinessPartnerRatingGrade     = _BPRatingProcedureGrade.BusinessPartnerRatingGrade

{
  key bp1012.partner             as BusinessPartner,
      @ObjectModel.foreignKey.association: '_BPRatingProcedure'
  key bp1012.grade_method        as BusinessPartnerRatingProcedure,
      @Semantics.businessDate.to: true
  key bp1012.date_to             as BPRatingValidityEndDate,
      bp1012.grade               as BusinessPartnerRatingGrade,
      bp1012.tendency            as BusinessPartnerRatingTrend,
      @Semantics.businessDate.from: true
      bp1012.date_from           as BPRatingValidityStartDate,
      bp1012.date_when           as BPRatingCreationDate,
      bp1012.text                as BusinessPartnerRatingComment,      
      bp1012.flg_permit          as BusinessPartnerRatingIsAllowed,
      bp1012.longtext            as BPRatingLongComment,
      
      // Calculation of IsRatingValidToday:

      //      If current date (today) is between bp1012.date_from and bp1012.date_to then IsRatingValidToday = true.

      cast (  case
        when bp1012.date_to >= tstmp_to_dats( tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ),  $session.client, 'NULL')
           and bp1012.date_from <=tstmp_to_dats( tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ),  $session.client, 'NULL')
        then 'X'
        else ''
      end   as bp_rat_valid preserving type) as BPRatingIsValidOnKeyDate,
      
     cast ( tstmp_to_dats( tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ),  $session.client, 'NULL')  as bp_rat_key_date preserving type) as BusinessPartnerRatingKeyDate,

      // Calculation of IsRatingExpired: 

      //      (Expiry days - Permitted Period) = Protected Since, which is the number of days since the rating is protected

      //      A negative value means the rating is not protected yet.

      //      Example:

      //      bp1012.date_to = 01.01.2018 and today is 01.01.2019 and Grade Protection Period is 300 days

      //      ( 01.01.2019 - 01.01.2018) - 300 = 365 - 300 = 65  --> Rating is proteced since 65 days -> User needs corresponding authorization if SACF is active

      cast ( case left(cast(( dats_days_between(bp1012.date_to, tstmp_to_dats( tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL' ))
          - cast(_BPRatingProcedure.BPRatingStandardAccessDays as abap.int4) ) as abap.char( 16 )),1)
        when '-' then '' // date_to in the future

        when '0' then '' // date_to = today

        else 'X'         // date_to in the past and lower than threshold of grade method

      end  as bp_rat_expired preserving type) as BusinessPartnerRatingIsExpired,

      _BPRatingProcedure,
      _BPRatingProcedureGrade,
      _BPRatingTrend,
      
      _BusinessPartner,
      _BPFinancialServicesExtn
}