原文地址:http://www.erp100.com/93236/viewspace-6764345.html
1.查找SPRO中各个节点的T-CODE
我们发现各个维护点,在SPRO中都埋得比较深。如果能有快速的访问方式就好了。其实是有的,下面就三种显示举三例子:
2.根据用户输入的菜单中的TCODE,查找事务在菜单中的路径位置的程序:
tables: smencusnew, smencust, tstc.
data: begin of itab occurs 10.
include structure smencusnew.
data: end of itab.
data: begin of stack occurs 10,
id(5) type n,
end of stack.
data: i type i.
parameters: trans like tstc-tcode.
* Get the id of our transaction
select * from smencusnew where report = trans and customized = 'S'.
move-corresponding smencusnew to itab.
append itab.
endselect.
* Our transaction is not in smencusnew
if sy-subrc <> 0.
write: / trans color 5.
skip.
write: / 'Not in the profile generator''s table'.
exit.
endif.
* Get the parent id that links us to the root with the fewest levels
sort itab by menu_level.
read table itab index 1.
stack = itab-object_id. append stack.
stack = itab-parent_id. append stack.
* Search for the grandparets ...
do.
clear itab. refresh itab.
select * from smencusnew where object_id = stack-id and
customized = 'S'.
move-corresponding smencusnew to itab.
append itab.
endselect.
sort itab by menu_level.
read table itab index 1.
if itab-parent_id = '00001'. exit. endif.
stack = itab-parent_id. append stack.
enddo.
* Display the result
write: / trans color 5.hide trans. clear trans.
write: ' <<<< Doubleclick to see the transaction'.
skip.
write: /(30) 'Main Menu' color 2.
sort stack.
loop at stack.
i = i + 3.
select single * from smencust where spras = 'E' and object_id =
stack.
write: /i(30) smencust-text color 2.
endloop.
* Display the transaction when the user doubleclick on trans
at line-selection.
if not trans is initial.
select single * from tstc where tcode = trans.
call transaction trans.
endif.
clear trans.