SAP K_SRULE_INSERT_WITH_SL Function Module for
K_SRULE_INSERT_WITH_SL is a standard k srule insert with sl SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 k srule insert with sl FM, simply by entering the name K_SRULE_INSERT_WITH_SL into the relevant SAP transaction such as SE37 or SE38.
Function Group: KOBS
Program Name: SAPLKOBS
Main Program: SAPLKOBS
Appliation area: K
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function K_SRULE_INSERT_WITH_SL 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 'K_SRULE_INSERT_WITH_SL'".
EXPORTING
I_OBJNR = "
I_COBR_INFO = "
* RWIN_AUFRUF = 'X' "
* I_NEW_VALIDITY_YEAR = "
* I_NEW_VALIDITY_PERIOD = "
* ID_SLIST = ' ' "Strategy Sequences for Automatic Generation of SETC
* ID_APROF = ' ' "Settlement Profile
IMPORTING
FLG_RULE_INSERTED = "
TABLES
IT_RULES = "
EXCEPTIONS
WRONG_INPUT = 1 MESSAGE_OCCURRED = 2 INTERNAL_ERROR = 3
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLKOBS_001 Creation of Settlement Rules: Strategies
IMPORTING Parameters details for K_SRULE_INSERT_WITH_SL
I_OBJNR -
Data type: COBRA-OBJNROptional: No
Call by Reference: Yes
I_COBR_INFO -
Data type: COBR_INFOOptional: No
Call by Reference: No ( called with pass by value option)
RWIN_AUFRUF -
Data type: DKOBR-XFELDDefault: 'X'
Optional: Yes
Call by Reference: Yes
I_NEW_VALIDITY_YEAR -
Data type: COBRB-GABJAOptional: Yes
Call by Reference: Yes
I_NEW_VALIDITY_PERIOD -
Data type: COBRB-GABPEOptional: Yes
Call by Reference: Yes
ID_SLIST - Strategy Sequences for Automatic Generation of SETC
Data type: SR_SLISTDefault: SPACE
Optional: Yes
Call by Reference: Yes
ID_APROF - Settlement Profile
Data type: APROFDefault: SPACE
Optional: Yes
Call by Reference: Yes
EXPORTING Parameters details for K_SRULE_INSERT_WITH_SL
FLG_RULE_INSERTED -
Data type: COptional: No
Call by Reference: Yes
TABLES Parameters details for K_SRULE_INSERT_WITH_SL
IT_RULES -
Data type: KABRT_RULE_TABLEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
WRONG_INPUT -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
MESSAGE_OCCURRED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INTERNAL_ERROR -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_SRULE_INSERT_WITH_SL 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_objnr | TYPE COBRA-OBJNR, " | |||
| lt_it_rules | TYPE STANDARD TABLE OF KABRT_RULE_TABLE, " | |||
| lv_wrong_input | TYPE KABRT_RULE_TABLE, " | |||
| lv_flg_rule_inserted | TYPE C, " | |||
| lv_i_cobr_info | TYPE COBR_INFO, " | |||
| lv_message_occurred | TYPE COBR_INFO, " | |||
| lv_rwin_aufruf | TYPE DKOBR-XFELD, " 'X' | |||
| lv_internal_error | TYPE DKOBR, " | |||
| lv_i_new_validity_year | TYPE COBRB-GABJA, " | |||
| lv_i_new_validity_period | TYPE COBRB-GABPE, " | |||
| lv_id_slist | TYPE SR_SLIST, " SPACE | |||
| lv_id_aprof | TYPE APROF. " SPACE |
|   CALL FUNCTION 'K_SRULE_INSERT_WITH_SL' " |
| EXPORTING | ||
| I_OBJNR | = lv_i_objnr | |
| I_COBR_INFO | = lv_i_cobr_info | |
| RWIN_AUFRUF | = lv_rwin_aufruf | |
| I_NEW_VALIDITY_YEAR | = lv_i_new_validity_year | |
| I_NEW_VALIDITY_PERIOD | = lv_i_new_validity_period | |
| ID_SLIST | = lv_id_slist | |
| ID_APROF | = lv_id_aprof | |
| IMPORTING | ||
| FLG_RULE_INSERTED | = lv_flg_rule_inserted | |
| TABLES | ||
| IT_RULES | = lt_it_rules | |
| EXCEPTIONS | ||
| WRONG_INPUT = 1 | ||
| MESSAGE_OCCURRED = 2 | ||
| INTERNAL_ERROR = 3 | ||
| . " K_SRULE_INSERT_WITH_SL | ||
ABAP code using 7.40 inline data declarations to call FM K_SRULE_INSERT_WITH_SL
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 OBJNR FROM COBRA INTO @DATA(ld_i_objnr). | ||||
| "SELECT single XFELD FROM DKOBR INTO @DATA(ld_rwin_aufruf). | ||||
| DATA(ld_rwin_aufruf) | = 'X'. | |||
| "SELECT single GABJA FROM COBRB INTO @DATA(ld_i_new_validity_year). | ||||
| "SELECT single GABPE FROM COBRB INTO @DATA(ld_i_new_validity_period). | ||||
| DATA(ld_id_slist) | = ' '. | |||
| DATA(ld_id_aprof) | = ' '. | |||
Search for further information about these or an SAP related objects