Arjan Nieuwenhuizen
Read all my blogsModify a workflow task returned by gateway service WFSERVICE
With SAP Netweaver Gateway, SAP delivers a great standard service for getting and processing SAP workflow tasks (/IWWRK/WFSERVICE).
Problem
Let’s say you configured a workflow tasks using a large body with multiple lines:
Solution
I ended up by creating an implementation for badi /IWWRK/ES_WF_CUST_EXT_IB. This badi has the interface method MODIFY_WORKITEM:
* Data declaration
DATA: lt_lines TYPE TABLE OF swr_txtlin.
DATA: lt_streamlines TYPE TABLE OF swr_txtlin.
DATA: lv_line TYPE swr_detlin.
* Read workitem description
CALL FUNCTION ‘SAP_WAPI_WORKITEM_DESCRIPTION’
EXPORTING
workitem_id = is_wi_details-wi_id
TABLES
text_lines = lt_lines
stream_text_lines = lt_streamlines.
* Replace default description with description including new lines
CLEAR: cv_description.
LOOP AT lt_streamlines INTO lv_line.
CONCATENATE cv_description lv_line INTO cv_description SEPARATED BY space.
ENDLOOP.
SHIFT cv_description LEFT DELETING LEADING space.
Result
As a result, the service returns the text including new lines and it is displayed correctly on the client: