Skip to Content

Work Item ID

Hello All,

I am trying to get the work item id after the workflow triggered. I am using class based workflow and triggered the workflow through the event.

Please help me to get the work item id.

Thanks in Advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Jul 15, 2016 at 02:05 PM

    Hi

    Can you explain a little more why do you want the work item ID ?

    Is this because you don't find your wokflow ?

    First if you know the object (class) you can use tansaction SWI6 with the instance number

    Then if it does not work you can use transaction SWI1 with you workflow definition number in the selection screen.

    Cheers

    Stephane

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 18, 2016 at 07:52 AM

    You can fetch the workitem id in the context immediately.

    Please refer class CL_SWF_RUN_WORKITEM_CONTEXT and interface IF_WAPI_WORKITEM_CONTEXT
    * Get the Work Item ID
    CALL METHOD wi_context->get_workitem_id
    RECEIVING
    re_workitem = lcl_v_wi_id.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi

      From the piece of code you sent earlier :

      DATA: lt_swr_wihdr TYPE STANDARD TABLE OF swr_wihdr,

      lv_key TYPE swotobjid-objkey.

      lv_key = lv_objkey.

      DATA lv_sibflporb TYPE sibflporb.

      lv_sibflporb = m_lpor.

      break-point.

      CALL FUNCTION 'SAP_WAPI_WORKITEMS_TO_OBJECT'

      EXPORTING

      object_por = lv_sibflporb

      objkey = lv_key

      TABLES

      * TASK_FILTER =

      worklist = lt_swr_wihdr

      You are not filling OBJTYPE

      if you provide OBJKEY you need OBJTYPE and you don't need object_por

      if you provide object_por (totally filled) you don't need OBJKEY and OBJTYPE

      BR

      Stephane

  • Posted on Jul 22, 2016 at 07:01 AM

    Hi Ranjith,

    You can try following Standard Table.

    SELECT SINGLE wi_id

    FROM sww_wi2obj

    INTO lv_wiid

    WHERE wi_rh_task EQ "Your Workflow Template ID (WS*)"

    AND instid EQ lv_event_id(Which will be return from SWE_EVENT_CREATE).

    Let me know if you need more info on this.

    Regards,

    Siva K.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.