SAP K_ORDER_SETTLEMENT_RULE Function Module for
K_ORDER_SETTLEMENT_RULE is a standard k order settlement rule 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 order settlement rule FM, simply by entering the name K_ORDER_SETTLEMENT_RULE into the relevant SAP transaction such as SE37 or SE38.
Function Group: KOBS
Program Name: SAPLKOBS
Main Program: SAPLKOBS
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function K_ORDER_SETTLEMENT_RULE 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_ORDER_SETTLEMENT_RULE'".
EXPORTING
BUKRS = "Company code
* DELETE_FLAG = ' ' "Delete rule
* GSBER = ' ' "
KOKRS = "Controlling area
KOSTL = "Cost center, to which a settlement should be carried out
KSTAR = "Settlement cost element
OBJNR = "Number of the CO object to be settled
SAKNR = "G/L account, to which a settlement should be carried out
* I_REFOBJNR = "
EXCEPTIONS
ENQUEUE_FAILURE = 1 FOREIGN_LOCK = 2 MORE_THAN_ONE_RULE = 3 NO_APROF = 4 RECEIVER_NOT_ALLOWED = 5
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_ORDER_SETTLEMENT_RULE
BUKRS - Company code
Data type: COBRB-BUKRSOptional: No
Call by Reference: No ( called with pass by value option)
DELETE_FLAG - Delete rule
Data type: DKOBR-XFELDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
GSBER -
Data type: COBRB-GSBERDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
KOKRS - Controlling area
Data type: COBRB-KOKRSOptional: No
Call by Reference: No ( called with pass by value option)
KOSTL - Cost center, to which a settlement should be carried out
Data type: COBRB-KOSTLOptional: No
Call by Reference: No ( called with pass by value option)
KSTAR - Settlement cost element
Data type: COBRA-KSTAROptional: No
Call by Reference: No ( called with pass by value option)
OBJNR - Number of the CO object to be settled
Data type: COBRA-OBJNROptional: No
Call by Reference: No ( called with pass by value option)
SAKNR - G/L account, to which a settlement should be carried out
Data type: COBRB-HKONTOptional: No
Call by Reference: No ( called with pass by value option)
I_REFOBJNR -
Data type: COBRA-OBJNROptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ENQUEUE_FAILURE - System error during locking
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FOREIGN_LOCK - Settlement rule blocked
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
MORE_THAN_ONE_RULE - More than one distribution rule is available
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_APROF -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
RECEIVER_NOT_ALLOWED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_ORDER_SETTLEMENT_RULE 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_bukrs | TYPE COBRB-BUKRS, " | |||
| lv_enqueue_failure | TYPE COBRB, " | |||
| lv_delete_flag | TYPE DKOBR-XFELD, " SPACE | |||
| lv_foreign_lock | TYPE DKOBR, " | |||
| lv_gsber | TYPE COBRB-GSBER, " SPACE | |||
| lv_more_than_one_rule | TYPE COBRB, " | |||
| lv_kokrs | TYPE COBRB-KOKRS, " | |||
| lv_no_aprof | TYPE COBRB, " | |||
| lv_kostl | TYPE COBRB-KOSTL, " | |||
| lv_receiver_not_allowed | TYPE COBRB, " | |||
| lv_kstar | TYPE COBRA-KSTAR, " | |||
| lv_objnr | TYPE COBRA-OBJNR, " | |||
| lv_saknr | TYPE COBRB-HKONT, " | |||
| lv_i_refobjnr | TYPE COBRA-OBJNR. " |
|   CALL FUNCTION 'K_ORDER_SETTLEMENT_RULE' " |
| EXPORTING | ||
| BUKRS | = lv_bukrs | |
| DELETE_FLAG | = lv_delete_flag | |
| GSBER | = lv_gsber | |
| KOKRS | = lv_kokrs | |
| KOSTL | = lv_kostl | |
| KSTAR | = lv_kstar | |
| OBJNR | = lv_objnr | |
| SAKNR | = lv_saknr | |
| I_REFOBJNR | = lv_i_refobjnr | |
| EXCEPTIONS | ||
| ENQUEUE_FAILURE = 1 | ||
| FOREIGN_LOCK = 2 | ||
| MORE_THAN_ONE_RULE = 3 | ||
| NO_APROF = 4 | ||
| RECEIVER_NOT_ALLOWED = 5 | ||
| . " K_ORDER_SETTLEMENT_RULE | ||
ABAP code using 7.40 inline data declarations to call FM K_ORDER_SETTLEMENT_RULE
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 BUKRS FROM COBRB INTO @DATA(ld_bukrs). | ||||
| "SELECT single XFELD FROM DKOBR INTO @DATA(ld_delete_flag). | ||||
| DATA(ld_delete_flag) | = ' '. | |||
| "SELECT single GSBER FROM COBRB INTO @DATA(ld_gsber). | ||||
| DATA(ld_gsber) | = ' '. | |||
| "SELECT single KOKRS FROM COBRB INTO @DATA(ld_kokrs). | ||||
| "SELECT single KOSTL FROM COBRB INTO @DATA(ld_kostl). | ||||
| "SELECT single KSTAR FROM COBRA INTO @DATA(ld_kstar). | ||||
| "SELECT single OBJNR FROM COBRA INTO @DATA(ld_objnr). | ||||
| "SELECT single HKONT FROM COBRB INTO @DATA(ld_saknr). | ||||
| "SELECT single OBJNR FROM COBRA INTO @DATA(ld_i_refobjnr). | ||||
Search for further information about these or an SAP related objects