Chinaunix首页 | 论坛 | 博客
  • 博客访问: 72656
  • 博文数量: 56
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 585
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-11 10:09
个人简介

混混日子

文章分类

全部博文(56)

文章存档

2011年(1)

2008年(9)

2007年(3)

2006年(43)

我的朋友

分类:

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.

阅读(171) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~