Chinaunix首页 | 论坛 | 博客
  • 博客访问: 684446
  • 博文数量: 194
  • 博客积分: 7067
  • 博客等级: 少将
  • 技术积分: 2008
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-09 14:48
个人简介

我很好

文章分类

全部博文(194)

文章存档

2019年(1)

2018年(1)

2017年(3)

2015年(2)

2012年(2)

2011年(1)

2010年(27)

2009年(15)

2008年(142)

分类: WINDOWS

2008-05-29 15:54:37

*********************************************************************
* This program displays the menu path for a transaction. If the user
* doubleclicks on the transaction name, 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.
*********************************************************************
REPORT zmenpath NO STANDARD PAGE HEADING.
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.
阅读(1167) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~