Here is a small post that explains the intricacies behind scheduling of background jobs for IC matching runs S4 HANA.
ICMR stands for Intercompany Matching & Reconciliation. This solution performs IC document matching operations and is based on components of the matching engine. IC matching does not happen by itself. You need to initiate it explicitly and SAP S4 HANA offers several options to do that.
First, there are several Fiori Apps, which allow ad-hoc processing i.e., triggering of a matching run as a one-time activity. The list of these Fiori Apps includes:
The last two entries are essentially the same Fiori app with different default filters. If the number of IC entities is limited, you can successfully use these Fiori Apps to manage the matching runs. If you have many IC entities and manage a big volume of IC operations, you should consider scheduling background jobs to automate this process. You can use one of the following two options to schedule background jobs:
Scheduling of background job for program ICA_MATCHING_RUN via SAP GUI t-code SM36.
In this post I’ll explore the options behind scheduling of background jobs. Normally, setting up a background job is not something I’d post about, because it is a regular mundane activity. But I realized that the programs for scheduling of these jobs are not exactly intuitive and definitely not user friendly. SAP Help article on this topic explained some obvious things, but did not answer all questions. The purpose of this post is to fill this knowledge gap.
Planning of a background job
Navigate to Fiori App F5011 and press “Create” button to initiate a new job:
Select the job template from the list. The list offers two templates: Matching Run and Matching Run for Consolidation. I’ll focus on regular IC matching run in this post.
Navigate to the second step. Active checkbox “Start Immediately” and press the appropriate button to define recurrence pattern:
In this step you can choose whether the job will be executed as a single run or periodically:
I’m setting up daily execution of the background job with an end date (optional attribute):
You can additionally influence the execution of the background job on non-working days. The options look obvious and do not need additional explanation:
Maintenance of the parameters so far has been easy. Now we come to the third step, where it becomes interesting. First, you should select the matching method e.g., ZF001. That was easy.
Then you should define a filter string. At this point, you start wondering what that is and what to do about it? The description of this field in standard SAP Help is superficial. Essentially, this is field where the user should define SQL-query that would be passed to the program for selection of the data for background job. Considering that a lot of solutions based on native Fiori Apps are generally user driven i.e., are based on setup of relatively simple and intuitive user rules, definition of SQL queries for background processing is a step back from modern to the stone age of automation. Let’s for now define a simple query, which is suggested by the standard documentation:
FISCYEARPER <= '2023005' AND (RCOMP BETWEEN '001000' AND '009999')
Essentially, we select for processing all transactional data that was:
posted before end of 5th posting period in 2023 fiscal year, and
involves all trading partners with IDs between 1000 and 9999.
Note that trading partner should be filled with leading zeros. That means if trading partner is defined as 1000 – you should pass it as “001000”. In case it is defined as IC1000, leading zeros are not necessary.
There are several ways to limit the number of IC entities for IC matching run. Three popular options are provided below. The first one was already explained above. The second option allows specifying a set of specific IC entities. The last option can be used to limit the selection to one IC entity.
FISCYEARPER <= '2023005' AND (RCOMP BETWEEN '001000' AND '009999')
FISCYEARPER <= '2023005' AND RCOMP IN ('001000', '002000', '003000')
FISCYEARPER <= '2023005' AND RCOMP = '001000'
Step 3 of the scheduling also provides advanced options. For example, IC matching run can also trigger follow-up actions (i.e., workflow instance or an adjustment posting). Data cutoff is another “user friendly” field which can be used to limit the selection of the data up to specific timestamp.
When you press the button “Schedule” the program will validate the parameters of the background job and SQL-query. If there is an error in the SQL-query, you’ll see generic error message, but without any recommendation or explanation. See an example below:
If there are no errors, you can go ahead and schedule the job.
Monitoring of background jobs
Once you scheduled the program, you can refresh the page and see the results:
When you press the “Results” button, Fiori will route you to HTML-version of SAP GUI and will display the resulting spool request. As you can see from the log, the program generated two matching documents in this run:
You can also use SAP GUI transaction SM37 to search for and monitor the background jobs for program ICA_MATCHING_RUN:
As you can see, the search results in several jobs. Background jobs with names that look like GUID-numbers are jobs that were scheduled via background processing in Fiori App. Background jobs with the name ICA_METHOD_ASYNC_RUN are the jobs that were triggered ad-hoc from the Fiori Apps F3862 or F3870, which were mentioned at the beginning of this post. In addition, if you’re scheduling the jobs via SM36, you might have jobs with other names that were defined in accordance with your project specific rules.
In general, I’d like to say that the set of native Fiori Apps that comprise ICMR solution in S4 HANA provide a lot of immediate & obvious value for your company. I’d even venture as far as to say that these apps provide “delightful & seamless” experience for end users. But among the beauty and elegance of this solution there are some aspects that cast a shadow overall the UX/UI concept. By that I mean the use of the filter string for the purpose of definition of SQL-queries. User-defined SQL-queries in production environment is not only a bad UX/UI approach, but also a valid security concern. By that I mean the potential to exploit this option for SQL-injection purposes. I’m not a big security expert, but as a consultant I’d avoid things like that at any cost.
Finally, I’d like to point out that the Fiori App F5011 is a really finely designed tool to schedule background jobs. If you forget about the filter string, it is intuitive and clear what to do and in which sequence. So far, I found only one feature that is available in SAP GUI (i.e., SM36), but is missing in Fiori. By that I mean that ability to schedule the background job under another i.e., technical user for background jobs. Other than that, this is a good improvement from SAP on the path to “Fiori first and only” approach.