SAP Function Modules

SWZ_AI_CREATE SAP Function module







SWZ_AI_CREATE is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name SWZ_AI_CREATE into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: SWZA
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM SWZ_AI_CREATE - SWZ AI CREATE





CALL FUNCTION 'SWZ_AI_CREATE' "
  EXPORTING
*   application = SPACE         " swzai-appl    Application which created the WQ
*   callback_fb = SPACE         " swwwihead-wi_cbfb  FM for confirming completed WQ
    creator =                   " swwwihead-wi_creator  Work queue creator
*   def_task = SPACE            " swzai-def_task  Default task overwrites all line tasks
*   language = SY-LANGU         " swwwihead-wi_lang  Language of WQ (for reading texts)
*   priority = SWFCO_NO_PRIO    " swwwihead-wi_prio  Work queue priority
*   released = SPACE            " swzai-released  Immediate execution without explicit release
*   text = SPACE                " swwwihead-wi_text  Short text for the work item
*   do_commit = 'X'             " swwcommit-commitflag  Flag for controlling commit logic
*   create_event = 'X'          " swwcommit-eventflag  Flag for triggering event "CREATED"
*   application_exec_function = SPACE  " swzai-applexfunc
*   object_type = 'ARCHLISTWI'  " swotobjid-objtype  Object type of WQ in object repository
*   keep_initial_agents = SPACE  " xfeld
  IMPORTING
    wi_id =                     " swwwihead-wi_id  ID of WQ created
    wi_header =                 " swwwihead     Header data of WQ created
  TABLES
*   agents =                    " swhactor      Agents for releasing work queue
    object_list =               " swzaielem     Container with lines to be copied to WQ
*   wi_container =              " swcont        Data container of WQ
  EXCEPTIONS
    ID_NOT_CREATED = 1          "               Work queue ID cannot be created
    ID_NOT_EXECUTED = 2         "               Immediate execution not possible
    READ_FAILED = 3             "               Higher-level deadlines cannot be read
    .  "  SWZ_AI_CREATE

ABAP code example for Function Module SWZ_AI_CREATE





The ABAP code below is a full code listing to execute function module SWZ_AI_CREATE including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_wi_id  TYPE SWWWIHEAD-WI_ID ,
ld_wi_header  TYPE SWWWIHEAD ,
it_agents  TYPE STANDARD TABLE OF SWHACTOR,"TABLES PARAM
wa_agents  LIKE LINE OF it_agents ,
it_object_list  TYPE STANDARD TABLE OF SWZAIELEM,"TABLES PARAM
wa_object_list  LIKE LINE OF it_object_list ,
it_wi_container  TYPE STANDARD TABLE OF SWCONT,"TABLES PARAM
wa_wi_container  LIKE LINE OF it_wi_container .


SELECT single APPL
FROM SWZAI
INTO @DATA(ld_application).


SELECT single WI_CBFB
FROM SWWWIHEAD
INTO @DATA(ld_callback_fb).


SELECT single WI_CREATOR
FROM SWWWIHEAD
INTO @DATA(ld_creator).


SELECT single DEF_TASK
FROM SWZAI
INTO @DATA(ld_def_task).


SELECT single WI_LANG
FROM SWWWIHEAD
INTO @DATA(ld_language).


SELECT single WI_PRIO
FROM SWWWIHEAD
INTO @DATA(ld_priority).


SELECT single RELEASED
FROM SWZAI
INTO @DATA(ld_released).


SELECT single WI_TEXT
FROM SWWWIHEAD
INTO @DATA(ld_text).


DATA(ld_do_commit) = some text here

DATA(ld_create_event) = some text here

SELECT single APPLEXFUNC
FROM SWZAI
INTO @DATA(ld_application_exec_function).


DATA(ld_object_type) = some text here
DATA(ld_keep_initial_agents) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_agents to it_agents.

"populate fields of struture and append to itab
append wa_object_list to it_object_list.

"populate fields of struture and append to itab
append wa_wi_container to it_wi_container. . CALL FUNCTION 'SWZ_AI_CREATE' EXPORTING * application = ld_application * callback_fb = ld_callback_fb creator = ld_creator * def_task = ld_def_task * language = ld_language * priority = ld_priority * released = ld_released * text = ld_text * do_commit = ld_do_commit * create_event = ld_create_event * application_exec_function = ld_application_exec_function * object_type = ld_object_type * keep_initial_agents = ld_keep_initial_agents IMPORTING wi_id = ld_wi_id wi_header = ld_wi_header TABLES * agents = it_agents object_list = it_object_list * wi_container = it_wi_container EXCEPTIONS ID_NOT_CREATED = 1 ID_NOT_EXECUTED = 2 READ_FAILED = 3 . " SWZ_AI_CREATE
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_wi_id  TYPE SWWWIHEAD-WI_ID ,
ld_application  TYPE SWZAI-APPL ,
it_agents  TYPE STANDARD TABLE OF SWHACTOR ,
wa_agents  LIKE LINE OF it_agents,
ld_wi_header  TYPE SWWWIHEAD ,
ld_callback_fb  TYPE SWWWIHEAD-WI_CBFB ,
it_object_list  TYPE STANDARD TABLE OF SWZAIELEM ,
wa_object_list  LIKE LINE OF it_object_list,
ld_creator  TYPE SWWWIHEAD-WI_CREATOR ,
it_wi_container  TYPE STANDARD TABLE OF SWCONT ,
wa_wi_container  LIKE LINE OF it_wi_container,
ld_def_task  TYPE SWZAI-DEF_TASK ,
ld_language  TYPE SWWWIHEAD-WI_LANG ,
ld_priority  TYPE SWWWIHEAD-WI_PRIO ,
ld_released  TYPE SWZAI-RELEASED ,
ld_text  TYPE SWWWIHEAD-WI_TEXT ,
ld_do_commit  TYPE SWWCOMMIT-COMMITFLAG ,
ld_create_event  TYPE SWWCOMMIT-EVENTFLAG ,
ld_application_exec_function  TYPE SWZAI-APPLEXFUNC ,
ld_object_type  TYPE SWOTOBJID-OBJTYPE ,
ld_keep_initial_agents  TYPE XFELD .


SELECT single APPL
FROM SWZAI
INTO ld_application.


"populate fields of struture and append to itab
append wa_agents to it_agents.

SELECT single WI_CBFB
FROM SWWWIHEAD
INTO ld_callback_fb.


"populate fields of struture and append to itab
append wa_object_list to it_object_list.

SELECT single WI_CREATOR
FROM SWWWIHEAD
INTO ld_creator.


"populate fields of struture and append to itab
append wa_wi_container to it_wi_container.

SELECT single DEF_TASK
FROM SWZAI
INTO ld_def_task.


SELECT single WI_LANG
FROM SWWWIHEAD
INTO ld_language.


SELECT single WI_PRIO
FROM SWWWIHEAD
INTO ld_priority.


SELECT single RELEASED
FROM SWZAI
INTO ld_released.


SELECT single WI_TEXT
FROM SWWWIHEAD
INTO ld_text.


ld_do_commit = some text here

ld_create_event = some text here

SELECT single APPLEXFUNC
FROM SWZAI
INTO ld_application_exec_function.


ld_object_type = some text here
ld_keep_initial_agents = 'Check type of data required'.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name SWZ_AI_CREATE or its description.