Learn how to schedule the period closing transaction for Controlling (CO) using a new program.
Key Concept
RKCOOKP1 is a program that enables you to schedule the transaction for closing within Controlling (CO) as a background program in an SAP system. SAP has developed two enhancements for this program: RKCOOKP1_MORE and RKCOOKP1_MULTI. Normally the transaction for closing within Controlling (CO) is executed in the foreground using transaction code OKP1 (Maintain Period Lock). This transaction is used for both planning and actual CO transactions. Examples of CO transactions are cost center planning and actual settlements.
However, the disadvantage of this transaction is that mistakes can be made or it may be forgotten.
There is a little-known program that allows you to schedule this program as a background job. Program RKCOOKP1 is described in SAP Note 417041.
SAP has developed two enhancements for program RKCOOKP1:
- RKCOOKP1_MORE, which enables you to execute the closing for multiple years. It is described in SAP Note 1457107.
- RKCOOKP1_MULTI, which enables you to execute the closing for multiple years and multiple controlling areas. It is described in SAP Note 1781268.
These notes also show which Support Package contains which program.
In this article I first explain how the online transaction OKP1 for closing CO transactions works. This explanation of transaction OKP1 is required to understand how the background programs for closing in CO work. I also explain on a high level how the programs can be scheduled as background jobs.
In my examples I use the program RKCOOKP1_MULTI because it has the most options. You follow the same steps to set up the RKCOOKP1_MORE and RKCOOKP1 enhancement programs.
Understanding the Maintain Period Lock Transaction (OKP1)
To explain briefly how the Maintain Period Lock transaction works, I use Controlling Area 0001, the standard available SAP Controlling Area.
Execute transaction code OKP1 and follow menu path Accounting > Controlling > Cost Element Accounting > Environment > Period Lock. In the selection screen that appears (Figure 1), you must choose between Actual and Plan data. The Actual and Plan buttons are at the top of the screen. You also need to enter data in the Controlling Area and Fiscal Year fields. When you are entering plan data, you must also enter data in the Version field. When you finish entering the selection data, click either the Actual or the Plan button.

Figure 1
The Change Period Lock selection screen
After you click one of these buttons, the detail screen appears (Figure 2). In this screen you see a matrix that displays the CO transactions in the rows and the periods in the columns. The indicators at the intersection of the rows and columns show whether a CO transaction is closed for a specific period. If the indicator is selected, then the period is closed. For example, the CO transaction Actual cost center split is closed for all periods. Note that all CO transactions are also closed for period 01.

Figure 2
Indicators in the Change Actual Period Lock: Edit screen
At the top of the screen you see four buttons:
- Lock Period: locks the period for all CO transactions (e.g., period 01 has been locked using this button)
- Lock Transaction: locks a CO transaction for all periods (e.g., CO transaction Actual cost center split is closed for all periods using this button)
- Unlock Period: unlocks the period for all CO transactions. (It removes all indicators for a specific period.)
- Unlock Transaction: unlocks a CO transaction for all periods. (It removes all indicators for a specific CO transaction.)
After you finish setting and removing the desired indicators, you can save the data by clicking the save icon (not shown in Figure 2). After you save your data, you return to the selection screen.
Program RKCOOKP1_MULTI
The program RKCOOKP1_MULTI is the most extensive version of the program to be used for background closing of the controlling area. Depending on the status of your SAP ERP Central Component (ECC) system, you may have either program RKCOOKP1_MORE or program RKCOOKP1.
Start transaction SA38 or SE38 and enter program name RKCOOKPI_MULTI and execute the transaction. (This screen is not shown.) Figure 3 shows the selection screen of RKCOOKP1_MULTI. In program RKCOOKP1_MORE, you can only select one Controlling Area and only one plan version. In program RKCOOKP1, you can only select one Controlling Area, one plan version, and one fiscal year. Except for selecting more than one Controlling Area or selecting more than one version, the functionality of all three programs is the same.

Figure 3
The selection screen of RKCOOKP1_MULTI
The parameters of the selection screen of program RKCOOKP1_MULTI match the selection screen of the Maintain Period Lock transaction (OKP1). The main difference is the selection of the business transactions. The business transactions are the transactions that you see in the rows of the Change Actual Period Lock: Edit screen (Figure 2). However, instead of the description of the CO transactions, you need to select the codes used for these CO transactions.
In the Processing Options section at the top of Figure 3 are two radio buttons that match the Lock and Unlock buttons in Figure 2. When you select the Set lock radio button, you lock the combinations of the selected periods and selected business transactions.
At the bottom of the screen is an indicator called Endless Loop for Lock. If a user is using the Maintain Period Lock transaction (OPK1), then this user locks the period settings for the controlling area. When you set this indicator, the program waits until no other user is locking the period settings.
Warning!
If you do not enter a selection in the Controlling Area or Version field, then the program makes the settings for all controlling areas and versions. For actual data, the version setting is not relevant.
When you execute the program in the foreground by clicking the execute button or pressing F8, it displays a log of the settings made. Figure 4 shows an example of a log.

Figure 4
Log of program RKCOOKP1_MULTI
Schedule a Batch Job for Program RKCOOKP1_MULTI
To automate the closing within CO, you need to schedule a batch job for program RKCOOKP1_MULTI (or RKCOOKP1_MORE or RKCOOKP1 depending on your SAP release status). If you need to close part of the CO transactions at different times, you need to schedule more than one batch job.
To schedule the program RKCOOKP1_MULTI, you need to define a variant for the program. In this variant all variables except the period and year are fixed. The periods and years differ per period. To make a variable variant, you need to have entries in table TVARVC, which can be used in the variant. It can be handy to use special parameters for the period-end closing, especially if your fiscal periods do not use the Julian calendar.
To maintain table TVARVC online, use transaction code STVARV. This transaction code displays a screen in which you can add variables (Figure 5). At the top of the screen are the buttons to be used for maintenance. In table TVARVC there are four entries starting with ZCO_CLOSE that are to be used for the variant of program RKCOOKP1_MULTI.

Figure 5
Maintain variables for table TVARVC
You must create your own program to maintain the values in table TVARVC. In many companies there is already a custom ABAP program to maintain table TVARV and that program is running on a daily basis. Describing the contents of such a program is beyond the scope of this article.
After you ensure the creation and maintenance of the variables in table TVARVC, you can create the variant of program RKCOOKP1_MULTI. Execute transaction code SE38 (or SA38). In the screen that displays (not shown), enter the program name RKCOOKP1_MULTI and click the execute icon to run the program. Then enter all nonflexible variables and click the save icon to save the variables in a variant. This action opens the screen shown in Figure 6. Note that several columns in Figure 6 have been hidden to show only the variable data columns.

Figure 6
The detail screen for the variant program RKCOOKP1_MULTI
In the Selection variant column, you must enter a T to select a variable from table TVARVC. You cannot enter the T directly, but you need to use the search help to select it. After you place your cursor in a field in the Selection variant column, an icon appears. Click the icon to search for the T.
In the Name of Variable column, you enter the names of the variables that belong to the time fields. Also these fields can only be selected using the search help.
Note
Both columns are grayed out, so it seems as if you cannot enter any values. However, it is possible to enter values using the search help.
After you enter data in all the fields shown in Figure 6, save the variant by clicking the save icon.
After the variant has been created, you can schedule a batch job for the program RKCOOKP1_MULTI. Execute transaction code SM36 and in the Define Background Job screen (Figure 7), enter a name in the Job Name field.

Figure 7
Define a background job for closing within controlling
Click the Step button. In the next screen (Figure 8) enter the name of the program in the Name field. In the Variant field, click the icon and select the variant from the list of options. If you remember the variant name, you can enter directly in this field. Click the save icon (not shown) to save your settings and return to the main screen (Figure 7).

Figure 8
The details of the background job (step 1)
In the main screen click the Start condition button. In the pop-up screen that appears (Figure 9), click the Date/Time button to select a start date and time for the batch job. You can mark it as a periodic job by setting the relevant indicator. Click the Period values button to define the intervals you want for starting the job.

Figure 9
The start condition screen for batch jobs
Figure 10 shows the options for periodic jobs. In this case, you would click the Monthly button to run the background job monthly. However, if you don’t use the Julian calendar, you would choose Other period. The details of the periodic start conditions are beyond the scope of this article.

Figure 10
Period values for batch jobs
After all your settings have been finalized, save the background job by clicking the save icon.
Kees van Westerop
Kees van Westerop has been working as an SAP consultant for more than 25 years. He has an MBA degree in mathematics and a degree in finance. Kees has been concentrating on the financial modules, especially in general ledger accounting, cost center accounting, and consolidation. He also has a great deal of experience with rollouts of kernel systems and integrating finance and logistics.
You may contact the author at keesvanwesterop@hotmail.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.