How to Read SAP Workflow Container Contents using ABAP Function Module
ABAP programmer can use ABAP function module SAP_WAPI_READ_CONTAINER to display and read SAP workflow task container contents which are stored as element-value pairs. In this ABAP tutorial, I tried to share sample ABAP codes which can help the developers to use for reading SAP workflow container data.
ABAP programmers can use standart ABAP function module SAP_WAPI_READ_CONTAINER to read the contents of a SAP workflow task container data.
To see how SAP_WAPI_READ_CONTAINER ABAP function module works, let's use a sample work item id. Perhaps before you call SE37 tcode, first call SWIA transaction code (Process Work Item as Administrator) and execute the report and select a sample Work Item ID from the list.
Now we are ready to execute SE37 tcode and paste the function module "SAP_WAPI_READ_CONTAINER" in the FM name input text. Run the function module. Then provide the work item id as the marked WORKITEM_ID import parameter value.
Run ABAP function module SAP_WAPI_READ_CONTAINER to read container data
After you execute the SAP_WAPI_READ_CONTAINER function module, as seen in below screenshot SIMPLE_CONTAINER Table parameter can be used to display the contents of the workitem container data.
Execution results of ABAP function module and Simple_Container with Workflow Item container data
When ABAP programmer clicks on Simple_Container table parameter, as seen in below image the workflow container data is listed as element value pairs.
Execution results of ABAP function module and Simple_Container with Workflow Item container data
If you want to develop an ABAP program which reads workflow container data using SAP_WAPI_READ_CONTAINER function module, you can use following ABAP code sample as a starting point for your report.
Above ABAP program will list all element-value pairs stored in the workflow container content.
ABAP codes to list Workflow container data as key-value pairs
If you work on a specific workflow task, it is possible that you already know the element names of the ABAP workflow container data. If the ABAP programmer is dealing with specific container data of a SAP workflow task, you can directly READ related element from the Simple_Container table parameter.
Here is the output of the simple ABAP report which displays specific element values from a SAP Workflow task container.
How to read SAP Workflow container contents for specific element
Above ABAP codes work for a given specific SAP Workflow task id. If you need to display data for a given task (like TS90900107, etc) in a defined period the programmer has to loop in the list of work items and call above code block. Of course for a better look-and-feel the workflow container data should be stored in an internal table and the result could be displayed on an ALV grid for a table display.