FINOC_RULE_SOX_BASE

DDL: FINOC_RULE_SOX_BASE SQL: FINOC_RULE_VXB Type: view

Organizational Changes: Base Rle IC SOI

FINOC_RULE_SOX_BASE is a CDS View that provides data about "Organizational Changes: Base Rle IC SOI" in SAP S/4HANA. It reads from 3 data sources (jest, finoc_orglchg, vbak) and exposes 10 fields with key fields kdauf, kdpos, orgl_change.

Data Sources (3)

SourceAliasJoin Type
jest j left_outer
finoc_orglchg oc inner
vbak sd from

Annotations (8)

NameValueLevelField
AbapCatalog.sqlViewName FINOC_RULE_VXB view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #L view
EndUserText.label Organizational Changes: Base Rle IC SOI view

Fields (10)

KeyFieldSource TableSource FieldDescription
KEY kdauf sdi vbeln
KEY kdpos sdi posnr
KEY orgl_change finoc_orglchg orgl_change
werks sdi werks
matnr sdi matnr
kokrs caa kokrs
bukrs vbak bukrs_vf
prctr
objnr sdi objnr
gbsta sdi gbsta
@AbapCatalog.sqlViewName: 'FINOC_RULE_VXB'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #L
@EndUserText.label: 'Organizational Changes: Base Rle IC SOI'

// This CDS view identifies all sales document items where delivering and invoicing

// company codes are different. Similar to FINOC_RULE_SOI_BASE, it checks for the SDI's status -

// consult it's documentation to understand this better, as well as the cross join with finoc_orglchg.

// When the PCTRF (profit center of external invoicing) is not set, it should return the

// PRCTR of the SDI. Later, at SDI reassignment, it sets a new PCTRF only if the field was not

// initial before or it differs from PRCTR.


define view FINOC_RULE_SOX_BASE
  as select from           vbak                as sd
    join                   vbap                as sdi on sd.vbeln = sdi.vbeln
    join                   t001k               as va  on va.bwkey = sdi.werks
    join                   tka02               as caa on sd.bukrs_vf = caa.bukrs
    inner join             finoc_orglchg       as oc  on oc.processing_status <> 'CMP'
    left outer join        jest                as j   on  sdi.objnr = j.objnr
                                                      and j.inact   = ''
                                                      and (
                                                         j.stat     = 'I0046' // closed

                                                         or j.stat  = 'I0076' // deletion flag

                                                         or j.stat  = 'I0013' // deletion indicator

                                                       )
    left outer to one join FINOC_RT_SOI_MONTHS as sdm on  sdi.vbeln = sdm.SalesDocument
                                                      and sdi.posnr = sdm.SalesDocumentItem
    left outer to one join finoc_rt_sox        as rt  on  rt.kdauf           = sdi.vbeln
                                                      and rt.kdpos           = sdi.posnr
                                                      and rt.orgl_change     = oc.orgl_change
                                                      and rt.reassgmt_status = 'DONE'
{
  key sdi.vbeln                                                     as kdauf,
  key sdi.posnr                                                     as kdpos,
  key oc.orgl_change,
      sdi.werks,
      sdi.matnr,
      caa.kokrs,
      sd.bukrs_vf                                                   as bukrs, // invoicing company code for restriction checking

      sd.bukrs_vf                                                   as bukrs_invoicing, // second use for compatibility with old version

      va.bukrs                                                      as bukrs_delivering,
      // Switch of roles, see corrective measure 0020751258 0000240063 2023,

      // "Organizational Change: Correction for Intercompany Sales Order"

      //   sd.bukrs_vf  as bukrs_invoicing,

      //     va.bukrs,  // for restriction checkking

      case when rt.prctr_old is not null then rt.prctr_old
           when sdi.pctrf is not initial then sdi.pctrf
           else sdi.prctr
      end                                                           as prctr_old, // profit center f before orgl change

      cast('          ' as finoc_prctr_new preserving type)         as prctr, // profit center f after orgl change

      sdi.objnr,
      sdi.gbsta,
      cast( '  ' as finoc_prctr_drvtn_source_type preserving type ) as prctr_drvtn_source_type
}
where
           sd.bukrs_vf                <> va.bukrs // billed company code (vbak) is not the company code of the plant of the material delivered (vbap)


  and(     // status handling








           (
          sdi.objnr                   <> ''   // status handling for SD items, which are CO objects

          and  j.stat                 is null // not closed or having deletion flag or indicator

        )
    or(
           sdi.objnr                  =  '' // status/age handling for SD items, which are no CO objects

      and(
           sdi.gbsta                  <> 'C'               // not completed

        or sdm.CreationDatePlusMonths >= oc.effective_date // yet completed, but within a certain time range (see customizing)

      )
    )
  )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"FINOC_RT_SOI_MONTHS",
"FINOC_ORGLCHG",
"FINOC_RT_SOX",
"JEST",
"T001K",
"TKA02",
"VBAK",
"VBAP"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/