当前位置:网站首页>An ABAP tool that can print the browsing history of a user in the system for BSP applications

An ABAP tool that can print the browsing history of a user in the system for BSP applications

2022-08-10 15:33:00 Wang Zixi

As long as one user is there SAP ABAP browsed in the system BSP 页面,Browsing history will be left behind.

The tool parses out these records,Print out the historical events browsed by the user,and the name of the page viewed.

使用方法很简单,Simply enter the username to be queried:

在这里插入图片描述

下图显示,我在 2018年8月10日之后,no longer there AG3 system browsed BSP 应用了:
在这里插入图片描述

工具源代码:

REPORT ztool_display_page_name.

PARAMETERS: name TYPE trdir-unam OBLIGATORY DEFAULT 'WANGJER'.

DATA: lt_trdir TYPE STANDARD TABLE OF trdir,
      lt_page  TYPE STANDARD TABLE OF o2pagdir.

TYPES: BEGIN OF ty_impl,
         name TYPE o2pagdir-implclass,
       END OF ty_impl.

TYPES: tt_impl TYPE STANDARD TABLE OF ty_impl.

START-OF-SELECTION.

  SELECT * INTO TABLE lt_trdir FROM trdir WHERE unam = name.
  IF sy-subrc <> 0 .
    WRITE: / 'No browse history found for current user'.
    RETURN.
  ENDIF.

  DATA: lt_impl  TYPE tt_impl,
        ls_trdir TYPE trdir,
        ls_impl  TYPE ty_impl.

  LOOP AT lt_trdir INTO ls_trdir.
    ls_impl-name = ls_trdir-name.
    APPEND ls_impl TO lt_impl.
  ENDLOOP.

  SELECT * INTO TABLE lt_page FROM o2pagdir FOR ALL ENTRIES IN lt_impl
    WHERE changedby = name AND implclass = lt_impl-name.

  SORT lt_page BY changedon DESCENDING.
  LOOP AT lt_page ASSIGNING FIELD-SYMBOL(<page>).
    WRITE: / <page>-implclass COLOR COL_GROUP, ' Last accessed on:', <page>-changedon COLOR COL_KEY,
    ' Component name: ' , <page>-applname+0(20) COLOR COL_NEGATIVE, ' view name: ', <page>-pagename+0(30) COLOR COL_POSITIVE.
  ENDLOOP.
原网站

版权声明
本文为[Wang Zixi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208101459029219.html