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

Function READ_KNC3 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 'READ_KNC3'".
EXPORTING
XBUKRS = "Company code
XGJAHR = "Fiscal year
XKUNNR = "Customer number
XSHBKZ = "Special G/L transaction
IMPORTING
XKNC3 = "Special G/L transactions
EXCEPTIONS
KEY_INCOMPLETE = 1 NOT_AUTHORIZED = 2 NOT_FOUND = 3
IMPORTING Parameters details for READ_KNC3
XBUKRS - Company code
Data type: KNC3-BUKRSOptional: No
Call by Reference: No ( called with pass by value option)
XGJAHR - Fiscal year
Data type: KNC3-GJAHROptional: No
Call by Reference: No ( called with pass by value option)
XKUNNR - Customer number
Data type: KNC3-KUNNROptional: No
Call by Reference: No ( called with pass by value option)
XSHBKZ - Special G/L transaction
Data type: KNC3-SHBKZOptional: No
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for READ_KNC3
XKNC3 - Special G/L transactions
Data type: KNC3Optional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
KEY_INCOMPLETE - Key is incomplete
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_AUTHORIZED - No authorization
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_FOUND - No records found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for READ_KNC3 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_xknc3 | TYPE KNC3, " | |||
| lv_xbukrs | TYPE KNC3-BUKRS, " | |||
| lv_key_incomplete | TYPE KNC3, " | |||
| lv_xgjahr | TYPE KNC3-GJAHR, " | |||
| lv_not_authorized | TYPE KNC3, " | |||
| lv_xkunnr | TYPE KNC3-KUNNR, " | |||
| lv_not_found | TYPE KNC3, " | |||
| lv_xshbkz | TYPE KNC3-SHBKZ. " |
|   CALL FUNCTION 'READ_KNC3' " |
| EXPORTING | ||
| XBUKRS | = lv_xbukrs | |
| XGJAHR | = lv_xgjahr | |
| XKUNNR | = lv_xkunnr | |
| XSHBKZ | = lv_xshbkz | |
| IMPORTING | ||
| XKNC3 | = lv_xknc3 | |
| EXCEPTIONS | ||
| KEY_INCOMPLETE = 1 | ||
| NOT_AUTHORIZED = 2 | ||
| NOT_FOUND = 3 | ||
| . " READ_KNC3 | ||
ABAP code using 7.40 inline data declarations to call FM READ_KNC3
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 KNC3 INTO @DATA(ld_xbukrs). | ||||
| "SELECT single GJAHR FROM KNC3 INTO @DATA(ld_xgjahr). | ||||
| "SELECT single KUNNR FROM KNC3 INTO @DATA(ld_xkunnr). | ||||
| "SELECT single SHBKZ FROM KNC3 INTO @DATA(ld_xshbkz). | ||||
Search for further information about these or an SAP related objects