如何檢視某個使用者指定時間段的ABAP開發記錄

i042416發表於2018-05-10

輸入使用者名稱和想查詢的時間段:

如何檢視某個使用者指定時間段的ABAP開發記錄

執行得到結果。雙擊可檢視具體程式碼:

如何檢視某個使用者指定時間段的ABAP開發記錄

工具原始碼:

 REPORT tool_dev_history.

PARAMETERS: name TYPE usr02-bname OBLIGATORY,

            fro  TYPE sy-datum OBLIGATORY DEFAULT sy-datum,

            to_  TYPE sy-datum OBLIGATORY DEFAULT sy-datum.

CONSTANTS: c_name TYPE trdir-name VALUE 'Name',

           c_date TYPE trdir-udat VALUE 'Date'.

AT SELECTION-SCREEN. IF fro > to_.

    WRITE: / 'Invalid date period.' COLOR COL_NEGATIVE. RETURN. ENDIF.

START-OF-SELECTION.

  DATA: lt_record TYPE STANDARD TABLE OF trdir.

  SELECT name udat INTO CORRESPONDING FIELDS OF TABLE lt_record FROM trdir

     WHERE unam = name AND udat BETWEEN fro AND to_. IF sy-subrc <> 0. WRITE: / 'No record found at given date period.' COLOR COL_NEGATIVE. RETURN. ENDIF.

  SORT lt_record BY udat DESCENDING.

  WRITE: 10 c_name, 80 c_date.

  LOOP AT lt_record INTO DATA(ls_data).

    WRITE: / ls_data-name UNDER c_name COLOR COL_POSITIVE, ls_data-udat UNDER c_date COLOR COL_TOTAL.

    HIDE ls_data-name.

  ENDLOOP.

AT LINE-SELECTION.

  DATA: bdcdata_tab  TYPE TABLE OF bdcdata,

        opt          TYPE ctu_params,

        bdcdata_line TYPE bdcdata.

  bdcdata_line-program = 'SAPLWBABAP'.

  bdcdata_line-dynpro = '0100'.

  bdcdata_line-dynbegin = 'X'.

  APPEND bdcdata_line TO bdcdata_tab.

  CLEAR: bdcdata_line.

  bdcdata_line-fnam = 'BDC_CURSOR'.

  bdcdata_line-fval = 'RS38M-PROGRAMM'.

  APPEND bdcdata_line TO bdcdata_tab.

  CLEAR: bdcdata_line.

  bdcdata_line-fnam = 'BDC_OKCODE'.

  bdcdata_line-fval = '=SHOP'.

  APPEND bdcdata_line TO bdcdata_tab.

  CLEAR: bdcdata_line.

  bdcdata_line-fnam = 'RS38M-PROGRAMM'.

  bdcdata_line-fval = ls_data-name.

  APPEND bdcdata_line TO bdcdata_tab.

  opt-dismode = 'E'.

  opt-defsize = 'X'.

  CALL TRANSACTION 'SE38' USING bdcdata_tab  OPTIONS FROM opt.

  CLEAR: bdcdata_tab. 

要獲取更多Jerry的原創技術文章,請關注公眾號"汪子熙"或者掃描下面二維碼:

如何檢視某個使用者指定時間段的ABAP開發記錄
如何檢視某個使用者指定時間段的ABAP開發記錄

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2154281/,如需轉載,請註明出處,否則將追究法律責任。

相關文章