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

Function K_COKA_READ 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_COKA_READ'".
EXPORTING
COKA_READ = "Transferred COKA record for valida
KOKRS = "Controlling area (for lock)
* S_ENQUEUE_IF_NEW = 'X' "Indicator whether enqueue is to be
* TEST_READ = ' ' "Indicator whether COKA_READ is com
IMPORTING
EIGEN = "Cost element feature
FOUND = "Indicators 'found'
MEINH = "Unit of measure of cost element
MGEFL = "Indicator 'Manage quantities'
EXCEPTIONS
FOREIGN_LOCK = 1 NOT_FOUND = 2
IMPORTING Parameters details for K_COKA_READ
COKA_READ - Transferred COKA record for valida
Data type: COKAOptional: No
Call by Reference: No ( called with pass by value option)
KOKRS - Controlling area (for lock)
Data type: TKA01-KOKRSOptional: No
Call by Reference: No ( called with pass by value option)
S_ENQUEUE_IF_NEW - Indicator whether enqueue is to be
Data type:Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
TEST_READ - Indicator whether COKA_READ is com
Data type:Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for K_COKA_READ
EIGEN - Cost element feature
Data type: COKA-EIGENOptional: No
Call by Reference: No ( called with pass by value option)
FOUND - Indicators 'found'
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
MEINH - Unit of measure of cost element
Data type: COKA-MEINHOptional: No
Call by Reference: No ( called with pass by value option)
MGEFL - Indicator 'Manage quantities'
Data type: COKA-MGEFLOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
FOREIGN_LOCK - Lock on COKA record
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_FOUND - Record was not found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_COKA_READ 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_eigen | TYPE COKA-EIGEN, " | |||
| lv_coka_read | TYPE COKA, " | |||
| lv_foreign_lock | TYPE COKA, " | |||
| lv_found | TYPE COKA, " | |||
| lv_kokrs | TYPE TKA01-KOKRS, " | |||
| lv_not_found | TYPE TKA01, " | |||
| lv_meinh | TYPE COKA-MEINH, " | |||
| lv_s_enqueue_if_new | TYPE COKA, " 'X' | |||
| lv_mgefl | TYPE COKA-MGEFL, " | |||
| lv_test_read | TYPE COKA. " ' ' |
|   CALL FUNCTION 'K_COKA_READ' " |
| EXPORTING | ||
| COKA_READ | = lv_coka_read | |
| KOKRS | = lv_kokrs | |
| S_ENQUEUE_IF_NEW | = lv_s_enqueue_if_new | |
| TEST_READ | = lv_test_read | |
| IMPORTING | ||
| EIGEN | = lv_eigen | |
| FOUND | = lv_found | |
| MEINH | = lv_meinh | |
| MGEFL | = lv_mgefl | |
| EXCEPTIONS | ||
| FOREIGN_LOCK = 1 | ||
| NOT_FOUND = 2 | ||
| . " K_COKA_READ | ||
ABAP code using 7.40 inline data declarations to call FM K_COKA_READ
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 EIGEN FROM COKA INTO @DATA(ld_eigen). | ||||
| "SELECT single KOKRS FROM TKA01 INTO @DATA(ld_kokrs). | ||||
| "SELECT single MEINH FROM COKA INTO @DATA(ld_meinh). | ||||
| DATA(ld_s_enqueue_if_new) | = 'X'. | |||
| "SELECT single MGEFL FROM COKA INTO @DATA(ld_mgefl). | ||||
| DATA(ld_test_read) | = ' '. | |||
Search for further information about these or an SAP related objects