cancel
Showing results for 
Search instead for 
Did you mean: 

how to trigger custom event of custom BOR

sukhbold_altanbat
Active Participant
0 Kudos

Hi

I am new to Workflow, I have done very simple WF in which when new material is created notification mail is sent to owner. In this WF, I have used BOR: bus1001006 and assigned `created` event.

I want to try out custom BOR Object type instead of bus1001006 in same workflow... I am wondering how the custom event is triggered because when I start the workflow it expecting the custom event to be triggered... What is the procedure or solution for my requirement???

Thanks,

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

If your custom BO is truly custom - meaning not inherited from BUS1001006 (or any other Business Object) then you have a few approaches to consider. The Brute-Force method is to call function module SAP_WAPI_CREATE_EVENT. Odds are that with a custom BO, you've created the related Z-table(s), and have code where you could call this function module.

A less painful method would be to associate the triggering event to a change document using transaction SWEC.

Another method would be to associate the triggering event to a Status in Status Management using transaction BSVW.

If in your case the custom BO inherits from BUS1001006 then you could "Delegate" (menu path "Settings"->"Delegate" from initial screen of SWO1). Delegation essentially substitutes your custom BO where ever BUS1001006 is used and at the same time retains the inherent parent functionality. This means you can trigger your WF from BUS1001006.CREATED and at the same time utilize the Attributes and Methods of your custom BO.

For more information on Delegation, refer to:

http://help.sap.com/saphelp_erp2004/helpdata/EN/c5/e4adcc453d11d189430000e829fbbd/frameset.htm

Tom Carruth

Former Member
0 Kudos

check this:

http://www.saptechnical.com/Tutorials/Workflow/Workflow.htm

this has step-by-step process to be followed..

Former Member
0 Kudos

It is waiting for which step. Which task is getting executed in this step. Please be specific in your requirement. It si completely vague. Check the workflow Log from SWEL tCode.

Thanks

Arghadip

sukhbold_altanbat
Active Participant
0 Kudos

Hi Arghadip,

Thanks for fast response.

As you know that once workflow started, next step which is nothing but the sending the notification, has to wait until the event is triggered.

My doubt is in which way this event can be triggered?

Former Member
0 Kudos

The workflow is getting triggered by the triggering event you have triggered thru program now you do not need to put any Triggering event in your mail sending step. I hope you are using the same triggering event there also. If yes remove that. Do the binding in your send mail step properly. You can take help of standard Wflow WS20000050. Check the binding for send mail step.

<b>Reward points if useful and close thread when resolved</b>

sukhbold_altanbat
Active Participant
0 Kudos

If you see what I have written in my post, I just want to use custom BOR object type <b>instead of bus1001006</b>. If I use bus1001006, then its `CREATED` event can be triggered once new material is created since bus1001006 is standard BOR object type.

Now, We know that the custom BOR object type is NOT standard.

<b>How its event can be triggered???</b>

Advice: <a href="/people/ginger.gatling/blog/2007/09/11/creating-your-first-sap-business-workflow">/people/ginger.gatling/blog/2007/09/11/creating-your-first-sap-business-workflow</a>

Here she has given standard BOR object type (bus1001006).

Thanks,

Former Member
0 Kudos

have you read my first response properly. If you want to trigger the vent from MM01 transaction then you can either trigger it in a standard way(Event getting Triggered automatically). Now if you want to trigger any event apart from this you have to Code in User Exit of MM01. In the user Exit you have to write ur program of triggering event. Now you have to make a subtype of bus1001006 and create your custom Event. Now after that you can delegate the custom BO by using Settings->Delegates from SWO1.

If this does not suffice your requirement can you please tell me what you wish to do.

Former Member
0 Kudos

You have to trigger either by status management or through User Exit in which you have to code. You can trigger Event programatically by using FM SWE_EVENT_CREATE.

You can check the code below

FUNCTION zwf_process_trip.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(I_EMP_NUMBER) TYPE PERNR_D

*" VALUE(I_EMP_TRIP) TYPE REINR

*"----


INCLUDE <cntn01> .

DATA:i_emp_details TYPE STANDARD TABLE OF p0001, "Employee Details

wa_request TYPE p0001, "Workarea for Employee details

v_country_grp TYPE molga, "Country SubGrouping

v_object_key TYPE sweinstcou-objkey. "Key for the buisness object ZWOBUSTRIP

CONSTANTS: c_bo_trip TYPE swo_objtyp VALUE 'ZWOBUSTRIP',

c_event_trip TYPE swo_event VALUE 'TripCreate',

c_infy_type_1 TYPE infty VALUE '0001'.

  • Event Container declaration

swc_container i_event_cont.

swc_create_container i_event_cont.

  • Reading the INFO TYPE 0001 to obtain the

  • Employee details

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

pernr = i_emp_number

infty = c_infy_type_1

begda = sy-datum

endda = sy-datum

TABLES

infty_tab = i_emp_details

EXCEPTIONS

infty_not_found = 1

OTHERS = 2.

  • SY-SUBRC check is not required as the error

  • handelling will be done by WorkFlow rule

  • resolution.

CLEAR wa_request.

READ TABLE i_emp_details INTO wa_request INDEX 1.

IF sy-subrc = 0.

  • Retrieving the Country SubGrouping for the employee

SELECT SINGLE molga

FROM t001p

INTO v_country_grp

WHERE werks = wa_request-werks

AND btrtl = wa_request-persk.

ENDIF.

  • Sending the relevant data to event container

swc_set_element i_event_cont 'EmpId' i_emp_number.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

swc_set_element i_event_cont 'PersonnelArea' wa_request-werks.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

swc_set_element i_event_cont 'CountryGrouping' v_country_grp.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

swc_set_element i_event_cont 'EmpSubGrp' wa_request-persk.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

swc_set_element i_event_cont 'EmpTripId' i_emp_trip.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

  • Raising the event to trigger the workflow

v_object_key = i_emp_number.

CALL FUNCTION 'SWE_EVENT_CREATE'

EXPORTING

objtype = c_bo_trip

objkey = v_object_key

event = c_event_trip

TABLES

event_container = i_event_cont

EXCEPTIONS

objtype_not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

COMMIT WORK.

ENDFUNCTION.

You can also check the following link

http://help.sap.com/saphelp_47x200/helpdata/en/8c/1923d1932b11d2a5ea0060087a79ea/frameset.htm

<b>Reward points if useful and close thread if resolved</b>

sukhbold_altanbat
Active Participant
0 Kudos

Hi Arghadip,

Thanks for the response...

I tried same way which you have explained. I have created a program in which I am calling FM SWE_EVENT_CREATE and providing the custom BOR object type, key & the event (which is assigned to the workflow). But the started workflow is still waiting (current status: In Progress) the event to be triggered...

Thanks,