cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow - with background job - based on data in custom tables

Former Member
0 Kudos

Hi Experts/Guru's,

How to create a workflow, which should run a background job where it has to monitor custom table for every 5mins and i have to send mails(to different  level) using deadline monitoring?


I will send mail based few fields data in custom tables.

Do i need to create a container here ?

How do i create a background job for a workflow?

Can i determine ,mail id's in runtime(based on my validation?) ? (I will maintain them in my custom table)

Firstly i am very new to workflow and secondly i approached in below way before posting my query here in forum.

1.Created custom tables with required fields and with relationships.

2.Created a Function module, to retrieve data from my custom tables.

Now here i have a query -

Do i need to create Business Object with

1.Interfaces

2.Key fields

3.Attributes

4.Methods

5.Events

Or with just

1.Key fields

2.Method

3.Event

Can you someone pls guide/suggest.

Regards,

Karthik Rali

Accepted Solutions (1)

Accepted Solutions (1)

former_member185167
Active Contributor
0 Kudos

Hello,

"How to create a workflow, which should run a background job where it has to monitor custom table for every 5mins and i have to send mails(to different  level) using deadline monitoring?"

What is in this custom table, why does it need to be monitored every 5 minutes and what is in these proposed emails?

If you want emails sent every time a particular change happens in the table then you could use SWEC to create an event (which starts the workflow) instead of doing constant monitoring.

regards

Rick Bakker

Answers (5)

Answers (5)

Former Member
0 Kudos

Hey Expert's/Guru's

Sorry for not responding to your valuable suggestion as am on out office for couple of weeks.

Coming back to thread i have started ...we are trying to a prototype for a ticketing system and my lack of awareness on configuring workflow's for a BO all added in starting of this thread(as i mentioned i just started with SAP Workflow). But as still my work on Workflow is pending.

I working on SAP Workflow Basics(Please suggest me incase you know any tutorials).

Hope i will cross all the hurdles with guidance of all experts and guru's in time of need.

Thanks (Pradyp Parakala  Asif Pathan Rick Bakker Ibrahim Ansari Rob Dielemans Modak Gupta)for your suggestions once again.

Regards

Karthik Rali.

I042439
Employee
Employee
0 Kudos

Hi Karthick

Did you try the above suggestions?

Why over-engineer and burden the background work process? 🙂

You have already received so many good sugestions:

Send mail from the very prog which is updating the entries - no need for workflow (or troubleshooting workflow if things aren't working)

OR

Trigger custom workflow events only when workflow is required to start

OR

Use change Documents for your fields and trigger workflow based on Change Docs (SWEC)


former_member186746
Active Contributor
0 Kudos

Hi,

this requirement smells wrong.

If it is a custom table, then probably there is a custom way of populating said table. So just fire a created/changed/deleted event for a custom BO/Class with your custom flow as receiver.

Or. if this is just email, just directly send an email from the transaction where you are maintaining this custom table.

Kind regards, Rob Dielemans

Former Member
0 Kudos

Hi,

I would suggest not to use workflow just for sending emails. The program which you are using for monitoring i.e. which you are scheduling in background can be used for sending emails also.

We use workflow templates if some action/decision is required from agent/user/manager.

workflow is sometime mistaken for sending emails but this is not correct. workflow shold not be deisgned just for sending emails.

Regards,

Ibrahim

Former Member
0 Kudos

Hi Karthik

Correct me, if im wrong in understanding u.. As per my knowledge, the workflow will only complete the Set of Tasks which we place in each steps. Normally after the workflow is completed we run the Program to which Background job is already defined. But in your case the background job has to be run automatically after the workflow is finished & also it must store the data to the particular custom tables. but i don't think so if such is the case the workflow can run/update it. Its a separate activity which u need to take help from ABAP team where they can do some program & build a logic once the workflow is finished. so, then it will be working with the workflow simultaneously.

lets see what our experts has to say on this..

Cheers

Pradyp

Former Member
0 Kudos


Pradyp,

Thanks for replying back.

My scenario is...the table should be monitored continuously with the help of a background job and according to my validation Workflow has trigger and send mail ,if there is a certain difference between few fields( which is key for send mails at multiple levels ) .

I don't much about Workflow(am still in crawling stage) if this can be achieved via background monitoring.

Regards,

K

Former Member
0 Kudos

Hi Karthik,

As per my understanding to your problem - I would suggest create a WF which will have:

1) an activity step wherein it will validate custom table fields.

2) wait event step, to wait for 5mins before validating table fields

3) Send email step

4) Loop step. to loop back to the activity step once you have sent the email. However, keep in mind there should be some exit condition for this loop, else the WF will keep running in never ending mode.

This activity step should have exporting parameters (as per your requirement). Before this activity step, have an event wait step (say for 5mins), so the WF will wait for 5mins before validating the custom table field changes. Once 5mins have passed, the activity step will validate and export the parameters which you may want to used sending the email. It will be better to pass a flag as an exporting parameter from the activity step, which may be used an indication to see if sending email is required or not.

Hope this helps !

Asif

Former Member
0 Kudos

Hi Karthik

Yes the system will update the tables via Background job. the only thing is that u need to schedule the correct program name with variant saved for the Background job with proper frequency time.

for ex: when the workflow is set complete the table for which the program name is set will automatically run the job & update the data.

you can find the program name on the screen by selecting SYSTEM---> STATUS from menu. If u save the same screen then u get another screen to save the variant name for that screen. now  provide the same program name with variant name to Basis team to create a job & set a time/frequency to run the job. now when they set the job.. the system will automatically update the data after the workflow is done.

Regarding sending mails at multiple level, In workflows we define two level approvals & where system finds a logic as (sender= Initiator) & (Reciever = Approver). this data will be taken from Reporting structure & workflows reads the data based on that and it flows accordingly. where for each user name we maintain mail Id's in HR master data. so we also check the mail status in 'SOST' parallelly we can also check in SBWP with the corresponding user whether the workflow has been received to the appropriate manager or not.

If u r a ESS/MSS user then check in Manager's UWL & external mail Id which is maintained in the system.

Hope I cleared ur doubt

Cheers

Pradyp