SAP MDG · UTILITIES
How do I read a specific element from a workflow work-item container in SAP MDG or SAP Business Workflow?
Use SAP_WAPI_READ_CONTAINER with the work-item ID, then read the returned simple container table for the required element name such as ACTION_RESULT.
Use SAP_WAPI_READ_CONTAINER with the work-item ID, then read the returned simple container table for the required element name such as ACTION_RESULT.
Use SAP_WAPI_READ_CONTAINER to read the container of a workflow work item. Pass the work-item ID, language, user, and buffered access, then read the returned simple container for the required element name such as ACTION_RESULT. Check the return code before using the value.
Process flow
- Declare the work-item ID and the workflow container element name.
- Call SAP_WAPI_READ_CONTAINER with language, user, and buffered access.
- Check the return code before using any container value.
- Read the SIMPLE_CONTAINER table for the required element.
- Use LS_CONTAINER-VALUE if the element exists.
- Inspect message tables if the read fails.
Referenced tables
| Object | Purpose |
|---|---|
SWR_CONT | Simple workflow container rows returned by SAP_WAPI_READ_CONTAINER. |
SWR_MESSAG | Message lines returned by SAP_WAPI_READ_CONTAINER. |
SWR_MSTRUC | Structured message details returned by SAP_WAPI_READ_CONTAINER. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1" Inputs: work-item ID and workflow-specific element name.
2DATA lv_workitem_id TYPE sww_wiid. " Supply
3DATA lv_element TYPE swc_elem VALUE 'ACTION_RESULT'.
4DATA lt_container TYPE STANDARD TABLE OF swr_cont WITH EMPTY KEY.
5DATA lt_messages TYPE STANDARD TABLE OF swr_messag WITH EMPTY KEY.
6DATA lt_msg_struct TYPE STANDARD TABLE OF swr_mstruc WITH EMPTY KEY.
7
8CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
9 EXPORTING
10 workitem_id = lv_workitem_id language = sy-langu
11 user = sy-uname buffered_access = abap_true
12 IMPORTING return_code = DATA(lv_return_code)
13 TABLES simple_container = lt_container
14 message_lines = lt_messages message_struct = lt_msg_struct.
15
16IF lv_return_code = 0.
17 READ TABLE lt_container INTO DATA(ls_container) WITH KEY element = lv_element.
18 IF sy-subrc = 0.
19 DATA(lv_element_value) = ls_container-value.
20 ENDIF.
21ENDIF.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How can I get ACTION_RESULT from a work-item container?
- How do I read SAP workflow container values in ABAP?
- What is the standard API for reading a work-item container?
Possible questions
- Which function module reads a workflow container?
- How do I read container element values from a work item?
- How do I handle the return code and messages from SAP_WAPI_READ_CONTAINER?
- How do I adapt this for another container element?
- How do I read a container element for a specific work-item ID?