Chinaunix首页 | 论坛 | 博客
  • 博客访问: 641393
  • 博文数量: 68
  • 博客积分: 2527
  • 博客等级: 少校
  • 技术积分: 1028
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-07 08:59
文章分类

全部博文(68)

文章存档

2014年(1)

2013年(6)

2012年(18)

2011年(15)

2010年(7)

2009年(21)

我的朋友

分类:

2009-09-07 15:58:12

SAP出口/增加的查找程序源码
 
 
对于做ABAP开发技术人员来说,有时需要做一些程序增强,而SAP在有的模块接口处预留了一些出口——EXIT。因此只有准确地找到了这些出口,才能很好地完成所需增强!
 
下面是找出口的程序源码,用时只需要把它复制到SE38中:
 
report z_find_userexit no standard page heading.
tables : tstc,     "SAP Transaction Codes
         tadir,    "Directory of Repository Objects
         modsapt,  "SAP Enhancements - Short Texts
         modact,   "Modifications
         trdir,    "System table TRDIR
         tfdir,    "Function Module
         enlfdir,  "Additional Attributes for Function Modules
         tstct.    "Transaction Code Texts
*&---------------------------------------------------------------------*
*& Variables
*&---------------------------------------------------------------------*
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
*&---------------------------------------------------------------------*
*& Selection Screen Parameters
*&---------------------------------------------------------------------*
selection-screen begin of block a01 with frame title text-001.
selection-screen skip.
parameters : p_tcode like tstc-tcode obligatory.
selection-screen skip.
selection-screen end of block a01.
*&---------------------------------------------------------------------*
*& Start of main program
*&---------------------------------------------------------------------*
start-of-selection.
* Validate Transaction Code
  select single * from tstc
    where tcode eq p_tcode.
* Find Repository Objects for transaction code
  if sy-subrc eq 0.
    select single * from tadir
       where pgmid    = 'R3TR'
         and object   = 'PROG'
         and obj_name = tstc-pgmna.
    move : tadir-devclass to v_devclass.
    if sy-subrc ne 0.
      select single * from trdir
         where name = tstc-pgmna.
      if trdir-subc eq 'F'.
        select single * from tfdir
          where pname = tstc-pgmna.
        select single * from enlfdir
          where funcname = tfdir-funcname.
        select single * from tadir
          where pgmid    = 'R3TR'
            and object   = 'FUGR'
            and obj_name = enlfdir-area.
        move : tadir-devclass to v_devclass.
      endif.
    endif.
* Find SAP Modifactions
    select * from tadir
      into table jtab
      where pgmid    = 'R3TR'
        and object   = 'SMOD'
        and devclass = v_devclass.
    select single * from tstct
      where sprsl eq sy-langu
        and tcode eq p_tcode.
    format color col_positive intensified off.
    write:/(19) 'Transaction Code - ',
    20(20) p_tcode,
    45(50) tstct-ttext.
    skip.
    if not jtab[] is initial.
      write:/(95) sy-uline.
      format color col_heading intensified on.
      write:/1 sy-vline,
      2 'Exit Name',
      21 sy-vline ,
      22 'Description',
      95 sy-vline.
      write:/(95) sy-uline.
      loop at jtab.
        select single * from modsapt
        where sprsl = sy-langu and
        name = jtab-obj_name.
        format color col_normal intensified off.
        write:/1 sy-vline,
        2 jtab-obj_name hotspot on,
        21 sy-vline ,
        22 modsapt-modtext,
        95 sy-vline.
      endloop.
      write:/(95) sy-uline.
      describe table jtab.
      skip.
      format color col_total intensified on.
      write:/ 'No of Exits:' , sy-tfill.
    else.
      format color col_negative intensified on.
      write:/(95) 'No User Exit exists'.
    endif.
  else.
    format color col_negative intensified on.
    write:/(95) 'Transaction Code Does Not Exist'.
  endif.
* Take the user to SMOD for the Exit that was selected.
at line-selection.
  get cursor field field1.
  check field1(4) eq 'JTAB'.
  set parameter id 'MON' field sy-lisel+1(10).
  call transaction 'SMOD' and skip first screen.
 
 
* 完毕!
阅读(2792) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~