REPORT ZRPT_BC_TCODE_MENU.
TABLES: TSTC, TSTCT.
SELECTION-SCREEN BEGIN OF BLOCK 001 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS S_TCODE FOR TSTC-TCODE. "事务代码
SELECT-OPTIONS S_TTEXT FOR TSTCT-TTEXT. "事务文本
SELECT-OPTIONS S_PGMNA FOR TSTC-PGMNA. "程序名称
SELECT-OPTIONS S_SPRSL FOR TSTCT-SPRSL DEFAULT '1'. "语言代码
SELECTION-SCREEN END OF BLOCK 001.
TYPES:
BEGIN OF TYP_DATA,
TTEXT TYPE TSTCT-TTEXT, "事务文本
PGMNA TYPE TSTC-PGMNA, "程序名称
TCODE TYPE TSTC-TCODE, "事务代码
SPRSL TYPE TSTCT-SPRSL, "语言代码
END OF TYP_DATA.
DATA:STDATUM LIKE SY-DATUM,
STUZEIT LIKE SY-UZEIT.
DATA:
GT_DATA TYPE TABLE OF TYP_DATA,
GS_DATA TYPE TYP_DATA,
GT_FIELDCAT TYPE LVC_T_FCAT,
GS_FIELDCAT TYPE LVC_S_FCAT,
GS_LAYOUT TYPE LVC_S_LAYO.
INITIALIZATION.
%_S_TTEXT_%_APP_%-TEXT = '事务文本'.
%_S_PGMNA_%_APP_%-TEXT = '程序名称'.
%_S_TCODE_%_APP_%-TEXT = '事务代码'.
%_S_SPRSL_%_APP_%-TEXT = '语言代码'.
START-OF-SELECTION.
STDATUM = SY-DATUM.
STUZEIT = SY-UZEIT.
PERFORM GET_DATA.
PERFORM PROCESS_DATA.
PERform WRITERPTRUNRECORD.
PERFORM DISPLAY_DATA.
*&---------------------------------------------------------------------*
*& Form WRITERPTRUNRECORD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM WRITERPTRUNRECORD.
get time.
CALL FUNCTION 'ZSYS_RPT_RUNRECORD'
EXPORTING
TCODE = SY-TCODE
PROGRAMM = SY-CPROG
"bukrs = bukrs
"werks = werks
DATUMRST = STDATUM
UZEITRST = STUZEIT
BATCH = SY-BATCH
DATUMREND = SY-datum
UZEITREND = sy-UZEIT
DATUMC = '20200514'
RUNNER = SY-UNAME
RPTSRC = '高兴辉'.
ENDFORM. "WRITERPTRUNRECORD
*&---------------------------------------------------------------------*
*& FORM GET_DATA
*&---------------------------------------------------------------------*
* 获取数据
*----------------------------------------------------------------------*
FORM GET_DATA.
SELECT
TSTCT~TTEXT "事务文本
TSTC~PGMNA "程序名称
TSTC~TCODE "事务代码
TSTCT~SPRSL "语言代码
INTO TABLE GT_DATA
FROM TSTCT
INNER JOIN TSTC ON TSTC~TCODE = TSTCT~TCODE
WHERE TSTCT~TTEXT IN S_TTEXT
AND TSTC~PGMNA IN S_PGMNA
AND TSTC~TCODE IN S_TCODE
AND TSTCT~SPRSL IN S_SPRSL.
ENDFORM. "GET_DATA
*&---------------------------------------------------------------------*
*& FORM PROCESS_DATA
*&---------------------------------------------------------------------*
* 处理数据
*----------------------------------------------------------------------*
FORM PROCESS_DATA.
ENDFORM. "PROCESS_DATA
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCAT
*&---------------------------------------------------------------------*
* TEXT
*----------------------------------------------------------------------*
FORM BUILD_FIELDCAT USING P_FIELDNAME TYPE FIELDNAME
P_QFIELDNAME TYPE LVC_QFNAME
P_CFIELDNAME TYPE LVC_CFNAME
P_REF_TABLE TYPE LVC_RTNAME
P_REF_FIELD TYPE LVC_RFNAME
P_CONVEXIT TYPE CONVEXIT
P_EMPHASIZE TYPE LVC_EMPHSZ
P_SCRTEXT_L TYPE SCRTEXT_L.
GS_FIELDCAT-FIELDNAME = P_FIELDNAME.
GS_FIELDCAT-QFIELDNAME = P_QFIELDNAME.
GS_FIELDCAT-CFIELDNAME = P_CFIELDNAME.
GS_FIELDCAT-REF_TABLE = P_REF_TABLE.
GS_FIELDCAT-REF_FIELD = P_REF_FIELD.
GS_FIELDCAT-CONVEXIT = P_CONVEXIT.
GS_FIELDCAT-EMPHASIZE = P_EMPHASIZE.
GS_FIELDCAT-SCRTEXT_L = P_SCRTEXT_L.
GS_FIELDCAT-COLDDICTXT = 'L'.
APPEND GS_FIELDCAT TO GT_FIELDCAT.
CLEAR: GS_FIELDCAT.
ENDFORM. "BUILD_FIELDCAT
*&---------------------------------------------------------------------*
*& FORM DISPLAY_DATA
*&---------------------------------------------------------------------*
* 显示数据
*----------------------------------------------------------------------*
FORM DISPLAY_DATA.
PERFORM BUILD_FIELDCAT USING 'PGMNA' '' '' 'TSTC' 'PGMNA' '' '' '程序名称'.
PERFORM BUILD_FIELDCAT USING 'TCODE' '' '' 'TSTC' 'TCODE' '' '' '事务代码'.
PERFORM BUILD_FIELDCAT USING 'TTEXT' '' '' 'TSTCT' 'TTEXT' '' '' '事务文本'.
gs_layout-cwidth_opt = 'X'.
gs_layout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
" I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_ALV'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND_ALV'
IT_FIELDCAT_LVC = GT_FIELDCAT
IS_LAYOUT_LVC = GS_LAYOUT
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = GT_DATA
EXCEPTIONS
OTHERS = 1.
ENDFORM. "DISPLAY_DATA
**&---------------------------------------------------------------------*
**& FORM PF_STATUS_ALV
**&---------------------------------------------------------------------*
** TEXT
**----------------------------------------------------------------------*
*FORM PF_STATUS_ALV USING RT_EXTAB TYPE SLIS_T_EXTAB .
* SET PF-STATUS 'STATUS_ALV' EXCLUDING RT_EXTAB.
*ENDFORM. "PF_STATUS_ALV
*&---------------------------------------------------------------------*
*& FORM USER_COMMAND_ALV
*&---------------------------------------------------------------------*
* TEXT
*----------------------------------------------------------------------*
FORM USER_COMMAND_ALV USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
FIELD-SYMBOLS:<fs_list> TYPE TYP_DATA.
READ TABLE GT_DATA INDEX rs_selfield-tabindex ASSIGNING <fs_list>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
CASE R_UCOMM.
WHEN '&IC1'.
CASE RS_SELFIELD-FIELDNAME.
WHEN 'PGMNA'.
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 = <fs_list>-PGMNA.
APPEND bdcdata_line TO bdcdata_tab.
opt-dismode = 'E'.
opt-defsize = 'X'.
CALL TRANSACTION 'SE38' USING bdcdata_tab OPTIONS FROM opt.
WHEN 'TCODE'.
CALL TRANSACTION <fs_list>-TCODE." AND SKIP FIRST SCREEN.
ENDCASE.
ENDCASE.
ENDFORM. "USER_COMMAND_ALV
事务代码查找程序 ztcdlst
最新推荐文章于 2024-07-09 17:07:30 发布