SAP K_POSTING_RULES_DELETE Function Module for
K_POSTING_RULES_DELETE is a standard k posting rules delete 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 posting rules delete FM, simply by entering the name K_POSTING_RULES_DELETE 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_POSTING_RULES_DELETE 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_POSTING_RULES_DELETE'".
EXPORTING
* LFDNR = ' ' "Sequence number of the rule, if ' ', all are read
* I_BUREG = 000 "
OBJNR = "Object number of the settlement rule
* I_CHANGE_VALIDITY = "
* I_AVORG = "
* I_VERSN = "
IMPORTING
E_NEW_VALIDITY_YEAR = "
E_NEW_VALIDITY_PERIOD = "
EXCEPTIONS
ENQUEUE_FAILURE = 1 FOREIGN_LOCK = 2 OBJNR_NOT_FOUND = 3 USED_RULE_FOUND = 4 VERSN_WITHOUT_AVORG = 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_POSTING_RULES_DELETE
LFDNR - Sequence number of the rule, if SPACE, all are read
Data type: COBRB-LFDNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_BUREG -
Data type: COBRB-BUREGDefault: 000
Optional: Yes
Call by Reference: No ( called with pass by value option)
OBJNR - Object number of the settlement rule
Data type: COBRA-OBJNROptional: No
Call by Reference: No ( called with pass by value option)
I_CHANGE_VALIDITY -
Data type: COptional: Yes
Call by Reference: No ( called with pass by value option)
I_AVORG -
Data type: COBRB-AVORGOptional: Yes
Call by Reference: No ( called with pass by value option)
I_VERSN -
Data type: COBRB-VERSNOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for K_POSTING_RULES_DELETE
E_NEW_VALIDITY_YEAR -
Data type: COBRB-GABJAOptional: No
Call by Reference: No ( called with pass by value option)
E_NEW_VALIDITY_PERIOD -
Data type: COBRB-GABPEOptional: No
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)
OBJNR_NOT_FOUND - Object number not found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
USED_RULE_FOUND - Used posting rule/s found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
VERSN_WITHOUT_AVORG -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_POSTING_RULES_DELETE 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_lfdnr | TYPE COBRB-LFDNR, " SPACE | |||
| lv_enqueue_failure | TYPE COBRB, " | |||
| lv_e_new_validity_year | TYPE COBRB-GABJA, " | |||
| lv_i_bureg | TYPE COBRB-BUREG, " 000 | |||
| lv_foreign_lock | TYPE COBRB, " | |||
| lv_e_new_validity_period | TYPE COBRB-GABPE, " | |||
| lv_objnr | TYPE COBRA-OBJNR, " | |||
| lv_objnr_not_found | TYPE COBRA, " | |||
| lv_used_rule_found | TYPE COBRA, " | |||
| lv_i_change_validity | TYPE C, " | |||
| lv_i_avorg | TYPE COBRB-AVORG, " | |||
| lv_versn_without_avorg | TYPE COBRB, " | |||
| lv_i_versn | TYPE COBRB-VERSN. " |
|   CALL FUNCTION 'K_POSTING_RULES_DELETE' " |
| EXPORTING | ||
| LFDNR | = lv_lfdnr | |
| I_BUREG | = lv_i_bureg | |
| OBJNR | = lv_objnr | |
| I_CHANGE_VALIDITY | = lv_i_change_validity | |
| I_AVORG | = lv_i_avorg | |
| I_VERSN | = lv_i_versn | |
| IMPORTING | ||
| E_NEW_VALIDITY_YEAR | = lv_e_new_validity_year | |
| E_NEW_VALIDITY_PERIOD | = lv_e_new_validity_period | |
| EXCEPTIONS | ||
| ENQUEUE_FAILURE = 1 | ||
| FOREIGN_LOCK = 2 | ||
| OBJNR_NOT_FOUND = 3 | ||
| USED_RULE_FOUND = 4 | ||
| VERSN_WITHOUT_AVORG = 5 | ||
| . " K_POSTING_RULES_DELETE | ||
ABAP code using 7.40 inline data declarations to call FM K_POSTING_RULES_DELETE
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 LFDNR FROM COBRB INTO @DATA(ld_lfdnr). | ||||
| DATA(ld_lfdnr) | = ' '. | |||
| "SELECT single GABJA FROM COBRB INTO @DATA(ld_e_new_validity_year). | ||||
| "SELECT single BUREG FROM COBRB INTO @DATA(ld_i_bureg). | ||||
| DATA(ld_i_bureg) | = 000. | |||
| "SELECT single GABPE FROM COBRB INTO @DATA(ld_e_new_validity_period). | ||||
| "SELECT single OBJNR FROM COBRA INTO @DATA(ld_objnr). | ||||
| "SELECT single AVORG FROM COBRB INTO @DATA(ld_i_avorg). | ||||
| "SELECT single VERSN FROM COBRB INTO @DATA(ld_i_versn). | ||||
Search for further information about these or an SAP related objects