SAP KAUF_ORDER_READ Function Module for









KAUF_ORDER_READ is a standard kauf order 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 kauf order read FM, simply by entering the name KAUF_ORDER_READ into the relevant SAP transaction such as SE37 or SE38.

Function Group: KAUF
Program Name: SAPLKAUF
Main Program: SAPLKAUF
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function KAUF_ORDER_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 'KAUF_ORDER_READ'"
EXPORTING
* I_ACTVT = '03' "Activity (02 = change, 03 = display)
* I_DISPLAY_FROM_ARCHIVE = 'X' "
* I_AUFNR = ' ' "Order number
* I_AUTYP_ERL = ' ' "Valid order types
* I_COAS = ' ' "Order header
* I_ENQUEUED = ' ' "Flag: 'order is already locked'
* I_INDEX = 0 "Index of order to be read in internal buffer
* I_AFKO = "Order header enhancement for CO production order
* I_AFPO = "Order item for CO production order
* I_COSTS_EXIST = "'Costs exist (Y/N)' flag

IMPORTING
E_AFKO = "Order header enhancement for CO production order
E_AFPO = "Order item for CO production order
E_COAS = "Order header
E_KAUF = "Administrative data
E_COAS_OLD = "Old order header

EXCEPTIONS
AUART_NOT_FOUND = 1 FOREIGN_LOCK = 2 NO_AUTHORITY = 3 ORDER_NOT_FOUND = 4 ORDER_TYPE_NOT_VALID = 5 WRONG_INPUT = 6 LOGSYSTEM_INCONSISTENT = 7
.




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_SAPLKAUF_001 Function call from master data maintenance
EXIT_SAPLKAUF_004 Customer exit for controlling printing of master data for internal orders

IMPORTING Parameters details for KAUF_ORDER_READ

I_ACTVT - Activity (02 = change, 03 = display)

Data type: TACT-ACTVT
Default: '03'
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_DISPLAY_FROM_ARCHIVE -

Data type: BOOLEAN
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_AUFNR - Order number

Data type: AUFK-AUFNR
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_AUTYP_ERL - Valid order types

Data type:
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_COAS - Order header

Data type: COAS
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_ENQUEUED - Flag: 'order is already locked'

Data type:
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_INDEX - Index of order to be read in internal buffer

Data type: KAUF-AUF_INDEX
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_AFKO - Order header enhancement for CO production order

Data type: AFKO
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_AFPO - Order item for CO production order

Data type: AFPO
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_COSTS_EXIST - 'Costs exist (Y/N)' flag

Data type: SY-BATCH
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for KAUF_ORDER_READ

E_AFKO - Order header enhancement for CO production order

Data type: AFKO
Optional: No
Call by Reference: No ( called with pass by value option)

E_AFPO - Order item for CO production order

Data type: AFPO
Optional: No
Call by Reference: No ( called with pass by value option)

E_COAS - Order header

Data type: COAS
Optional: No
Call by Reference: No ( called with pass by value option)

E_KAUF - Administrative data

Data type: KAUF
Optional: No
Call by Reference: No ( called with pass by value option)

E_COAS_OLD - Old order header

Data type: COAS
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

AUART_NOT_FOUND - Order type not found

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

FOREIGN_LOCK - Order is locked

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

NO_AUTHORITY - No authorization

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

ORDER_NOT_FOUND - Order not found

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

ORDER_TYPE_NOT_VALID - Order type not supported

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

WRONG_INPUT - Incorrect import parameters

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

LOGSYSTEM_INCONSISTENT -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for KAUF_ORDER_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_e_afko  TYPE AFKO, "   
lv_i_actvt  TYPE TACT-ACTVT, "   '03'
lv_auart_not_found  TYPE TACT, "   
lv_i_display_from_archive  TYPE BOOLEAN, "   'X'
lv_e_afpo  TYPE AFPO, "   
lv_i_aufnr  TYPE AUFK-AUFNR, "   SPACE
lv_foreign_lock  TYPE AUFK, "   
lv_e_coas  TYPE COAS, "   
lv_i_autyp_erl  TYPE COAS, "   SPACE
lv_no_authority  TYPE COAS, "   
lv_e_kauf  TYPE KAUF, "   
lv_i_coas  TYPE COAS, "   SPACE
lv_order_not_found  TYPE COAS, "   
lv_e_coas_old  TYPE COAS, "   
lv_i_enqueued  TYPE COAS, "   SPACE
lv_order_type_not_valid  TYPE COAS, "   
lv_i_index  TYPE KAUF-AUF_INDEX, "   0
lv_wrong_input  TYPE KAUF, "   
lv_i_afko  TYPE AFKO, "   
lv_logsystem_inconsistent  TYPE AFKO, "   
lv_i_afpo  TYPE AFPO, "   
lv_i_costs_exist  TYPE SY-BATCH. "   

  CALL FUNCTION 'KAUF_ORDER_READ'  "
    EXPORTING
         I_ACTVT = lv_i_actvt
         I_DISPLAY_FROM_ARCHIVE = lv_i_display_from_archive
         I_AUFNR = lv_i_aufnr
         I_AUTYP_ERL = lv_i_autyp_erl
         I_COAS = lv_i_coas
         I_ENQUEUED = lv_i_enqueued
         I_INDEX = lv_i_index
         I_AFKO = lv_i_afko
         I_AFPO = lv_i_afpo
         I_COSTS_EXIST = lv_i_costs_exist
    IMPORTING
         E_AFKO = lv_e_afko
         E_AFPO = lv_e_afpo
         E_COAS = lv_e_coas
         E_KAUF = lv_e_kauf
         E_COAS_OLD = lv_e_coas_old
    EXCEPTIONS
        AUART_NOT_FOUND = 1
        FOREIGN_LOCK = 2
        NO_AUTHORITY = 3
        ORDER_NOT_FOUND = 4
        ORDER_TYPE_NOT_VALID = 5
        WRONG_INPUT = 6
        LOGSYSTEM_INCONSISTENT = 7
. " KAUF_ORDER_READ




ABAP code using 7.40 inline data declarations to call FM KAUF_ORDER_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 ACTVT FROM TACT INTO @DATA(ld_i_actvt).
DATA(ld_i_actvt) = '03'.
 
 
DATA(ld_i_display_from_archive) = 'X'.
 
 
"SELECT single AUFNR FROM AUFK INTO @DATA(ld_i_aufnr).
DATA(ld_i_aufnr) = ' '.
 
 
 
DATA(ld_i_autyp_erl) = ' '.
 
 
 
DATA(ld_i_coas) = ' '.
 
 
 
DATA(ld_i_enqueued) = ' '.
 
 
"SELECT single AUF_INDEX FROM KAUF INTO @DATA(ld_i_index).
 
 
 
 
 
"SELECT single BATCH FROM SY INTO @DATA(ld_i_costs_exist).
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!