‎2009 Jan 26 7:02 AM
Hi,
I have a requirement to start workflow when table entry or modification is made. And in one has to authorize for the data. then only data should be saved in data base. if manager rejects data should not be saved in data base.
What i have done till now is i have generated a table maintainence and created and new (using business objects )event to raise. (writing a FORM). So when ever we create new table entries event is raised. And i am using this event to trigger my workflow.
I have two problems
first one. this event is only getting trigged if i make entry to table through se11 and create new entries option. if i am using a program to update the table then event is not getting trigged. Is there way i can make this event to trigger even if i insert data to this table from any where?
Second problem
i want to complete my workflow. based on manager decision only database should be commited or rolled back.
if any one needs further details regarding problem reply.
Thanks in advance
Mohan
‎2009 Jan 26 11:34 AM
Mohan,
Your data has already been commited to the database by the time the manager gets the work item. If they reject the change then you can call a method to delete the data from the database. If this is a problem, you might think about having 2 tables. One prior to approval by the manager, and one if the data is approved.
How did you set up your event?
Michelle
‎2009 Jan 27 7:59 AM
Hi,
For the first problem, if you use the FM :- SWE_EVENT_CREATE, I think, the issue can be solved.
For the second problem, if it is a custom program, why don't you use commit or roll back, after checking the approver decision?
Regards,
‎2009 Jan 27 2:27 PM
Hi,
I also think you should use a temporary table where you store the data you want to insert into the database before the approval is done. You create the maintenance view on this temp table and start the workflow from there. Once manager approves the new entry / change, workflow automatically updates the permanent table and deletes the record from the temp one.
You can use the change documents, maintenance view event routines or maintenance view screen logic to trigger the WF. But I`m not aware of any tools to capture a database change done by a direct update, so if you also have programs directly updating the database table, you have to trigger the workflow start event explicitely in those as well.
Regards,
Krisz
‎2009 Jan 28 6:16 AM
HI all,
Thanks for the reply. Yes having a temporary table will solve one issue. But for the other issue like if we update table from a program then i think we need to trigger event for that program as well. Still i am sure there should be some way where all updates will go through a form routines.
Michelle,
I have created event like this.
go to table maintainence generator. Environment>modification>events
create new event. with option before database changes give new form name. with in form call the function module to create event SWE_EVENT_CREATE.
Still looking for better ways of doing this.
Thanks and Regards
Mohan
‎2009 Jan 28 11:57 AM
Mohan,
In your program to update the table, you can call the FM to create the event. Or you can call FM SWW_WI_START to start your workflow without the event.
It sounds like you already are successfully starting your workflow during an SE16 or SM30 update.
Is the program that updates the table a custom (Z) program? If it is then adding the FMs to the code, should not be a problem.
If the program is not a custom program, which table is it?
Michelle
‎2009 Feb 02 4:58 AM
Michelle,
Thanks for the reply. Still i am not successful in triggering event from se16 and sm30. Don't know why it is looking at it. I am updating a Ztable with zprogram so yes i have to add code to trigger event or workflow.
Thanks
Mohan
‎2009 Feb 02 11:33 AM
Hi again Mohan,
Can you copy and past your code here? Maybe someone will be able to help.
Michelle