SAP KL_NACHT_INITIALIZE Function Module for Initialization for Night Run
KL_NACHT_INITIALIZE is a standard kl nacht initialize SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Initialization for Night Run processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for kl nacht initialize FM, simply by entering the name KL_NACHT_INITIALIZE into the relevant SAP transaction such as SE37 or SE38.
Function Group: KLNACHT
Program Name: SAPLKLNACHT
Main Program: SAPLKLNACHT
Appliation area: F
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function KL_NACHT_INITIALIZE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'KL_NACHT_INITIALIZE'"Initialization for Night Run.
EXPORTING
I_DATUM = "
I_AUSWART = "
* I_ERM_VERF_TAB = "
* I_CONTROL = "Control Values for Default Risk and Limit System
I_PROT_LEVEL = "
TABLES
C_ERROR_ITAB = "
EXCEPTIONS
NO_CALC = 1
IMPORTING Parameters details for KL_NACHT_INITIALIZE
I_DATUM -
Data type: SY-DATUMOptional: No
Call by Reference: No ( called with pass by value option)
I_AUSWART -
Data type: ATSYC-AUSWTOptional: No
Call by Reference: No ( called with pass by value option)
I_ERM_VERF_TAB -
Data type: KL2_EV_TABOptional: Yes
Call by Reference: Yes
I_CONTROL - Control Values for Default Risk and Limit System
Data type: KLCONTROLOptional: Yes
Call by Reference: Yes
I_PROT_LEVEL -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for KL_NACHT_INITIALIZE
C_ERROR_ITAB -
Data type: BAPIERROptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NO_CALC -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for KL_NACHT_INITIALIZE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_i_datum | TYPE SY-DATUM, " | |||
| lv_no_calc | TYPE SY, " | |||
| lt_c_error_itab | TYPE STANDARD TABLE OF BAPIERR, " | |||
| lv_i_auswart | TYPE ATSYC-AUSWT, " | |||
| lv_i_erm_verf_tab | TYPE KL2_EV_TAB, " | |||
| lv_i_control | TYPE KLCONTROL, " | |||
| lv_i_prot_level | TYPE KLCONTROL. " |
|   CALL FUNCTION 'KL_NACHT_INITIALIZE' "Initialization for Night Run |
| EXPORTING | ||
| I_DATUM | = lv_i_datum | |
| I_AUSWART | = lv_i_auswart | |
| I_ERM_VERF_TAB | = lv_i_erm_verf_tab | |
| I_CONTROL | = lv_i_control | |
| I_PROT_LEVEL | = lv_i_prot_level | |
| TABLES | ||
| C_ERROR_ITAB | = lt_c_error_itab | |
| EXCEPTIONS | ||
| NO_CALC = 1 | ||
| . " KL_NACHT_INITIALIZE | ||
ABAP code using 7.40 inline data declarations to call FM KL_NACHT_INITIALIZE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single DATUM FROM SY INTO @DATA(ld_i_datum). | ||||
| "SELECT single AUSWT FROM ATSYC INTO @DATA(ld_i_auswart). | ||||
Search for further information about these or an SAP related objects