cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow triggers from SWUE and not from ME51N.

suresh_subramanian2
Active Contributor
0 Kudos

Dear all,

I have created a purchase requisition IDoc generation workflow which triggers from SWUE and behaves as expected.But, it is not triggering from ME51N.No entries are seen in SWEL(Trace is switched on at SWELS).I am using BUS2105 with event created and changed.

For the event CHANGED, the workflow behaves as expected from ME52N.

Business object is properly released and generated.Change document 'BANF' at SWEC is selected.In SWED, it was not checked for 'On Create'.So, I manually checked it.Is it O.K ?

Event linkage is active.No start condition/check function module is with workflow.

The BAdI which is used to trigger the workflow is ME_REQ_POSTED.It's implementation is active.

I checked at SWU2,SM58,ST22 and SM21.There is no entry in these transactions.I refreshed buffers at SWU_OBUF and PPWFBUF.

When the workflow triggers from SWUE for the event CREATED ,why it is not triggering from ME51N ?

Please help me to trigger the workflow from ME51N for which I will be grateful forever.

Regards,

S.Suresh

Accepted Solutions (0)

Answers (1)

Answers (1)

suresh_subramanian2
Active Contributor
0 Kudos

Dear all,

Thanks a lot for reading my post with intention to answer.

The issue is resolved now.

The problem was at BAdI.To trigger the workflow with event CREATED for purchase requisition, BAdI named ME_REQ_POSTED needs to be used :

Following coding is used for the same :

method IF_EX_ME_REQ_POSTED~POSTED.

  DATA: WA_EBAN TYPE EBAN.
  DATA L_S_EBAN TYPE UEBAN.
  DATA: OBJKEY TYPE SWEINSTCOU-OBJKEY .

  LOOP AT IM_EBAN INTO L_S_EBAN .
  ENDLOOP.

    IF ( SY-TCODE = 'ME51N' AND SY-UCOMM NE 'MECHECKDOC' ) OR SY-TCODE = 'ME52N'  .

      IF  L_S_EBAN-BSART = 'ZNB'.
        OBJKEY = L_S_EBAN-BANFN.

        SELECT SINGLE * FROM EBAN INTO WA_EBAN WHERE BANFN EQ OBJKEY.

        IF SY-SUBRC NE 0.

          CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
            EXPORTING
              OBJECT_TYPE             = 'BUS2105'
              OBJECT_KEY              =  objkey
              EVENT                   =  'CREATED'
             COMMIT_WORK             = 'X'
             EVENT_LANGUAGE          = SY-LANGU
             LANGUAGE                = SY-LANGU
             USER                    = SY-UNAME
*   IFS_XML_CONTAINER       =
* IMPORTING
*   RETURN_CODE             =
*   EVENT_ID                =
* TABLES
*   INPUT_CONTAINER         =
*   MESSAGE_LINES           =
*   MESSAGE_STRUCT          =
              .
        endif.

      endif.

    endif.

   endmethod.

I have missed the loop block.That's why the workflow was not triggering.

Regards,

S.Suresh

former_member185167
Active Contributor
0 Kudos

Thankd for the follow-up. Please mark the question as Answered.