zoukankan      html  css  js  c++  java
  • [转]Displays the menu path for a transaction

    *********************************************************************
    * 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.

  • 相关阅读:
    ABAP Help Document(2):1.2 表达式
    ABAP Help Document(1):1.1关键字
    api——》将.doc文件转成.docx文件后缀,且仅需要输入单个文件绝对路径
    python 更改默认输出 解决编码常出错问题
    爬取法律法规代码(可直接使用)
    python datetime 模块详解
    python 获得日期列表中最大日期(能够剔出不是日期类型)
    博客园页面css
    日期大小比较令解决{strftime('%Y年%m月%d日')}出错问题
    CodeForces
  • 原文地址:https://www.cnblogs.com/wequst/p/1513867.html
Copyright © 2011-2022 走看看