Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7203341
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

2010-07-13 14:17:56

REPORT  z_barry_check_fm.

TYPE-POOLS: slis.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: sla TYPE slis_layout_alv ,
      i_repid LIKE sy-repid ,
      i_excluding TYPE slis_t_extab.
DATA: f1(40),f2(40),f3(40) .
DATA: BEGIN OF it_tfdir OCCURS 0,
        name LIKE progdir-name ,
        fgname LIKE efrm-func_pool ,
        funcname LIKE tfdir-funcname ,
        incname LIKE progdir-name ,
        include  LIKE tfdir-include,
        obsolete LIKE rodir-obsolete,
        funam LIKE progdir-unam ,
        fudat LIKE progdir-udat,
        stext    LIKE tftit-stext ,
      END OF it_tfdir.
 
SELECT-OPTIONS: s_fm FOR it_tfdir-funcname  .
 
START-OF-SELECTION.
  PERFORM getdata.
  PERFORM outdata.
 
*&---------------------------------------------------------------------*
*&      Form  getdata
*&---------------------------------------------------------------------*
FORM getdata.
  SELECT tfdir~funcname
         tfdir~pname
         tfdir~include
         tftit~stext
         progdir~name
         rodir~obsolete
    INTO CORRESPONDING FIELDS OF TABLE it_tfdir
    FROM tfdir
      INNER JOIN progdir ON tfdir~pname = progdir~name AND
                            progdir~state = 'A'
      LEFT JOIN tftit ON tfdir~funcname = tftit~funcname AND
                                    tftit~spras = sy-langu
      LEFT JOIN rodir ON tfdir~funcname = rodir~object AND
                         rodir~objecttype = 'FUNC'
    WHERE tfdir~funcname IN s_fm.
 
  LOOP AT it_tfdir.
    IF it_tfdir-name(1) = '/'.
      SPLIT it_tfdir-name AT '/' INTO f1 f2 f3  .
      CONCATENATE '/' f2 '/' 'L' f3+4(36) 'U' it_tfdir-include
          INTO it_tfdir-incname.
      CONCATENATE '/' f2 '/' f3+4(36) INTO it_tfdir-fgname.
    ELSE.
      CONCATENATE 'L' it_tfdir-name+4(36) 'U' it_tfdir-include
          INTO it_tfdir-incname.
      it_tfdir-fgname = it_tfdir-name+4(36).
    ENDIF.
    SELECT SINGLE unam udat INTO (it_tfdir-funam,it_tfdir-fudat)
      FROM progdir
      WHERE name = it_tfdir-incname .
    MODIFY it_tfdir  .
  ENDLOOP.
ENDFORM.                    "getdata
 
*&---------------------------------------------------------------------*
*&      Form  outdata
*&---------------------------------------------------------------------*
FORM outdata.
  sla-colwidth_optimize = 'X'.
  sla-zebra             = 'X'.
  i_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = i_repid
      i_internal_tabname     = 'IT_TFDIR'
      i_inclname             = i_repid
    CHANGING
      ct_fieldcat            = it_fieldcat[]
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
 
  LOOP AT it_fieldcat.
    CASE it_fieldcat-fieldname .
      WHEN 'INCLUDE'.
        it_fieldcat-no_out = 'X'.
      WHEN 'FUNCNAME' OR 'INCNAME'.
        it_fieldcat-key = ''.
      WHEN 'OBSOLETE'.
        it_fieldcat-seltext_l  = 'Obsoleted'.
    ENDCASE.
    MODIFY it_fieldcat.
  ENDLOOP.
 
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program      = i_repid
      it_fieldcat             = it_fieldcat[]
      i_save                  = 'A'
      is_layout               = sla
      i_callback_user_command = 'USER_COMMAND'
      it_excluding            = i_excluding
    TABLES
      t_outtab                = it_tfdir
    EXCEPTIONS
      program_error           = 1
      OTHERS                  = 2.
ENDFORM.                    " outdata
 
*&---------------------------------------------------------------------*
*&      Form  user_command
*&---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
                    rs_selfield TYPE slis_selfield.
  READ TABLE it_tfdir INDEX rs_selfield-tabindex.
  CASE r_ucomm.
    WHEN '&IC1'.
      CASE rs_selfield-fieldname .
        WHEN 'FGNAME'.
          CALL FUNCTION 'RS_FUNCTION_POOL_CHANGE'
            EXPORTING
              aktion        = 'SHOW'
              function_pool = it_tfdir-fgname
            EXCEPTIONS
              OTHERS        = 9.
        WHEN 'INCNAME' OR 'NAME'.
          CALL FUNCTION 'EDITOR_PROGRAM'
            EXPORTING
              display = 'X'
              program = rs_selfield-value
            EXCEPTIONS
              OTHERS  = 1.
        WHEN 'FUNCNAME' .
          CALL FUNCTION 'EDITOR_PROGRAM'
            EXPORTING
              display = 'X'
              program = it_tfdir-incname
            EXCEPTIONS
              OTHERS  = 1.
      ENDCASE.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
  ENDCASE.
ENDFORM.                    "user_command
阅读(3995) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-07-20 15:51:44

很方便很好用~