混混日子
分类:
2008-01-21 11:23:51
report zmenupath .
************************************************************************
* This program displays the menu path for a transaction. If the user
* clicks on the transaction line, it displays the transaction's start
* screen. It is useful when working with the profile generator, because
* it is much faster than extracting a menu branch and finding a
* transaction code in it. To run this program, the user menu has to be
* generated.
************************************************************************
*This Program is to search for SAP supplied Transactions
************************************************************************
include
tables: smensapnew, smensapt, tstc.
data: begin of itab occurs 10.
include structure smensapnew.
data: end of itab.
data: begin of stack occurs 10,
id(5) type n,
end of stack.
data: i type i.
data: text like tstct-tcode.
parameters: trans like tstc-tcode.
parameter : p_file(59) type c,
p_file1(60) type c.
* Get the ID of the Transaction
select * from smensapnew where report = trans and customized = 'S'.
move-corresponding smensapnew to itab.
append itab.
endselect.
* If transaction is not in SMENSAPNEW
if sy-subrc <> 0.
* WRITE AT /TRANS COLOR 5.
write: /(80) 'Main Menu' color 2.
skip.
write: /'Not in the profile generator''s table'.
exit.
endif.
* Get the parent ID that links 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 Grandparents...
do.
clear itab.
refresh itab.
select * from smensapnew where object_id = stack-id and
customized = 'S'.
move-corresponding smensapnew 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.
select single ttext into text from tstct where tcode = trans
and sprsl = 'EN'.
* Display the result
format hotspot on.
write: /(80) icon_display_more as icon,text color 3.
hide trans.
clear trans.
write: icon_gis_pan as icon,
'<<<< Click on line to go to the transaction'.
format hotspot off.
skip.
write: /(80) 'Main Menu' color 2.
sort stack.
loop at stack.
i = i + 3.
select single * from smensapt where spras = 'E'
and object_id = stack-id.
write: at /i icon_incoming_object as icon,
(80) smensapt-text color 2.
endloop.
skip 10.
format color 4.
write: /80 text-001 right-justified.
* Display the transaction when the user clicks on trans.
at line-selection.
if not trans is initial.
select single * from tstc where tcode = trans.
call transaction trans.
endif.
clear trans.