SAP SWT_TRACE_WRITE Function Module for









SWT_TRACE_WRITE is a standard swt trace write SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for swt trace write FM, simply by entering the name SWT_TRACE_WRITE into the relevant SAP transaction such as SE37 or SE38.

Function Group: SWT1
Program Name: SAPLSWT1
Main Program: SAPLSWT1
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function SWT_TRACE_WRITE pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'SWT_TRACE_WRITE'"
EXPORTING
OWN_MODID = "ID of calling workflow module
* SPA_ID = 'SWT' "
* HROBJTYPE = "Entry refers to this HR object type
* HROBJID = "Entry refers to this HR object ID
* SEVERITY = 9 "Severity of log entry
ACTION = "Action executed in workflow trace
* THEIR_MODID = "ID of the workflow module called
* DATA_STR = "Data structure (alternative to DATA_LST)
* NAME_STR = "Structure name (alternative to NAME_LST)
* FUNCNAME = "Name of calling function

TABLES
* NAME_LST = "List of structure names (alternative to NAME_STR)
* DATA_LST = "List of data structures (alt. to DATA_STR)
* LEVEL_LST = "Hierarchy level of log entry
.



IMPORTING Parameters details for SWT_TRACE_WRITE

OWN_MODID - ID of calling workflow module

Data type: SWT_LOG-OWNMODID
Optional: No
Call by Reference: No ( called with pass by value option)

SPA_ID -

Data type: RSEUX-CR_VALUE
Default: 'SWT'
Optional: Yes
Call by Reference: No ( called with pass by value option)

HROBJTYPE - Entry refers to this HR object type

Data type: SWT_LOG-OBJTYPE
Optional: Yes
Call by Reference: No ( called with pass by value option)

HROBJID - Entry refers to this HR object ID

Data type: ANY
Optional: Yes
Call by Reference: No ( called with pass by value option)

SEVERITY - Severity of log entry

Data type: SWT_LOG-SEVERITY
Default: 9
Optional: Yes
Call by Reference: No ( called with pass by value option)

ACTION - Action executed in workflow trace

Data type: SWT_ACT-TACTION
Optional: No
Call by Reference: No ( called with pass by value option)

THEIR_MODID - ID of the workflow module called

Data type: SWT_LOG-THEIRMODID
Optional: Yes
Call by Reference: No ( called with pass by value option)

DATA_STR - Data structure (alternative to DATA_LST)

Data type:
Optional: Yes
Call by Reference: No ( called with pass by value option)

NAME_STR - Structure name (alternative to NAME_LST)

Data type: SWT_LOGDAT-STRUCTNAME
Optional: Yes
Call by Reference: No ( called with pass by value option)

FUNCNAME - Name of calling function

Data type: SWT_LOG-FUNCNAME
Optional: Yes
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for SWT_TRACE_WRITE

NAME_LST - List of structure names (alternative to NAME_STR)

Data type: STANDARD TABLE
Optional: Yes
Call by Reference: Yes

DATA_LST - List of data structures (alt. to DATA_STR)

Data type: STANDARD TABLE
Optional: Yes
Call by Reference: Yes

LEVEL_LST - Hierarchy level of log entry

Data type: STANDARD TABLE
Optional: Yes
Call by Reference: Yes

Copy and paste ABAP code example for SWT_TRACE_WRITE Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lt_name_lst  TYPE STANDARD TABLE OF STANDARD TABLE, "   
lv_own_modid  TYPE SWT_LOG-OWNMODID, "   
lv_spa_id  TYPE RSEUX-CR_VALUE, "   'SWT'
lt_data_lst  TYPE STANDARD TABLE OF STANDARD TABLE, "   
lv_hrobjtype  TYPE SWT_LOG-OBJTYPE, "   
lv_hrobjid  TYPE ANY, "   
lt_level_lst  TYPE STANDARD TABLE OF STANDARD TABLE, "   
lv_severity  TYPE SWT_LOG-SEVERITY, "   9
lv_action  TYPE SWT_ACT-TACTION, "   
lv_their_modid  TYPE SWT_LOG-THEIRMODID, "   
lv_data_str  TYPE SWT_LOG, "   
lv_name_str  TYPE SWT_LOGDAT-STRUCTNAME, "   
lv_funcname  TYPE SWT_LOG-FUNCNAME. "   

  CALL FUNCTION 'SWT_TRACE_WRITE'  "
    EXPORTING
         OWN_MODID = lv_own_modid
         SPA_ID = lv_spa_id
         HROBJTYPE = lv_hrobjtype
         HROBJID = lv_hrobjid
         SEVERITY = lv_severity
         ACTION = lv_action
         THEIR_MODID = lv_their_modid
         DATA_STR = lv_data_str
         NAME_STR = lv_name_str
         FUNCNAME = lv_funcname
    TABLES
         NAME_LST = lt_name_lst
         DATA_LST = lt_data_lst
         LEVEL_LST = lt_level_lst
. " SWT_TRACE_WRITE




ABAP code using 7.40 inline data declarations to call FM SWT_TRACE_WRITE

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

 
"SELECT single OWNMODID FROM SWT_LOG INTO @DATA(ld_own_modid).
 
"SELECT single CR_VALUE FROM RSEUX INTO @DATA(ld_spa_id).
DATA(ld_spa_id) = 'SWT'.
 
 
"SELECT single OBJTYPE FROM SWT_LOG INTO @DATA(ld_hrobjtype).
 
 
 
"SELECT single SEVERITY FROM SWT_LOG INTO @DATA(ld_severity).
DATA(ld_severity) = 9.
 
"SELECT single TACTION FROM SWT_ACT INTO @DATA(ld_action).
 
"SELECT single THEIRMODID FROM SWT_LOG INTO @DATA(ld_their_modid).
 
 
"SELECT single STRUCTNAME FROM SWT_LOGDAT INTO @DATA(ld_name_str).
 
"SELECT single FUNCNAME FROM SWT_LOG INTO @DATA(ld_funcname).
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!