得到application server上所有的logon user

简介: 通过function module THUSRINFO 可以得到当前application server instance上登陆user的详细信息,如terminal,使用的tcode, last transaction time等等。如果application server有多个instance,可以先使用function module RFC_GET_LOCAL_DESTINATIONS 取得所有的local RFC destination,再用RFC的方式调用THUSRINFO:

通过function module THUSRINFO 可以得到当前application server instance上登陆user的详细信息,如terminal,使用的tcode, last transaction time等等。如果application server有多个instance,可以先使用function module RFC_GET_LOCAL_DESTINATIONS 取得所有的local RFC destination,再用RFC的方式调用THUSRINFO:


REPORT zuser.


DATA: lt_usr_liste TYPE STANDARD TABLE OF uinfo,

     lt_total     LIKE lt_usr_liste,

     lt_rfchosts  TYPE STANDARD TABLE OF rfchosts.


CONSTANTS: gc_user_name TYPE uinfo-bname VALUE 'User Name',

          gc_tcode     TYPE uinfo-tcode VALUE 'Tcode',

          gc_term      TYPE uinfo-term VALUE 'Terminal',

          gc_logon     TYPE uinfo-zeit VALUE 'Time'.


CALL FUNCTION 'RFC_GET_LOCAL_DESTINATIONS'

 TABLES

   localdest = lt_rfchosts.


CALL FUNCTION 'THUSRINFO'

 TABLES

   usr_tabl              = lt_usr_liste

 EXCEPTIONS

   communication_failure = 17.


ASSERT sy-subrc = 0.


APPEND LINES OF lt_usr_liste TO lt_total.


LOOP AT lt_rfchosts ASSIGNING FIELD-SYMBOL().

 CLEAR: lt_usr_liste.

 CALL FUNCTION 'THUSRINFO' DESTINATION -rfcdest

   TABLES

     usr_tabl              = lt_usr_liste

   EXCEPTIONS

     communication_failure = 17.


 APPEND LINES OF lt_usr_liste TO lt_total.


ENDLOOP.


DELETE lt_total WHERE mandt <> sy-mandt.


SORT lt_total BY bname.


WRITE: / gc_user_name, gc_tcode, gc_term,  gc_logon.


LOOP AT lt_total ASSIGNING FIELD-SYMBOL().

 WRITE: / -bname UNDER gc_user_name COLOR COL_NEGATIVE,

    -tcode UNDER gc_tcode COLOR COL_POSITIVE,

    -term UNDER gc_term COLOR COL_KEY,

    -zeit UNDER gc_logon COLOR COL_TOTAL.

ENDLOOP.


image.png

image.png

相关文章
|
XML 应用服务中间件 数据格式
控制台报错: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting proper
控制台报错: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting proper
78 0
控制台报错: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting proper
|
Kubernetes 容器
k8s报错:Error from server (NotFound): the server could not find the requested resource (get services h
k8s报错:Error from server (NotFound): the server could not find the requested resource (get services h
如何得到当前application server的host name和port number
如何得到当前application server的host name和port number
148 0
如何得到当前application server的host name和port number
|
SQL Windows
Unable to determine if the owner (Domain\UserName) of job JOB_NAME has server access
早上巡检的的时候,发现一数据库的作业报如下错误(作业名等敏感信息已经替换),该作业的OWNER为一个域账号: JOB RUN: 'JOB_NAME' was run on 2016-6-1 at 7:00:00 DURATION: 0 hours, 0 minutes, 1 seconds STATUS: Failed MESSAGES: The job failed.
1401 0
|
SQL 安全 数据库
The server principal "sa" is not able to access the database "xxxx" under the current security context
在SQL Server服务器上一个作业执行时,遇到下面错误信息: Message: Executed as user: dbo. The server principal "sa" is not able to access the database "xxxx" under the current security context. [SQLSTATE 08004] (Error 916). The step failed.   作业本身执行的存储过程非常简单,就是将数据库A中的历史数据处理过后,归档到A_History库中,结果就遇到这么一个问题。
2860 0
|
SQL 存储 安全
SQL Agent Job 报&ldquo;Access to the remote server is denied because the current security context is not trusted&rdquo;
SQL Server 2005(Microsoft SQL Server 2005 - 9.00.5000.00)下的一个作业执行一个存储过程,存储过程中动态SQL语句使用链接服务器(Linked Servers),从另外一台SQL Server服务器获取数据。
1320 0
|
SQL 数据库 Windows
The Windows account sa does not exist and cannot be provisioned as a SQL Server system administrator
今天遇到一个案例,在使用命令修改一个测试服务器(SQL Server 2014标准版)的服务器排序规则时,遇到了下面错误信息 (具体账号信息脱敏处理,随机生成一个账号密码) The Windows account sa does not exist and cannot be provisione...
1686 0