SAP K_NUMBER_GET_CO_DOCUMENT Function Module for
K_NUMBER_GET_CO_DOCUMENT is a standard k number get co document 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 number get co document FM, simply by entering the name K_NUMBER_GET_CO_DOCUMENT into the relevant SAP transaction such as SE37 or SE38.
Function Group: KALL
Program Name: SAPLKALL
Main Program: SAPLKALL
Appliation area: K
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function K_NUMBER_GET_CO_DOCUMENT 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_NUMBER_GET_CO_DOCUMENT'".
EXPORTING
KOKRS = "Controlling area
VRGNG = "Transaction
* CHECK_ONLY = ' ' "
IMPORTING
BELNR = "CO document number
NV_VRGNG = "
INUMKR = "
RANGE_CRITICAL = "
EXCEPTIONS
ACTIVITY_INVALID = 1 NUMBER_RANGE_NOT_ASSIGNED = 2
IMPORTING Parameters details for K_NUMBER_GET_CO_DOCUMENT
KOKRS - Controlling area
Data type: COBK-KOKRSOptional: No
Call by Reference: No ( called with pass by value option)
VRGNG - Transaction
Data type: COBK-VRGNGOptional: No
Call by Reference: No ( called with pass by value option)
CHECK_ONLY -
Data type: BOOLE-BOOLEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for K_NUMBER_GET_CO_DOCUMENT
BELNR - CO document number
Data type: COBK-BELNROptional: No
Call by Reference: No ( called with pass by value option)
NV_VRGNG -
Data type: COBK-VRGNGOptional: No
Call by Reference: No ( called with pass by value option)
INUMKR -
Data type: TKA04-INUMKROptional: No
Call by Reference: No ( called with pass by value option)
RANGE_CRITICAL -
Data type: BOOLE-BOOLEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ACTIVITY_INVALID - Transaction is invalid (not in TKA04)
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NUMBER_RANGE_NOT_ASSIGNED - Transaction not allocated to a number range
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_NUMBER_GET_CO_DOCUMENT 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_belnr | TYPE COBK-BELNR, " | |||
| lv_kokrs | TYPE COBK-KOKRS, " | |||
| lv_activity_invalid | TYPE COBK, " | |||
| lv_vrgng | TYPE COBK-VRGNG, " | |||
| lv_nv_vrgng | TYPE COBK-VRGNG, " | |||
| lv_number_range_not_assigned | TYPE COBK, " | |||
| lv_inumkr | TYPE TKA04-INUMKR, " | |||
| lv_check_only | TYPE BOOLE-BOOLE, " SPACE | |||
| lv_range_critical | TYPE BOOLE-BOOLE. " |
|   CALL FUNCTION 'K_NUMBER_GET_CO_DOCUMENT' " |
| EXPORTING | ||
| KOKRS | = lv_kokrs | |
| VRGNG | = lv_vrgng | |
| CHECK_ONLY | = lv_check_only | |
| IMPORTING | ||
| BELNR | = lv_belnr | |
| NV_VRGNG | = lv_nv_vrgng | |
| INUMKR | = lv_inumkr | |
| RANGE_CRITICAL | = lv_range_critical | |
| EXCEPTIONS | ||
| ACTIVITY_INVALID = 1 | ||
| NUMBER_RANGE_NOT_ASSIGNED = 2 | ||
| . " K_NUMBER_GET_CO_DOCUMENT | ||
ABAP code using 7.40 inline data declarations to call FM K_NUMBER_GET_CO_DOCUMENT
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 BELNR FROM COBK INTO @DATA(ld_belnr). | ||||
| "SELECT single KOKRS FROM COBK INTO @DATA(ld_kokrs). | ||||
| "SELECT single VRGNG FROM COBK INTO @DATA(ld_vrgng). | ||||
| "SELECT single VRGNG FROM COBK INTO @DATA(ld_nv_vrgng). | ||||
| "SELECT single INUMKR FROM TKA04 INTO @DATA(ld_inumkr). | ||||
| "SELECT single BOOLE FROM BOOLE INTO @DATA(ld_check_only). | ||||
| DATA(ld_check_only) | = ' '. | |||
| "SELECT single BOOLE FROM BOOLE INTO @DATA(ld_range_critical). | ||||
Search for further information about these or an SAP related objects