In a function exit of a workflow task, you can copy the sample coding out of class CL_SWH_WORKITEM_EXIT_LOG to append a custom message
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | METHOD if_swf_ifs_workitem_exit~event_raised .
DATA : ls_msg TYPE swr_mstruc.
DATA : ls_por TYPE sibflporb.
DATA : l_cnt TYPE REF TO if_swf_ifs_parameter_container.
me->m_ctx = im_workitem_context.
IF im_event_name EQ swrco_event_after_creation.
ls_msg-msgid = 'SWH' .
ls_msg-msgty = 'S' .
ls_msg-msgno = '100' .
ls_msg-msgv1 = 'CL_SWH_WORKITM_EXIT_LOG' .
ls_msg-msgv2 = 'swrco_event_after_creation' .
l_cnt = m_ctx->get_wi_container( ).
TRY .
CALL METHOD l_cnt-> get
EXPORTING
name = swrco_wi_leading_object
IMPORTING
value = ls_por.
CALL METHOD m_ctx->set_message_to_log
EXPORTING
im_message = ls_msg
im_object_por = ls_por.
CATCH cx_swf_cnt_container .
ENDTRY .
ENDIF .
ENDMETHOD .
|
But to add a message in general, only the workitem context is needed. If you got the context, just use method set_message_to_log.
01 02 03 04 05 06 07 08 09 10 11 | im_workitem_context->set_message_to_log( im_function = |Forward: Mail { var }|
im_message = VALUE #( msgid = '00'
msgty = 'S'
msgno = '000'
msgv1 = |var 1|
msgv2 = |var 2| ) ).
|
You’ll find the log entry in workitem flog view: