cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Event not getting Triggred

Former Member
0 Kudos

Hello Experts,

I have created a custom Event ZCREATED in ZBUS2105 (Subtype) by copying BUS2105, I have saved and released it. Then maintend change document for BANF in SWEC T-CODE. Also maintained deligatoin in SWO6 T-Code.

But still the event is not getting triggered on Purchase Requisition create. It works fine when I test it from SWUE t-code.

What needs to be done for resloving the issue. Please suggest

Thanks in Advance,

Sandhya.

Accepted Solutions (0)

Answers (4)

Answers (4)

surjith_kumar
Active Contributor
0 Kudos

Hi Sandhya,

When you Trigger via SWUE this event triggering, but when you created PR this not triggering.

It will be one of the Following Reason,

1) Badi is not activated

2) Key Value is not Passed to Trigger.

Check you [Badi |; coding.

Regards,

Surjith

former_member184495
Active Contributor
0 Kudos

Hi SV,

one question, was there any other purpose for creating the ZCREATED event as BUS2105 already has RELEASESTEPCREATED event and generally you create an event CHANGE since BUS2105 doesnt have a change event.

Hope you have implemented your BOR and clicked the Generate button.

Hope it helps.

Aditya

Former Member
0 Kudos

Hi Adithya,

Problem with the event RELEASESTEPCREATED is that its not getting triggered when a PR is created. I need to trigger an event when ever a PR is cereated. For that reason I have created a custom event, I have generated my Z object in BOR. Event work's fine from SWUE T-Code. But its not getting triggred on a PR create.

Thanks,

Sandhya

former_member193382
Active Contributor
0 Kudos

Hi Sandhya,

below is the code that i used to trigger the PR workflow.

Hope it works for you as well. Copy and customize the code as per your requirement.

I used this code in enhancing the BADi ME_REQ_POSTED.

METHOD IF_EX_ME_REQ_POSTED~POSTED.

  • DATA : RE_DATA TYPE MEREQ_HEADER.

  • IF SY-TCODE = 'ME51N' OR SY-TCODE = 'ME52N' .

  • CALL METHOD IM_EBAN->GET_DATA

  • RECEIVING

  • RE_DATA = RE_DATA.

  • ENDIF.

DATA: WA_EBAN TYPE EBAN.

DATA L_S_EBAN TYPE UEBAN.

LOOP AT IM_EBAN INTO L_S_EBAN .

ENDLOOP.

DATA: OBJKEY TYPE SWEINSTCOU-OBJKEY .

  • BREAK-POINT.

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

IF ( L_S_EBAN-BSART = 'ZRAS' OR L_S_EBAN-BSART = 'ZRCG' OR L_S_EBAN-BSART = 'ZREC' OR L_S_EBAN-BSART = 'ZRFS' OR L_S_EBAN-BSART = 'ZRIM' OR L_S_EBAN-BSART = 'ZRLC' OR

L_S_EBAN-BSART = 'ZROC' OR L_S_EBAN-BSART = 'ZRPC' OR L_S_EBAN-BSART = 'ZRRM' OR L_S_EBAN-BSART = 'ZRPM' OR L_S_EBAN-BSART = 'ZRPR' OR L_S_EBAN-BSART = 'ZRPU' OR

L_S_EBAN-BSART = 'ZRQS' OR L_S_EBAN-BSART = 'ZRSS' OR L_S_EBAN-BSART = 'NB' ).

OBJKEY = L_S_EBAN-BANFN.

  • IF SY-TCODE = 'ME51N' .

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 = 'RELEASESTEPCREATED'

COMMIT_WORK = 'X'

EVENT_LANGUAGE = SY-LANGU

LANGUAGE = SY-LANGU

USER = SY-UNAME.

ENDIF.

  • ENDIF.

IF SY-TCODE = 'ME52N' OR SY-TCODE = 'ME53N' .

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

EXPORTING

OBJECT_TYPE = 'BUS2105'

OBJECT_KEY = OBJKEY

EVENT = 'SIGNIFICANTLYCHANGED'

COMMIT_WORK = 'X'

EVENT_LANGUAGE = SY-LANGU

LANGUAGE = SY-LANGU

USER = SY-UNAME.

ENDIF.

  • IFS_XML_CONTAINER =

  • IMPORTING

  • RETURN_CODE = return_code

  • EVENT_ID = event_id

  • TABLES

  • INPUT_CONTAINER = INPUT_CONTAINER

  • MESSAGE_LINES = MESSAGE_LINES

  • MESSAGE_STRUCT = MESSAGE_STRUCT

.

ENDIF.

ENDIF.

  • DATA : LINES11 TYPE TLINE ,"OCCURS 0 WITH HEADER LINE,

  • DESNO TYPE TLINE-TDLINE,

  • DESNO1 TYPE TLINE-TDLINE,

  • DESNO11 TYPE TLINE-TDLINE,

  • EN TYPE THEAD-TDSPRAS,

  • TDNAME(70) TYPE C," LIKE THEAD-TDNAME,

  • OBJECT TYPE THEAD-TDOBJECT,

  • ID TYPE THEAD-TDID.

  • DATA: LINES1 TYPE STANDARD TABLE OF TLINE.

  • DATA: LINES2 TYPE TLINE.

  • DATA: DESTINATION1 TYPE STRING .

  • DATA: DESTINATION11 TYPE STRING .

  • DATA: DESTINATION111 TYPE STRING .

  • data: st type string.

  • LOOP AT IM_EBAN INTO L_S_EBAN .

    • ENDLOOP.

*

  • CONCATENATE L_S_EBAN-BANFN L_S_EBAN-BNFPO INTO TDNAME.

  • .

*

    • TDNAME = L_S_EBAN-BANFN.

  • OBJECT = 'EBAN'.

  • ID = 'B01'.

  • EN = 'EN'.

*

  • CALL FUNCTION 'READ_TEXT'

  • EXPORTING

  • CLIENT = SY-MANDT

  • ID = ID

  • LANGUAGE = EN

  • NAME = TDNAME

  • OBJECT = OBJECT

  • TABLES

  • LINES = LINES1

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8.

*

    • DELETE LINES1 WHERE TDLINE IS INITIAL.

  • LOOP AT LINES1 INTO LINES2.

  • IF LINES2-TDLINE = ' '.

  • CONTINUE.

  • ELSE.

  • DESNO = LINES2-TDLINE.

  • CONCATENATE DESTINATION1 DESNO INTO DESTINATION1.

    • MOVE DESNO TO DESTINATION1.

*

    • EXIT.

  • ENDIF.

  • ENDLOOP.

    • IT_LG-VBELN = TDNAME.

    • IT_LG-LRNO = DESTINATION1.

  • DATA: LI TYPE I.

  • CONDENSE DESTINATION1 NO-GAPS.

  • LI = STRLEN( DESTINATION1 ).

  • IF LI <= 0.

*

  • concatenate 'Item Text Is Missing for Line Item ' L_S_EBAN-BNFPO into st.

  • MESSAGE st TYPE 'E'.

*

  • ENDIF.

  • FREE LINES1.

  • FREE DESNO.

  • FREE DESTINATION1.

  • REFRESH LINES1.

  • CLEAR LINES1.

  • CLEAR DESNO.

  • CLEAR DESTINATION1.

  • ENDLOOP.

ENDMETHOD.

let me know if you still have any queries.

Regards,

Raj

Former Member
0 Kudos

Hi,

Did you check the Event Simulation ? (SWU0)

Former Member
0 Kudos

Hi Umakanth,

I have executed Event Simulation via SWUO, but still Event is not getting triggred.

Thanks,

Sandhya

former_member193382
Active Contributor
0 Kudos

Hi Sandhya,

Did you try using the BADi and the code as said earlier?

Regards,

Raj

Former Member
0 Kudos

Hi Raj,

Thanks for still traking my issue's. I have never used BADi and pretty new to them. It would be very helpfull if you can take me thru in using them.

I have seen the BADi in SE18 T-Code but donno how to use it.

Thanks in advance,

Sandhya.

former_member193382
Active Contributor
0 Kudos

Hi Sandhya,

As far as implementing a BADi is concerned you can take the help from screenshots given in saptechnical.com. Also try searching on SDN itself. You will get enough material.

Revert if you have any queries.

Regards,

Raj

former_member193382
Active Contributor
0 Kudos

Hi Sandhya,

As i said yesterday, use the BADi, Me_REQ_POSTED.

In that use the FM SAP_WAPI_CREATE_EVENT or SWE_CREATE_EVENT.

pass your BO name and event name to this FM also with the object key

This is sample code below.

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

EXPORTING

OBJECT_TYPE = 'BUS2105'

OBJECT_KEY = OBJKEY

EVENT = 'RELEASESTEPCREATED'

COMMIT_WORK = 'X'

EVENT_LANGUAGE = SY-LANGU

LANGUAGE = SY-LANGU

USER = SY-UNAME.

ENDIF.

let me know if you have any queries.

Regards,

Raj