Trigger workflow when a record is created in a database table

By Swarna S, Tata Consultancy Services

This document shows step by step process for the creation of a business object, table maintenance events and linking them to workflows in the SAP system.

Also this document shows how to integrate the business object created with SAP workflow.

Business objects are of two types

v  With Super Type

v  Without Super type

Business Object with Super type

  • In this case the BO refers to a standard BO already existing in the SAP system.
  • We create our own BO with by coping the existing standard BO .
  • Let’s suppose we have a BO BUS2014 which is Purchase contract. Now if I want to add my own attributes /methods in addition to the standard, I will create ZBUS2014 which has all the items in BUS2014 plus my own attributes and methods. In this case BUS2014 is called Supertype of my BO ZBUS2014.

Business Object without Super type

  • Here my BO is completely customized. It does not refer to any standard BO available in the SAP system.
  • Now in the slides down we will see step by step approach to create a BO without a supertype.

Scenario

We have a Z table by the name ZEMPDETAIL. This table has three fields, Employee Number (PERNR), start date(BEGDA) and end date(ENDDA).Whenever a record is entered in this table ,the start date (BEGDA) should be saved as the sy-datum (current date) automatically and mail should be triggered stating that a new entry has been created into the table to a particular user .

We will first see the creation of the table and its table maintenance step by step

1.)   The table is created as per the below screenshot via SE11.

zempdetail1.jpg

2.)   The table maintenance is also created for the table in the same transaction

zempdetail2.jpg

3.)   Once the table maintenance is created, an event is linked to it.

zempdetail3.jpg

4.)   There are many events available for table maintenance and we will choose the event  “create new entry” to suit a purpose and write a code for the same

5.)   Now we write a routine / code for that event.

zempdetail4.jpg

6.)   The code is to change the start date to sy-datum and create an event using the function module SAP_WAPI_CREATE_EVENT. Once the event is created it is linked to workflow.

zempdetail5.jpg

Now the table part is over. We will see the step by step approach to create a business object and the linkage to a workflow.

Step 1 – Creating a business object

       Go to the Transaction SWO1.

BO1.jpg

Step 2 – Create the object type by giving the details

swdd3.jpg

Click here to continue...

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image