I_BPRATINGPROCESS

CDS View

Rating of Business Partner (Process)

I_BPRATINGPROCESS is a CDS View in S/4HANA. Rating of Business Partner (Process). It contains 6 fields. 3 CDS views read from this table.

CDS Views using this table (3)

ViewTypeJoinVDMDescription
I_BPRatingProcessChanges view from Changes of BPRatingProcessTP
I_BPRatingProcessChanges view union Changes of BPRatingProcessTP
I_BPRatingProcessTP view_entity from Rating of Business Partner (Process)

Fields (6)

KeyField CDS FieldsUsed in Views
KEY MasterDataChangeProcess MasterDataChangeProcess 1
KEY MDChgProcessSrceObject MDChgProcessSrceObject 1
KEY MDChgProcessSrceSystem MDChgProcessSrceSystem 1
KEY MDChgProcessStep MDChgProcessStep 1
BusinessPartnerRatingIsExpired BusinessPartnerRatingIsExpired 1
MDChgProcessSourceModified MDChgProcessSourceModified 1
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #MANDATORY
@EndUserText.label: 'Rating of Business Partner (Process)'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
  serviceQuality: #A,
  sizeCategory: #XXL,
  dataClass: #TRANSACTIONAL
}
@Consumption.dbHints: [ 'USE_HEX_PLAN' ]
/*+[hideWarning] { "IDS" : [ "KEY_CHECK" ]  } */
define view entity I_BPRatingProcess
  as select from bp1012_prc
  association [1..1] to I_BusinessPartnerProcess  as _BusinessPartner        on  bp1012_prc.process_id      = _BusinessPartner.MasterDataChangeProcess
                                                                             and bp1012_prc.process_step_no = _BusinessPartner.MDChgProcessStep
                                                                             and bp1012_prc.source_system   = _BusinessPartner.MDChgProcessSrceSystem
                                                                             and bp1012_prc.source_id       = _BusinessPartner.MDChgProcessSrceObject
  association [0..1] to I_BPFinServicesDetailProc as _BPFinServicesDetail    on  bp1012_prc.process_id      = _BPFinServicesDetail.MasterDataChangeProcess
                                                                             and bp1012_prc.process_step_no = _BPFinServicesDetail.MDChgProcessStep
                                                                             and bp1012_prc.source_system   = _BPFinServicesDetail.MDChgProcessSrceSystem
                                                                             and bp1012_prc.source_id       = _BPFinServicesDetail.MDChgProcessSrceObject


  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 process_id                                                                                                                                                         as MasterDataChangeProcess,
  key process_step_no                                                                                                                                                    as MDChgProcessStep,
  key source_system                                                                                                                                                      as MDChgProcessSrceSystem,
  key source_id                                                                                                                                                          as MDChgProcessSrceObject,
      @ObjectModel.foreignKey.association: '_BPRatingProcedure'
  key bp1012_prc.grade_method                                                                                                                                            as BusinessPartnerRatingProcedure,
      @Semantics.businessDate.to: true
  key bp1012_prc.date_to                                                                                                                                                 as BPRatingValidityEndDate,
      bp1012_prc.grade                                                                                                                                                   as BusinessPartnerRatingGrade,
      bp1012_prc.tendency                                                                                                                                                as BusinessPartnerRatingTrend,
      @Semantics.businessDate.from: true
      bp1012_prc.date_from                                                                                                                                               as BPRatingValidityStartDate,
      bp1012_prc.date_when                                                                                                                                               as BPRatingCreationDate,
      bp1012_prc.text                                                                                                                                                    as BusinessPartnerRatingComment,
      bp1012_prc.flg_permit                                                                                                                                              as BusinessPartnerRatingIsAllowed,
      bp1012_prc.longtext                                                                                                                                                as BPRatingLongComment,

      // Calculation of IsRatingValidToday:

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

      cast (  case
        when bp1012_prc.date_to >= tstmp_to_dats( tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ),  $session.client, 'NULL')
           and bp1012_prc.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_prc.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_prc.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,

      source_modified                                                                                                                                                    as MDChgProcessSourceModified,
      source_modification_blip                                                                                                                                           as MDChgProcessSourceModifBinary,
      source_recency                                                                                                                                                     as MDChgProcSrceLastChgdDateTime,

      _BusinessPartner,
      _BPFinServicesDetail,
      _BPRatingProcedure,
      _BPRatingProcedureGrade
}