Skip to Content
0
Oct 16, 2007 at 06:21 AM

Workflow trigger issue

48 Views

Hi Sapgurus,

I have made a scenerio in which if user enters the measuring point value greater than target value in IK11 then a notification is generated *(i.e IW21) now i want when this notification is generated a workflow should trigger that can intimate user that the notification has been generated my problem is when i try to trigger it i get the short dumb saying

The call of a COMMIT WORK in a FORM, that will not be executed until

the commit or rollback point of the caller using the variant

PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK is not permitted.

Could anyone please tell mee what is the reason below is the code which i m writing to trigger the workflow.

*&!!!@@@@@@@@@@##############$%%%%%%%%%%^^^^^^^^^^^^^^^&&&&&&&&&&&&&&&&&&&&&

  • CLEAR wa_swcont.

  • wa_swcont-element = 'FLAG'.

  • wa_swcont-elemlength = '001'.

  • wa_swcont-type = 'I'.

  • lv_test = p_key.

  • wa_swcont-value = lv_test.

  • APPEND wa_swcont TO i_container.

  • it_container-container = p_key.

  • append it_container.

*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'

EXPORTING

TASK = 'WS99900237'

LANGUAGE = SY-LANGU

DO_COMMIT = 'X'

USER = SY-UNAME

  • START_ASYNCHRONOUS = ' '

  • DESIRED_START_DATE =

  • DESIRED_START_TIME =

  • DESIRED_START_ZONLO = SY-ZONLO

  • IFS_XML_CONTAINER =

  • IMPORTING

  • RETURN_CODE =

  • WORKITEM_ID =

  • NEW_STATUS =

*TABLES

  • INPUT_CONTAINER = it_container

  • MESSAGE_LINES =

  • MESSAGE_STRUCT =

  • AGENTS =

.

CALL FUNCTION 'SWE_EVENT_CREATE'

EXPORTING

OBJTYPE = 'BUS2038'

OBJKEY = p_key

EVENT = 'CREATED'

  • CREATOR = ' '

  • TAKE_WORKITEM_REQUESTER = ' '

  • START_WITH_DELAY = ' '

  • START_RECFB_SYNCHRON = ' '

  • NO_COMMIT_FOR_QUEUE = ' '

  • DEBUG_FLAG = ' '

  • NO_LOGGING = ' '

  • IDENT =

  • IMPORTING

  • EVENT_ID =

  • TABLES

  • EVENT_CONTAINER =

  • EXCEPTIONS

  • OBJTYPE_NOT_FOUND = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  • wa_agents-objid = 'BSPDEV01'.

  • APPEND wa_agents TO i_agents.

*CALL FUNCTION 'SWW_WI_START_SIMPLE'

  • EXPORTING

  • CREATOR = ' '

  • PRIORITY = SWFCO_NO_PRIO

  • TASK = 'WS99900237'

    • CALLED_IN_BACKGROUND = ' '

    • DEADLINE_DATA = ' '

    • NO_DEADLINE_PARAMETERS = ' '

    • IMPORTING

    • WI_ID =

    • WI_HEADER =

    • RETURN =

    • WI_RESULT =

    • SWF_RETURN =

  • TABLES

  • AGENTS = i_agents

    • DEADLINE_AGENTS =

    • DESIRED_END_AGENTS =

    • LATEST_START_AGENTS =

    • EXCLUDED_AGENTS =

    • NOTIFICATION_AGENTS =

    • SECONDARY_METHODS =

    • WI_CONTAINER = i_container

    • CHANGING

    • WI_CONTAINER_HANDLE =

    • EXCEPTIONS

    • ID_NOT_CREATED = 1

    • READ_FAILED = 2

    • IMMEDIATE_START_NOT_POSSIBLE = 3

    • EXECUTION_FAILED = 4

    • INVALID_STATUS = 5

    • OTHERS = 6

  • .

  • *IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    *ENDIF.

    *

    *

    **commit WORK.

    endif.

    I have used the all the FM to triiger workflow but getting the same dumb again and again.

    the FM i have user are

    1. SAP_WAPI_START_WORKFLOW

    2. SWE_EVENT_CREATE

    3. SWW_WI_START_SIMPLE

    All are giving the same dumb.

    Please help me out.

    Thanks and Regards,

    Rachit Khanna