SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

SAP Transactions Table and Transaction running ABAP Program

Developer can query SAP Transaction Codes table TSTC or use SE80 Object Navigator to find SAP transactions running specific ABAP program or report. This tutorial shows how to find the SAP transaction used to launch a particular ABAP program.

SAP Transaction Codes table TSTC

Using SE11 ABAP Data Browser transaction, SAP transparent table TSTC (SAP Transaction Codes) for basic transaction information.
Display the TSTC database table with Program Name PGMNA (data type is PROGRAM_ID) field filled with the ABAP program name.
And run the query.

SAP Transaction Codes table for ABAP programs

As seen in below screenshot from the query output of SE11 for TSTC table, TCODE field displays the SAP transaction used to execute ABAP program in PGMNA field.

TSTC table storing SAP Transaction Codes data

It is possible to find tcode by using below SELECT statement in your ABAP codes.
In following sample ABAP code, I query the TSTC SAP transactions table for a specific SAP standart ABAP report SAPMSUU0O for SU3 transaction. Some programs are used in more than one transaction with different screen numbers.
Of course the ABAP developer should consider to find the correct screen number in following sample to correctly launch the targeted SAP transaction code.

ABAP function module TH_CREATE_MODE will create a new session and launch the selected SAP transaction code by querying the TSTC SAP transactions table.

SELECT * INTO TABLE @DATA(lt_transactions)
 FROM tstc
 WHERE pgmna = 'SAPMSUU0O'.
CHECK sy-subrc = 0.

READ TABLE lt_transactions INTO DATA(ls_transaction) INDEX 1.
CHECK ls_transaction-tcode IS NOT INITIAL.

CALL FUNCTION 'TH_CREATE_MODE'
 EXPORTING
  transaktion = ls_transaction-tcode
* DEL_ON_EOT = 0
* PARAMETERS =
* PROCESS_DARK = ''
* INHERIT_STAT_TRANS_ID = 0
* IMPORTING
* MODE =
 EXCEPTIONS
  MAX_SESSIONS = 1
  INTERNAL_ERROR = 2
  NO_AUTHORITY = 3
  OTHERS = 4 .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
Code

On the other hand, ABAP4_CALL_TRANSACTION ABAP function module enables ABAP programmer to launch the selected transaction code in the same session, in the same GUI.

SELECT * INTO TABLE @DATA(lt_transactions)
 FROM tstc
 WHERE pgmna = 'SAPMSUU0O'.
CHECK sy-subrc = 0.

READ TABLE lt_transactions INTO DATA(ls_transaction) INDEX 1.
CHECK ls_transaction-tcode IS NOT INITIAL.

CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
 EXPORTING
  tcode = ls_transaction-tcode
* SKIP_SCREEN = ' '
* MODE_VAL = 'A'
* UPDATE_VAL = 'A'
* IMPORTING
* SUBRC =
* TABLES
* USING_TAB =
* SPAGPA_TAB =
* MESS_TAB =
* EXCEPTIONS
* CALL_TRANSACTION_DENIED = 1
* TCODE_INVALID = 2
* OTHERS = 3 . IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
Code

SAP Transaction Code used to execute ABAP Program

Another way to identify the SAP transaction code used for executing an ABAP program is displaying ABAP program in SE80 Object Navigator tool.
Launch SE80 tcode.
Select Program and type the program name in Repository Browser tool and press Enter.

Object Navigator Repository Browser tool

If a transaction is created for the ABAP program, it will be displayed in the Transactions folder as seen in above screenshot.



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.