Scheduling a Job in SAP with variant containing dynamic date parameter

//Scheduling a Job in SAP with variant containing dynamic date parameter

Scheduling a Job in SAP with variant containing dynamic date parameter

This tutorial contains a step by step guide on how you can define a variant containing a dynamic data parameter (let us say today + 1) and subsequently use it for scheduling a background job in SAP. This is especially useful for technical and basis team members. It is also useful for SAP functional consultants or someone who is just starting off and wants to have a first-hand information on how this is done. This plays an important role in some of our integration services (for example SAP Integration with Salesforce) to automatically send information to these applications.


Variant of a SAP program using dynamic date – Step by Step explanation

 

This step shows how you can set the dynamic parameter in the variant. For this example, I am using program RWPCHEADSMD. This program can also be launched using transaction WPC3 and transmit the changes in Product Catalog nodes (transaction WWM2) to a third-party application like an eCommerce application for instance like Magento.

How it works

 

SAP identifies the changes using the change pointer concept and WPC3 transaction reads from the change pointer table and sends only the changes. Let us say we have to schedule this in such a way that eCommerce application needs to get Catalog updates every day via a batch program in SAP. As you can see from the picture below, the date needs to be dynamic in this case. The program needs to have Final Date for Change Pointer to be set Today + 1 based on when the program has been executed.

 

Product Catalog Program for Sync

Now let’s look at how this dynamic variant can be created. For this I have launched SE38 transaction and in the selection screen, I have selected variants and clicked on change button as shown below. Remember, the ABAP program you selected must have selection screen to be able to do this.

ABAP Program Variant selection

 

Create a variant and give it a name and once you come to the next screen, click on attributes. Once you come to this screen, locate the date parameter for which you wanted to set the date dynamically. In this case, it is “Final Date for change pointer”. Set the selection variable attribute as D (Dynamic Date Calculation). After this, you can set the attribute, Name of Variable as “Current Date +/- ??? Days” as shown below.

 

Dynamic Dates proposed by SAP

You can enter the value for number of days in the prompt which appears in the next screen. In our case, we want this value to be 1. After finalization of the variant, my variant looks like below.

Greying out of date on SAP variant screen

As you can see the date is now greyed out. Now that we have created the variant, the easy part is the schedule this program.


How to schedule the job in SAP

 

For scheduling the job, you can look at the menu option on top and navigate to System->Services->Jobs-> Define Jobs. Alternatively, you can launch SM36 transaction code.

 

Scheduling job with variant

You can give the name of the job and using periodic button set the frequency of the job. After you have done this, click on steps and give the ABAP program name and select the variant we created in the first step. Once you save, you are all set and now SAP should be able to run the program using dynamic date at the mentioned frequency.

 

SAP Integration Services

We provide SAP integration services adhering to best practices. We build integrated portals which can communicate on a real-time basis with SAP. We also integrated popular platforms like Salesforce and Magento eCommerce with both Business One and ECC. We also acknowledge the growth in popularity of commercial open-source CRM solutions like SuiteCRM and SugarCRM. Reach out to us today and see how we can make a difference within your business context.

Spread the Wisdom
By | 2017-09-09T20:41:51+00:00 September 9th, 2017|SAP|0 Comments

About the Author:

Veon brings best in consulting and integration solutions on Salesforce, SugarCRM, and SAP. It is an innovative company which deals best of the breed solution using SOA based SAP Integration and commercial opensource solutions like SugarCRM, Magento and Wordpress. It helps small and medium enterprise become smarter.