You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在SAP中通过T-Code或程序名查找函数组名称与屏幕编号

Hey there! Let me walk you through practical, actionable ways to extract the function module group name and screen number tied to a SAP T-Code, using both direct database queries and SAP's built-in tools:

1. Direct Database Query Method

SAP stores all T-Code and related object data in transparent tables, so you can query these directly (via tools like SE16N or DBACOCKPIT):

  • Step 1: Get the T-Code's program and initial screen number
    Query the TSTC table (SAP Transaction Codes table) using your target T-Code as the filter:

    • TCODE: Your target transaction code
    • PGMNA: Returns the associated program name
    • DYNNR: Returns the initial screen number linked to the T-Code
  • Step 2: Map the program to its function module group
    Most function module groups use their group name as the main program name. To confirm this, query the TADIR table (Object Directory Entry table):

    • Filter by PGMID = 'R3TR', OBJECT = 'FUGR', and OBJ_NAME = [PGMNA value from TSTC]
    • If a match exists, OBJ_NAME is your function module group name.

    Note: If no match is found, the T-Code likely links to a non-function-group program (like a report or class-based program), so there's no associated function module group.

2. SAP Built-In Tools (No Database Query Needed)

If you prefer using SAP's native tools instead of direct DB queries, these options work great:

  • SE93 (Maintain Transaction Codes)
    Enter your T-Code and click "Display". The screen will show you the linked program (Program/Transaction field) and initial screen number (Screen number). If the program is a function group's main program, you can cross-reference it in SE80 to confirm the group.

  • SE80 (Object Navigator)
    Enter the program name from SE93/TSTC into the input field, select "Program" as the object type, and press Enter. The navigation tree will show you if the program belongs to a function group (look under "Function Groups" in the tree).

3. Automated Extraction via ABAP Program

If you need to extract this data in bulk or integrate it into another process, you can write a simple ABAP program to automate the lookup:

REPORT Z_GET_TCODE_FUGR_SCREEN.

* Input parameter for target T-Code
PARAMETERS: p_tcode TYPE tstc-tcode OBLIGATORY.

* Variables to store results
DATA: lv_program TYPE tstc-pgmna,
      lv_screen  TYPE tstc-dynnr,
      lv_fugr    TYPE tadir-obj_name.

* Fetch program and screen from TSTC
SELECT SINGLE pgmna dynnr INTO (lv_program, lv_screen)
  FROM tstc
 WHERE tcode = p_tcode.

IF sy-subrc = 0.
  WRITE: / 'Transaction Code:', p_tcode,
          / 'Associated Program:', lv_program,
          / 'Initial Screen Number:', lv_screen.

  * Fetch function module group from TADIR
  SELECT SINGLE obj_name INTO lv_fugr
    FROM tadir
   WHERE pgmid = 'R3TR'
     AND object = 'FUGR'
     AND obj_name = lv_program.

  IF sy-subrc = 0.
    WRITE: / 'Linked Function Module Group:', lv_fugr.
  ELSE.
    WRITE: / 'No function module group found for this program.'
  ENDIF.
ELSE.
  WRITE: / 'Error: T-Code does not exist in the system.'
ENDIF.

Just run this program, input your T-Code, and it will output all the required details in one go.

内容的提问来源于stack exchange,提问作者Surya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 07:11:30