批量查询事务码与程序之间的映射关系,并可直接运行事务或修改程序

*selectin text:
*P_SPRSL 语言代码
*S_TCODE 事务代码
*text sumbols
*006 No
*H01 Transaction Code
*H02 Program Name
*H03 Description

report ztcode1  line-size 121  line-count 65(3)
       message-id zv NO STANDARD PAGE HEADING .

include <icon>.
Tables:  tstc,                           "Transaction table program
          tstct.                          "Transaction table description
constants:  c_a(1)          type c value 'A'.        "State for DDIF

data:  begin of v_tstc_itab occurs 0,
           tcode   like tstc-tcode,             "transaction code
           pgmna   like tstc-pgmna,             "Program name
       end of v_tstc_itab.

data: begin of v_tstct_itab occurs 0,
          tcode   like tstct-tcode,            "transaction code
          ttext   like tstct-ttext,            "description
      end of v_tstct_itab.

data: v_pgmna       like tstc-pgmna,           "Program name
      v_ttext       like tstct-ttext,          "Description work area
      v_tcode       like tstc-tcode,           "Table name
      v_tcode1(1)        type c value  ' ',    "1st byte of transaction
      v_record_count(10) type n.               "line_count

selection-screen begin of block table_record with
      frame title text-001.
   select-options: s_tcode  for  tstc-tcode.  "transaction name
   parameter :     p_sprsl like tstct-sprsl.           "language
selection-screen end of block table_record.
************************************************************************
* START OF M A I N   L O G I C                                         *
************************************************************************
*perForm  CHECK_AUTHORITY.

initialization.
  perform a_ini_010_initialization.       "Initialization routine

at selection-screen.
  perform b_ass_010_at_selection_screen.  "Screen

start-of-selection.
  perform c_sos_010_retrieve_tstc.        "Retrieve structure

end-of-selection.
  perform d_eos_010_process_trans_table.  "Print structure

at line-selection.
  perform e_als_get_transaction.

top-of-page.
  perform z_top_010_top_of_page.          "Top-of-page
*----------------------------------------------------------------------*
*   END OF M A I N   L O G I C                                         *
*----------------------------------------------------------------------*
************************************************************************
*        Form  CHECK_AUTHORITY
************************************************************************
Form  CHECK_AUTHORITY.
   AUTHORITY-CHECK OBJECT 'G_800_GRP '
                 ID 'Activity' FIELD '*'.
     IF SY-SUBRC <> 0.
        MESSAGE E019.
     ENDIF.
ENDFORM.
************************************************************************
* Form  a_ini_010_initialization                                       *
************************************************************************
form a_ini_010_initialization.
  p_sprsl = sy-langu.                     "Initialize language
endform.                                  "a_ini_010_initialization.
************************************************************************
* Form  b_ass_010_at_selection_screen                                  *
************************************************************************
form b_ass_010_at_selection_screen.
  if s_tcode is initial.                  "If blank
     message e093 with text-002.          "enter a value for
  endif.
endform.                                  "b_ass_010_at_selection_screen
************************************************************************
* Form  c_sos_010_retrieve_tstc                                        *
*  This subroutine will retrieve the table structure and returned it in*
*  the internal table v_tstc_itab and v_tstct_itab                     *
************************************************************************
form c_sos_010_retrieve_tstc.
 select tcode pgmna from tstc             "retrieve trans program name
    into  table v_tstc_itab
    where tcode in s_tcode.
 select tcode ttext from tstct            "retrieve trans description
    into  table v_tstct_itab
    where tcode in s_tcode and
          sprsl =  p_sprsl.               "Default language
 sort v_tstct_itab by tcode.              "Sort by transaction code
endform.                                  "c_sos_010_retrieve_tstc
************************************************************************
* Form  d_eos_010_process_trans_table                                  *
************************************************************************
form d_eos_010_process_trans_table.
data:  i  like sy-tabix,
       i2 like sy-tabix.
i = 1.
* step 1 - find if there is an input
 describe table v_tstc_itab lines v_record_count. "Record count
 if v_record_count = 0.                           "no input
    v_tstc_itab-pgmna  = text-003.                "trans name
    write v_tstc_itab-pgmna  under text-h01.      "structure not defined
    exit.                                         "None to print
 endif.
* step 2 - Get description and print the table
 v_record_count = 0.

 loop at v_tstc_itab.                             "TSTC
  loop at v_tstct_itab from i.                    "TSTCT
   if v_tstc_itab-tcode < v_tstct_itab-tcode.     "Master low
      v_tcode           = v_tstc_itab-tcode.
      v_pgmna           = v_tstc_itab-pgmna.
      v_ttext           = ' '.
      i = sy-tabix.
      perform d_eos_020_print_trans_table.
      exit.                                       "Get another TSTC
   endif.
   if v_tstc_itab-tcode > v_tstct_itab-tcode.     "Transaction low
      v_tcode           = v_tstct_itab-tcode.
      v_pgmna           = ' '.
      v_ttext           = v_tstct_itab-ttext.
      i = sy-tabix + 1.
      perform d_eos_020_print_trans_table.
      continue.                                   "Get another TSTCT
   endif.
   if v_tstc_itab-tcode = v_tstct_itab-tcode.     "Found
      v_tcode           = v_tstc_itab-tcode.
      v_pgmna           = v_tstc_itab-pgmna.
      v_ttext           = v_tstct_itab-ttext.
      i = sy-tabix + 1.
      perform d_eos_020_print_trans_table.
      exit.                                       "Get another TSTC
   endif.
  endloop.                                        "From TSTCT
endloop.                                          "From TSTC
endform.                                  "d_eos_010_process_trans_table
************************************************************************
* Form  d_eos_020_print_trans_table                                    *
************************************************************************
form d_eos_020_print_trans_table.
   v_record_count = v_record_count + 1.
   write: / v_record_count no-zero,
            v_tcode               under text-h01,  "trans code
            v_pgmna               under text-h02,  "Program name
            v_ttext               under text-h03.  "Description
   hide v_tcode.
   hide v_pgmna.
endform.                                  "e_eos_020_print_trans_table
************************************************************************
* Form  e_als_get_transaction                                          *
************************************************************************
form e_als_get_transaction.
data v_cursorfield(50).
get cursor field v_cursorfield.
 case v_cursorfield.
   when 'V_PGMNA'.
        set PARAMETER ID 'RID' field sy-lisel+32(30).
        call transaction 'SE38' AND SKIP FIRST SCREEN.
   when 'V_TCODE'.
        set PARAMETER ID 'RID' field sy-lisel+12(20).
        call transaction v_tcode.
 endcase.
endform.                                  "e_als_get_transaction
************************************************************************
* Form  z_top_010_top_of_page                                          *
************************************************************************
form z_top_010_top_of_page.               "top-of-page
*  skip 1.
*  WRITE  3 ICON_GIS_PAN AS ICON .
*  write: 6 text-004.
*  WRITE /3 ICON_DEFECT AS ICON .
*  WRITE  6 text-005 .
*  skip 2.
  write:  /003 text-006,                  "No
           013 text-h01,                  "Trans name
           035 text-h02,                  "Program Name
           066 text-h03.                  "Description
  uline.
endform.                                  "z_top_010_top_of_page. 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值