如何在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:
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 theTSTCtable (SAP Transaction Codes table) using your target T-Code as the filter:TCODE: Your target transaction codePGMNA: Returns the associated program nameDYNNR: 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 theTADIRtable (Object Directory Entry table):- Filter by
PGMID = 'R3TR',OBJECT = 'FUGR', andOBJ_NAME = [PGMNA value from TSTC] - If a match exists,
OBJ_NAMEis 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.
- Filter by
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).
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

