{"id":11,"date":"2018-08-19T18:25:50","date_gmt":"2018-08-19T18:25:50","guid":{"rendered":"http:\/\/www.sapforbeginners.com\/blog\/?p=11"},"modified":"2018-08-19T18:30:41","modified_gmt":"2018-08-19T18:30:41","slug":"how-to-schedule-a-background-job-by-triggering-an-event","status":"publish","type":"post","link":"https:\/\/www.sapforbeginners.com\/blog\/how-to-schedule-a-background-job-by-triggering-an-event\/","title":{"rendered":"How to schedule a Background Job by triggering an Event"},"content":{"rendered":"\n<p>In this blog post let us take a look on how we can schedule a <em>Background Job<\/em> using <em>Event<\/em> as trigger. <\/p>\n\n\n\n<p>First let us maintain an <em>Event<\/em> in SAP using transaction \u201cSM62\u201d which will be used as trigger to schedule the Job.<\/p>\n\n\n\n<p> Open transaction \u201cSM62\u201d and create an <em>Event<\/em> with some name by pressing \u201cCreate\u201d button under \u201cBckPrcEvnts\u201d tab and save the <em>Event<\/em>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"424\" src=\"http:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image.png\" alt=\"\" class=\"wp-image-12\" srcset=\"https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image.png 624w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-300x204.png 300w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-580x394.png 580w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-320x217.png 320w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p> Now we have created an <em>Event<\/em> with name \u201cZ_TRIGGER_BGJOB\u201d which can be triggered using the standard <em>Function Module<\/em> \u201cBP_EVENT_RAISE\u201d. You can create an ABAP program to trigger the <em>Event<\/em>. To demonstrate this example, I have created a sample custom program \u201cZTRIGGER\u201d which uses the <em>Function Module<\/em> \u201cBP_EVENT_RAISE\u201d to trigger the <em>Event<\/em> \u201cZ_TRIGGER_BGJOB\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"487\" src=\"http:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-1.png\" alt=\"\" class=\"wp-image-13\" srcset=\"https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-1.png 624w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-1-300x234.png 300w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-1-580x453.png 580w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-1-320x250.png 320w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p> Now we have an <em>Event <\/em>and a program which can trigger the Now let us create a <em>Background Job<\/em> and schedule its execution using <em>Job Control Parameters<\/em>. <\/p>\n\n\n\n<p> We can create a Background Job using the transaction \u201cSM36\u201d, give a Job name and class and click on \u201cEnter\u201d where a popup window appears asking for the program and variant for which the job should be scheduled.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"586\" height=\"422\" src=\"http:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-2.png\" alt=\"\" class=\"wp-image-14\" srcset=\"https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-2.png 586w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-2-300x216.png 300w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-2-580x418.png 580w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-2-320x230.png 320w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"blob:http:\/\/www.sapforbeginners.com\/e6ef9511-ad75-4e3b-8d2f-de032c8f40c3\" alt=\"\"\/><\/figure>\n\n\n\n<p>Now save it and come back, you must be seeing a message saying \u201c1 Step(s) successfully defined\u201d, Now we need to mention the \u201cStart Condition\u201d for the job that we have just defined where we will be using the Event we have created as a trigger to schedule this job.<\/p>\n\n\n\n<p> Once you click on \u201cStart Condition\u201d following popup window appears, Just hit on the \u201cAfter Event\u201d button which will input enable the Event and Parameter Input options. Give Event details in Event Input Parameter and press \u201cSave\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"572\" height=\"519\" src=\"http:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-4.png\" alt=\"\" class=\"wp-image-16\" srcset=\"https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-4.png 572w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-4-300x272.png 300w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-4-320x290.png 320w\" sizes=\"auto, (max-width: 572px) 100vw, 572px\" \/><\/figure>\n\n\n\n<p>That is all, Now let us test whether the Background Job is scheduled after triggering the Event and again finally press the \u201cSave\u201d button again to save. Execute the program \u201cZTRIGGER\u201d and check whether the Job has been scheduled or not in \u201cSM37\u201d transaction.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"683\" src=\"http:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-5.png\" alt=\"\" class=\"wp-image-17\" srcset=\"https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-5.png 624w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-5-274x300.png 274w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-5-580x635.png 580w, https:\/\/www.sapforbeginners.com\/blog\/wp-content\/uploads\/2018\/08\/image-5-320x350.png 320w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Schedule background jobs in SAP with an &#8220;Event&#8221; as &#8220;Start Condition&#8221;.<\/p>\n","protected":false},"author":1,"featured_media":19,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[6],"class_list":["post-11","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-abap","tag-event"],"_links":{"self":[{"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":4,"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":23,"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/posts\/11\/revisions\/23"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/media\/19"}],"wp:attachment":[{"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sapforbeginners.com\/blog\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}