In recent weeks, I have been getting a few questions on how to automate the period opening transaction OB52. My initial reaction was that this was surely information that was pretty widespread and easily found online. However, upon further investigation, I realize that there is not much information out there on this topic. In the few cases where there is information, it is normally commingled with the scheduling of transaction MMPV in the background, and it is sometimes difficult to untangle both requirements.
For those who are still unclear (I am sure that there are few) about the difference between MMPV and OB52, and easy explanation is that MMPV is for inventory-related transactions, while OB52 is for finance-related transactions (OB52 also contains an inventory-related category “M”, just to confuse things even further, but we’ll ignore that for now).
Here are the steps for automating OB52 as a background job.
First, create the selection variables:
- Go to transaction STVARV
- Click on the “Change” button (Pencil icon) and then the “Create” button (Paper icon)
- Enter a Parameter Name and Value as below:
This program will be changed dynamically by scheduling program RVSETDAT as a background job. Therefore you do not need to keep updating the values.
Next create the program variant:
- Go to transaction SE38 and enter program RFPERIOD_OPEN (by applying Note 1483900 you can use program RFOB5200).
- Enter the Company Code Variant, From Fiscal Year/Period and To Fiscal Year/Period for one or both time frames (just as you would do in OB52).
- Enter the Account Type (+) in the “Account Type/Wildcard” field Note, you will have to repeat this for each account type.
- Save your settings as a variant. When you get to the variant attributes screen, you need to make the period and year fields dynamic so that you do not need to repeat this every month/year. Therefore in the “Selection Variable” field, select “T” from the drop-down and in the “Name of Variable” field, select the relevant variable that coincides with the field, as shown below:
|Field Name||Selection Variable||Value|
Finally schedule the background job:
- Go to transaction SM36 and enter a job name
- Click on the “Start” condition, click on the Date/Time button and enter the date/time (e.g. first day of the new period) that you want the job to be scheduled for (make sure that the time scheduled, is after the time of the RVSETDAT job).
- Click on the “Period Values” button at the bottom of the screen and choose “Monthly” and save your settings. This will take you back to the prior screen where you should save your settings again.
- Click on the “Step” button and enter the program name “RFPERIOD_OPEN” and the variant you created in the “Name” and “Variant” fields, the save your settings.
Since the program RFPERIOD_OPEN allows only one value to be entered in the account type field, you will need to create at least six variants (for the “+”, “A”, “D”, “K”, ”M” and “S” values). This also means that you will need to create six steps in your background job to reflect each program variant. With Program RFOB5200 you can enter all account types at once in the variant and hence create only one step in the background job.