Skip to Content

Workflow is triggering two times..

Hi All,

Workflow is triggering two times. There two release codes for purchase orders. After first release code is approved, a duplicate workflow is started with second release code. There are two entries in SWEL for event RELEASESTEPCREATED for same purchase order.I don't want the second workflow to be triggered which is causing the problem. There is only one entry in SWETYPV for BUS2012 and RELEASESTEPCREATED Can anyone help me on this ?

Thanks

Manas

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    Posted on Jan 02, 2013 at 12:25 AM

    Hello,

    I agree - this is standard behaviour. One workflow instance for each level of approval.

    regards

    Rick Bakker / hanabi technology

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 29, 2012 at 01:45 PM

    Hi,

    This is standard PO release strategy behavior.

    Each release codes new workflow will be triggered one by one.

    If you don t want make start condition or check function module in your workflow.

    Regards.

    Ragav

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 31, 2012 at 08:39 AM

    Hi Manas,

    If I were you, I used event 'Created' and/or 'changed' in place of 'Releasestepcreated'. Those events will be triggered when PO is created and/or changed. This will avoid creation of multiple instances of workflow for the same PO.

    In case workflow is required to handle for new POs and change in existing POs, then both CREATED and CHANGED events have to be at the starting events.

    Regards,

    Rahul Kulkarni

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 18, 2013 at 07:26 AM

    Hi Manas,

    I agree with Rick - you want to work with the standard behaviour not against it. So you create a workflow that deals with each release code. And you use the release strategy with classification to control which and how many release codes are relevant to the purchase order. I have seen workflows based on PO created and changed, and it can get pretty ugly if you start working against the way the PO application wants to work.... spaghetti workflow anyone?!

    Rgds,

    Jocelyn

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 18, 2013 at 07:26 AM

    Hi Manas,

    I agree with Rick - you want to work with the standard behaviour not against it. So you create a workflow that deals with each release code. And you use the release strategy with classification to control which and how many release codes are relevant to the purchase order. I have seen workflows based on PO created and changed, and it can get pretty ugly if you start working against the way the PO application wants to work.... spaghetti workflow anyone?!

    Rgds,

    Jocelyn

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 18, 2013 at 10:51 AM

    Hi Manas,

    In case if this issue still exists, you could probably try this...worked for me.

    As Ragav has suggested implement a check FM where you will call FM 'BAPI_PO_GETRELINFO' to get all release codes in the release strategy for the PO in the assigned sequence. Then check if the event's container element 'RELEASECODE' has the same value as that of the first release code in the release strategy. If not then Raise a meaningful exception.

    Here's the ABAP in the check FM...

    FUNCTION Z_MM_CHECK_FM_PO_WF.
    *"----------------------------------------------------------------------
    *"*"Local Interface:
    *" IMPORTING
    *" VALUE(OBJTYPE) LIKE SWETYPECOU-OBJTYPE
    *" VALUE(OBJKEY) LIKE SWEINSTCOU-OBJKEY
    *" VALUE(EVENT) LIKE SWETYPECOU-EVENT
    *" VALUE(RECTYPE) LIKE SWETYPECOU-RECTYPE
    *" TABLES
    *" EVENT_CONTAINER STRUCTURE SWCONT
    *" EXCEPTIONS
    *" ANY_EXCEPTION
    *" RELEASE_CODE_NOT_FIRST
    *"----------------------------------------------------------------------

    CONSTANTS: gc_objtype TYPE swetypecou-objtype VALUE 'BUS2012',
    gc_event TYPE swetypecou-event VALUE 'RELEASESTEPCREATED',
    gc_element TYPE swc_elem VALUE 'RELEASECODE'.

    DATA: gt_rel_final TYPE TABLE OF bapirlcopo,
    gs_rel_final TYPE bapirlcopo,
    gv_relcode1 TYPE relcode1,
    gv_swc_relcode TYPE swc_value.

    IF objtype = gc_objtype AND event = gc_event.

    ***Get the sequence of release codes from config
    CALL FUNCTION 'BAPI_PO_GETRELINFO'
    EXPORTING
    purchaseorder = objkey(10)
    TABLES
    release_final = gt_rel_final.
    READ TABLE gt_rel_final INTO gs_rel_final INDEX 1.
    READ TABLE event_container WITH KEY element = gc_element.
    gv_swc_relcode = event_container-value.

    IF gv_swc_relcode NE gs_rel_final-rel_code1.
    RAISE release_code_not_first.
    ENDIF.


    ENDIF.

    ENDFUNCTION.

    Best...

    Vipin

    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.