SAP SAP_WAPI_START_WORKFLOW Function Module for Workflow interfaces: Start workflow
SAP_WAPI_START_WORKFLOW is a standard sap wapi start workflow SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Workflow interfaces: Start workflow processing and below is the pattern details for this FM, 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 sap wapi start workflow FM, simply by entering the name SAP_WAPI_START_WORKFLOW into the relevant SAP transaction such as SE37 or SE38.
Function Group: SWRR
Program Name: SAPLSWRR
Main Program: SAPLSWRR
Appliation area: S
Release date: 05-Aug-1999
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function SAP_WAPI_START_WORKFLOW 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 'SAP_WAPI_START_WORKFLOW'"Workflow interfaces: Start workflow.
EXPORTING
TASK = "Task (According to PD org.)
* LANGUAGE = SY-LANGU "Language
* DO_COMMIT = 'X' "Execute Commit
* USER = SY-UNAME "ABAP System, User Logon Name
* START_ASYNCHRONOUS = ' ' "Start Workflow Asynchronously
* DESIRED_START_DATE = "WAPI: Date in internal format (YYYYMMDD)
* DESIRED_START_TIME = "WAPI: Time in internal format (hhmmss)
* DESIRED_START_ZONLO = SY-ZONLO "Date and time, time zone of user
* IFS_XML_CONTAINER = "Workflow Container as XML Data Stream
IMPORTING
RETURN_CODE = "Return code (0 - 6, 999)
WORKITEM_ID = "Work Item ID
NEW_STATUS = "Workflow Interfaces: Work Item Status
TABLES
* INPUT_CONTAINER = "Input container (name-value pairs)
* MESSAGE_LINES = "Message Lines
* MESSAGE_STRUCT = "Message Structure
* AGENTS = "Agent for Task
IMPORTING Parameters details for SAP_WAPI_START_WORKFLOW
TASK - Task (According to PD org.)
Data type: SWR_STRUCT-TASKOptional: No
Call by Reference: No ( called with pass by value option)
LANGUAGE - Language
Data type: SWR_STRUCT-WILANGUAGEDefault: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)
DO_COMMIT - Execute Commit
Data type: XFLAGDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
USER - ABAP System, User Logon Name
Data type: SYUNAMEDefault: SY-UNAME
Optional: Yes
Call by Reference: No ( called with pass by value option)
START_ASYNCHRONOUS - Start Workflow Asynchronously
Data type: XFLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
DESIRED_START_DATE - WAPI: Date in internal format (YYYYMMDD)
Data type: SWR_DATEINOptional: Yes
Call by Reference: No ( called with pass by value option)
DESIRED_START_TIME - WAPI: Time in internal format (hhmmss)
Data type: SWR_TIMEINOptional: Yes
Call by Reference: No ( called with pass by value option)
DESIRED_START_ZONLO - Date and time, time zone of user
Data type: SYSTZONLODefault: SY-ZONLO
Optional: Yes
Call by Reference: No ( called with pass by value option)
IFS_XML_CONTAINER - Workflow Container as XML Data Stream
Data type: XSTRINGOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for SAP_WAPI_START_WORKFLOW
RETURN_CODE - Return code (0 - 6, 999)
Data type: SY-SUBRCOptional: No
Call by Reference: No ( called with pass by value option)
WORKITEM_ID - Work Item ID
Data type: SWR_STRUCT-WORKITEMIDOptional: No
Call by Reference: No ( called with pass by value option)
NEW_STATUS - Workflow Interfaces: Work Item Status
Data type: SWR_WISTATOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for SAP_WAPI_START_WORKFLOW
INPUT_CONTAINER - Input container (name-value pairs)
Data type: SWR_CONTOptional: Yes
Call by Reference: No ( called with pass by value option)
MESSAGE_LINES - Message Lines
Data type: SWR_MESSAGOptional: Yes
Call by Reference: No ( called with pass by value option)
MESSAGE_STRUCT - Message Structure
Data type: SWR_MSTRUCOptional: Yes
Call by Reference: No ( called with pass by value option)
AGENTS - Agent for Task
Data type: SWRAGENTOptional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for SAP_WAPI_START_WORKFLOW 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: | ||||
| lv_task | TYPE SWR_STRUCT-TASK, " | |||
| lv_return_code | TYPE SY-SUBRC, " | |||
| lt_input_container | TYPE STANDARD TABLE OF SWR_CONT, " | |||
| lv_language | TYPE SWR_STRUCT-WILANGUAGE, " SY-LANGU | |||
| lv_workitem_id | TYPE SWR_STRUCT-WORKITEMID, " | |||
| lt_message_lines | TYPE STANDARD TABLE OF SWR_MESSAG, " | |||
| lv_do_commit | TYPE XFLAG, " 'X' | |||
| lv_new_status | TYPE SWR_WISTAT, " | |||
| lt_message_struct | TYPE STANDARD TABLE OF SWR_MSTRUC, " | |||
| lv_user | TYPE SYUNAME, " SY-UNAME | |||
| lt_agents | TYPE STANDARD TABLE OF SWRAGENT, " | |||
| lv_start_asynchronous | TYPE XFLAG, " SPACE | |||
| lv_desired_start_date | TYPE SWR_DATEIN, " | |||
| lv_desired_start_time | TYPE SWR_TIMEIN, " | |||
| lv_desired_start_zonlo | TYPE SYSTZONLO, " SY-ZONLO | |||
| lv_ifs_xml_container | TYPE XSTRING. " |
|   CALL FUNCTION 'SAP_WAPI_START_WORKFLOW' "Workflow interfaces: Start workflow |
| EXPORTING | ||
| TASK | = lv_task | |
| LANGUAGE | = lv_language | |
| DO_COMMIT | = lv_do_commit | |
| USER | = lv_user | |
| START_ASYNCHRONOUS | = lv_start_asynchronous | |
| DESIRED_START_DATE | = lv_desired_start_date | |
| DESIRED_START_TIME | = lv_desired_start_time | |
| DESIRED_START_ZONLO | = lv_desired_start_zonlo | |
| IFS_XML_CONTAINER | = lv_ifs_xml_container | |
| IMPORTING | ||
| RETURN_CODE | = lv_return_code | |
| WORKITEM_ID | = lv_workitem_id | |
| NEW_STATUS | = lv_new_status | |
| TABLES | ||
| INPUT_CONTAINER | = lt_input_container | |
| MESSAGE_LINES | = lt_message_lines | |
| MESSAGE_STRUCT | = lt_message_struct | |
| AGENTS | = lt_agents | |
| . " SAP_WAPI_START_WORKFLOW | ||
ABAP code using 7.40 inline data declarations to call FM SAP_WAPI_START_WORKFLOW
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 TASK FROM SWR_STRUCT INTO @DATA(ld_task). | ||||
| "SELECT single SUBRC FROM SY INTO @DATA(ld_return_code). | ||||
| "SELECT single WILANGUAGE FROM SWR_STRUCT INTO @DATA(ld_language). | ||||
| DATA(ld_language) | = SY-LANGU. | |||
| "SELECT single WORKITEMID FROM SWR_STRUCT INTO @DATA(ld_workitem_id). | ||||
| DATA(ld_do_commit) | = 'X'. | |||
| DATA(ld_user) | = SY-UNAME. | |||
| DATA(ld_start_asynchronous) | = ' '. | |||
| DATA(ld_desired_start_zonlo) | = SY-ZONLO. | |||
Search for further information about these or an SAP related objects