Hi All,
I have written the Code like This, The Workflow is Triggering Correctly when i create or change PO in ME22n i am not getting the workitem value in it_worklist[].
Can you Check the Code and let me know the Correct Format.
SELECTION-SCREEN BEGIN OF BLOCK b1.
PARAMETERS p_inst TYPE sibflporb-instid OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
CLEAR: it_worklist.
CLEAR o_obtype.
o_obtype-catid = 'BO'.
o_obtype-typeid = 'BUS2012'.
o_obtype-instid = p_inst.
IF o_obtype IS INITIAL.
CALL FUNCTION 'SAP_WAPI_WORKITEMS_TO_OBJECT'
EXPORTING
object_por = o_obtype
top_level_items = 'X'
selection_status_variant = '0001'
time = ls_time
output_only_top_level = 'X'
determine_task_filter = space
TABLES
task_filter = lt_task_filter
worklist = it_worklist[].
ELSE.
CALL FUNCTION 'SAP_WAPI_WORKITEMS_TO_OBJECT'
EXPORTING
object_por = o_obtype
top_level_items = space
selection_status_variant = '0001'
time = ls_time
output_only_top_level = 'X'
TABLES
task_filter = lt_task_filter
worklist = it_worklist[].
ENDIF.
*lt_worklist-wi_id = '495105'.
LOOP AT it_worklist INTO wa_worklist.
CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
EXPORTING
workitem_id = wa_worklist-wi_id
* LANGUAGE = SY-LANGU
* USER = SY-UNAME
* IMPORTING
* RETURN_CODE =
TABLES
simple_container = lt_container.
* message_lines = lt_message_lines
* message_struct = lt_message_struct
* subcontainer_bor_objects = lt_subcontainer_bor_objects
* subcontainer_all_objects = lt_subcontainer_all_objects.
APPEND LINES OF it_worklist TO it_final.
ENDLOOP.