cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to create a workflow dealing with customizing program(Add-on program)

Former Member
0 Likes
308

Dear ALL,

I am new to workflow and I was assigned to create a workflow related to an customizing program(Dynpro screen).

I know we can refer to some std. template for workflow developing.

However, I don't know how to create a brand new workflow to deal with the add-on program and table.

My major difficulty is how to create a new object:

--How to create the new event to track the operation of add-on program, for example, push 'submit' button.

--How to create method to update the add-on table.

I do hope someone could give me some guidance.

Thank,

Gary

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

You can check the sy-ucomm value and create a event by using Function Module SWE_EVENT_CREATE. Create a Business object with relevant key fields. Create an event that will be triggered by this FM. Now you need to create Workflow Template by going to Transaction Code PFTC.

<b>Please reward points if useful</b>

Thanks

Arghadip

Former Member
0 Likes

Thank you very much for your help.

However, as I am new to wf, I need more detail things.

If you can show me an example document, it will be great.

Regards,

Gary

Former Member
0 Likes

This is a Function Module that triggers an event ob Business Object tht you will create by making a subtype of Business Object. Use Transaction Code SWO1 to do so.

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.

SWEL Transaction Code is used to track event linkage.

SWUS is used to test Workflow manually with single test.

<b>Please reward points if useful</b>

Thanks

Arghadip

Answers (1)

Answers (1)

KjetilKilhavn
Active Contributor
0 Likes

You should start by reading the Wiki for frequently asked & answered questions, and you should probably also get help from someone with a little bit of experience. If you don't, you will almost certainly create something that will be hell to maintain.

If you feel up to it you can of course try alone. The wiki has some answers that may be useful for you, and there is also a book mentioned there (the Bible for everyone working with SAP Business Workflow) which can help you get started.

When you get stuck, or want advice, come back here with more specific questions. And as the Wiki reminds you, give sufficient information about your problem, including your SAP release, to enable others to help you without shooting too much in the dark.

Former Member
0 Likes

Actually I have read the FAQ and so many other materials.

Here, I just want to read some examples to create such kind of custom BO and event.

Regards,

Gary