SAP Function Modules

SWP_WORKFLOW_LOG_READ SAP Function module







SWP_WORKFLOW_LOG_READ 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 SWP_WORKFLOW_LOG_READ into the relevant SAP transaction such as SE37 or SE80.

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


Pattern for FM SWP_WORKFLOW_LOG_READ - SWP WORKFLOW LOG READ





CALL FUNCTION 'SWP_WORKFLOW_LOG_READ' "
  EXPORTING
    top_level_wf =              " swwwihead-wi_id
*   wf_id =                     " swwwihead-wi_id  Workflow ID
*   language = SY-LANGU         " sy-langu
*   nesting_level = '1'         " swp_logtab-wi_depth
*   with_nodes = 'X'            " plog-histo
*   with_messages = 'X'         " plog-histo
*   expand_subflows = SPACE     "
*   archive_mode = SPACE        " c
*   archive_data =              " sww_arc
*   with_blockends =            " sy-input      Internal
  IMPORTING
    flowitem =                  " swwwihead     Work(flow) item header
  TABLES
    wf_log =                    " swp_logtab    Workflow step log (steps, nodes, messages)
  EXCEPTIONS
    WORKFLOW_DOES_NOT_EXIST = 1  "              Workflow does not exist in this client
    .  "  SWP_WORKFLOW_LOG_READ

ABAP code example for Function Module SWP_WORKFLOW_LOG_READ





The ABAP code below is a full code listing to execute function module SWP_WORKFLOW_LOG_READ 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_flowitem  TYPE SWWWIHEAD ,
it_wf_log  TYPE STANDARD TABLE OF SWP_LOGTAB,"TABLES PARAM
wa_wf_log  LIKE LINE OF it_wf_log .


SELECT single WI_ID
FROM SWWWIHEAD
INTO @DATA(ld_top_level_wf).


SELECT single WI_ID
FROM SWWWIHEAD
INTO @DATA(ld_wf_id).

DATA(ld_language) = 'Check type of data required'.

DATA(ld_nesting_level) = 123

SELECT single HISTO
FROM PLOG
INTO @DATA(ld_with_nodes).


SELECT single HISTO
FROM PLOG
INTO @DATA(ld_with_messages).

DATA(ld_expand_subflows) = 'some text here'.
DATA(ld_archive_mode) = 'Check type of data required'.
DATA(ld_archive_data) = 'Check type of data required'.
DATA(ld_with_blockends) = 'some text here'.

"populate fields of struture and append to itab
append wa_wf_log to it_wf_log. . CALL FUNCTION 'SWP_WORKFLOW_LOG_READ' EXPORTING top_level_wf = ld_top_level_wf * wf_id = ld_wf_id * language = ld_language * nesting_level = ld_nesting_level * with_nodes = ld_with_nodes * with_messages = ld_with_messages * expand_subflows = ld_expand_subflows * archive_mode = ld_archive_mode * archive_data = ld_archive_data * with_blockends = ld_with_blockends IMPORTING flowitem = ld_flowitem TABLES wf_log = it_wf_log EXCEPTIONS WORKFLOW_DOES_NOT_EXIST = 1 . " SWP_WORKFLOW_LOG_READ
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "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_flowitem  TYPE SWWWIHEAD ,
ld_top_level_wf  TYPE SWWWIHEAD-WI_ID ,
it_wf_log  TYPE STANDARD TABLE OF SWP_LOGTAB ,
wa_wf_log  LIKE LINE OF it_wf_log,
ld_wf_id  TYPE SWWWIHEAD-WI_ID ,
ld_language  TYPE SY-LANGU ,
ld_nesting_level  TYPE SWP_LOGTAB-WI_DEPTH ,
ld_with_nodes  TYPE PLOG-HISTO ,
ld_with_messages  TYPE PLOG-HISTO ,
ld_expand_subflows  TYPE STRING ,
ld_archive_mode  TYPE C ,
ld_archive_data  TYPE SWW_ARC ,
ld_with_blockends  TYPE SY-INPUT .


SELECT single WI_ID
FROM SWWWIHEAD
INTO ld_top_level_wf.


"populate fields of struture and append to itab
append wa_wf_log to it_wf_log.

SELECT single WI_ID
FROM SWWWIHEAD
INTO ld_wf_id.

ld_language = 'Check type of data required'.

ld_nesting_level = 123

SELECT single HISTO
FROM PLOG
INTO ld_with_nodes.


SELECT single HISTO
FROM PLOG
INTO ld_with_messages.

ld_expand_subflows = 'some text here'.
ld_archive_mode = 'Check type of data required'.
ld_archive_data = 'Check type of data required'.
ld_with_blockends = 'some text here'.

SAP Documentation for FM SWP_WORKFLOW_LOG_READ


This function module returns all log records of a workflow instance with the given id in table WF_LOG. This table is based on structure ...See here for full SAP fm documentation

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 SWP_WORKFLOW_LOG_READ or its description.