没有标准方法能通过Tcode找到基于这个TCode的LSMW,但是可以通过一段小程序来实现。
代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
REPORT z_find_lsmw.
TYPE-POOLS: slis.
*----------------------------------------------------------------------*
* Constants
*----------------------------------------------------------------------*
CONSTANTS: con_user_comm TYPE slis_formname VALUE 'USER_COMMAND',
con_ucomm TYPE sy-ucomm VALUE '&IC1'.
*----------------------------------------------------------------------*
* Data Declaration
*----------------------------------------------------------------------*
DATA: g_repid TYPE sy-repid.
DATA: gt_tcode TYPE TABLE OF /sapdmc/lsgbdca.
DATA: gt_object TYPE TABLE OF /sapdmc/lsorec,
wa_object TYPE /sapdmc/lsorec.
DATA: g_title TYPE lvc_title,
g_layout TYPE slis_layout_alv.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
*----------------------------------------------------------------------*
* SELECTION SCREEN
*----------------------------------------------------------------------*
PARAMETERS: p_tcode TYPE /sapdmc/lsgbdca-recordingtcode
OBLIGATORY.
*----------------------------------------------------------------------*
* START-OF-SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
g_repid = sy-repid.
*Check if the tcode is used in any recording
SELECT * FROM /sapdmc/lsgbdca
INTO TABLE gt_tcode
WHERE recordingtcode = p_tcode.
IF sy-subrc = 0.
*Check if the recordings found are assigned to any objects
SELECT * FROM /sapdmc/lsorec
INTO TABLE gt_object
FOR ALL ENTRIES IN gt_tcode
WHERE recording = gt_tcode-recording.
ENDIF.
IF NOT gt_object IS INITIAL.
PERFORM display_data.
ENDIF.
*&---------------------------------------------------------------------*
*& Form display_data
*&---------------------------------------------------------------------*
FORM display_data.
*Customize ALV Layout
g_layout-colwidth_optimize = 'X'.
g_layout-zebra = 'X'.
*Set Layout title
g_title = 'LSMW Details'(000).
*Build Field Catalog
PERFORM build_fld_catalog USING:
'PROJECT' 'GT_OBJECT' 'Project'(001),
'SUBPROJ' 'GT_OBJECT' 'Sub Project'(002),
'OBJECT' 'GT_OBJECT' 'Object'(003),
'RECORDING' 'GT_OBJECT' 'recording'(004).
*Display table values in ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_user_command = con_user_comm
i_grid_title = g_title
is_layout = g_layout
it_fieldcat = it_fieldcat
TABLES
t_outtab = gt_object
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " display_data
*&---------------------------------------------------------------------*
*& Form build_fld_catalog
*&---------------------------------------------------------------------*
FORM build_fld_catalog USING VALUE(p_fieldname)
VALUE(p_tabname)
VALUE(p_description).
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-tabname = p_tabname.
wa_fieldcat-seltext_m = p_description.
APPEND wa_fieldcat TO it_fieldcat.
ENDFORM. " build_fld_catalog
*&---------------------------------------------------------------------*
* Form User Command
*&---------------------------------------------------------------------*
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
IF r_ucomm EQ con_ucomm.
READ TABLE gt_object INTO wa_object INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
* Start LSMW
CALL FUNCTION '/SAPDMC/LSM_OBJ_STARTER'
EXPORTING
project = wa_object-project
subproj = wa_object-subproj
object = wa_object-object
EXCEPTIONS
no_such_object = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "User_command
|
输入TCode,运行。
结果,
双击一行,可以跳转到对应的LSMW 项目,
以上。