ATOV_COL_VER_BASE

CDS View

Collection Version Base View

ATOV_COL_VER_BASE is a CDS View in S/4HANA. Collection Version Base View. It contains 6 fields. 5 CDS views read from this table.

CDS Views using this table (5)

ViewTypeJoinVDMDescription
ATOV_CL_EXP_FAILED view left_outer Get changelists still in status ER
atov_cl_Item_exp_latest_rel view left_outer SAP Basis release of last Item export
ATOV_COL_COUNT_VERSION view from Count versions of collections
ATOV_COL_VER view from Collection Version
Atov_Col_Ver_Transport view left_outer Get Collection Version and Transports

Fields (6)

KeyField CDS FieldsUsed in Views
KEY collection_id collection_id 3
KEY collection_version collection_version 3
basis_release basis_release 1
is_latest_version is_latest_version 1
status status 1
timestamp timestamp 2
@AbapCatalog.sqlViewName: 'ATO_V_CV_B'
@ClientHandling:{ type: #INHERITED, algorithm: #SESSION_VARIABLE }
@EndUserText.label: 'Collection Version Base View'
define view ATOV_COL_VER_BASE
  as

  select from ATOV_COL_VER_KEY as Collection_Version_Key

  association [1]    to ato_col_versions          as Collection_Version_Detail     on  Collection_Version_Detail.collection_id = Collection_Version_Key.collection_id
                                                                                   and Collection_Version_Detail.version       = Collection_Version_Key.collection_version
                                                                                   and Collection_Version_Detail.timestamp     = Collection_Version_Key.timestamp
// replaced due to performance impact

//  association [0..1] to ATOV_COL_VER_ASSIGNED_MAX as Latest_Assignment             on  Latest_Assignment.collection_id      = Collection_Version_Key.collection_id

//                                                                                   and Latest_Assignment.collection_version = Collection_Version_Key.collection_version

// only latest collection assignment is supported

 association [0..1] to ATOV_COL_ASSIGNED_MAX      as Latest_Assignment             on  Latest_Assignment.collection_id      = Collection_Version_Key.collection_id

  association [1]    to ATOV_COL_VER_KEY_MAX      as Latest_Collection_Version_Key on  Latest_Collection_Version_Key.collection_id = Collection_Version_Key.collection_id

{
  key Collection_Version_Key.collection_id,
  key Collection_Version_Key.collection_version,
      Collection_Version_Key.timestamp,
      Collection_Version_Detail.status,
      Collection_Version_Detail.action          as action,
      Collection_Version_Detail.action_variant,

      //calculate "running" status

      case when Collection_Version_Detail.action_status = 'P' then
        case when Collection_Version_Detail.planned_job_start = 0000000000000000
          then 'R'
          else Collection_Version_Detail.action_status
        end
        else Collection_Version_Detail.action_status
      end                                       as action_status,

      Collection_Version_Detail.last_changed_by as action_executed_by,
      Collection_Version_Detail.last_changed_at as action_executed_at,
      Collection_Version_Detail.ballog_handle,
      Collection_Version_Detail.action_duration,
      Collection_Version_Detail.planned_job_start,
      Collection_Version_Detail.planned_downtime_start,
// TODO just relevant in an export system and only for the latest version => but it will be used together with change_type

// extract these fields for the specific use case !!

// might be optimized in an VIEW which just focuses the latest version and then union for the historic versions            

      Latest_Assignment.assigned_at             as item_assigned_at,
      Latest_Assignment.assigned_by             as item_assigned_by,

      case when Latest_Collection_Version_Key.collection_version = Collection_Version_Key.collection_version
        then 'X'
        else ''
      end                                       as is_latest_version,

      //determine change type: item_assignment, action, or transient_action

      case when Latest_Collection_Version_Key.collection_version = Collection_Version_Key.collection_version and // only latest version

                ( Latest_Assignment.assigned_at > Collection_Version_Detail.last_changed_at or
                  Collection_Version_Detail.action = 'C' ) and  // check is not relevant at it does not realy change the collection

               // Collection_Version_Detail.action_status <> 'R' and

               // Collection_Version_Detail.action_status <> 'P' and

               Collection_Version_Detail.status        =  'D'  // only for Versions which are in Development (even Check will still keep "D")              

        then 'item_assignment'
        else case when Collection_Version_Detail.action <> ''
          then 'action'
          else 'transient_action'
        end
      end                                       as change_type,
      Collection_Version_Detail.basis_release,
      Collection_Version_Detail.count_all_items_in_col_at_exp
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"ATOV_COL_ASSIGNED_MAX",
"ATOV_COL_VER_KEY",
"ATOV_COL_VER_KEY_MAX",
"ATO_COL_VERSIONS"
],
"ASSOCIATED":
[
"ATOV_COL_ASSIGNED_MAX",
"ATOV_COL_VER_KEY_MAX",
"ATO_COL_VERSIONS"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/