P_UserLocks

DDL: P_USERLOCKS Type: view_entity Package: SUSR

User Locks

P_UserLocks is a CDS View that provides data about "User Locks" in SAP S/4HANA. It reads from 1 data source (P_USR02) and exposes 3 fields with key field bname. Part of development package SUSR.

Data Sources (1)

SourceAliasJoin Type
P_USR02 P_USR02 from

Annotations (7)

NameValueLevelField
AbapCatalog.extensibility.extensible false view
AccessControl.authorizationCheck #CHECK view
EndUserText.label User Locks view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #M view
ObjectModel.usageType.dataClass #MIXED view
Metadata.allowExtensions false view

Fields (3)

KeyFieldSource TableSource FieldDescription
KEY bname bname
class class
casewhencodvnXthenLelseUendasno_user_pw
@AbapCatalog:   { 
                  viewEnhancementCategory: [ #NONE ]
                , extensibility: { extensible: false }
                }
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'User Locks'
@ObjectModel.usageType:{
  serviceQuality: #X,
  sizeCategory: #M,
  dataClass: #MIXED
}
@Metadata:      { allowExtensions: false }

// Used for function module 'SUSR_USER_GET_DETAIL_MASS' (mass enabled 'BAPI_USER_GET_DETAIL')

// Parameter ISLOCKD with BAPISLOCKD + User structure

// cases for uflag/lockstatus:

// 32  = global admin lock

// 64  = local admin lock

// 128 = lock due to too many wrong password logon attempts

// combined locks:

// 96  = global + local lock

// 160 = global lock + failed password logon

// 192 = local lock + failed password logon

// 224 = all possible locks


define view entity P_UserLocks
  as select from P_USR02
{
  key bname,
      @Consumption.hidden: true
      class, 
      //uflag,

      
      //uflag values indicating global admin lock

      case when
      ( uflag = 32 or uflag = 96 or uflag = 160  or uflag = 224 )
      then 'L' else 'U'
      end as global_lock,

      //uflag values indicating local admin lock

      case when
      ( uflag = 64 or uflag = 96 or uflag = 192 or uflag = 224 )
      then 'L' else 'U'
      end as local_lock,

      //uflag values indicating lock due to too many failed attemps of password login

      case when
      ( ( uflag = 128 or uflag = 160 or uflag = 192 or uflag = 224 ) and codvn <> 'X' )
      then 'L' else 'U'
      end as wrong_pwd,

      //indicator for password deactivation ( codvn = 'X' ) is mapped to 'L' = locked according to BAPISLOCKD

      case when codvn = 'X' then 'L' else 'U'
      end as no_user_pw
}