SAP K_KSTRG_READ Function Module for









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

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



Function K_KSTRG_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_KSTRG_READ'"
EXPORTING
KSTRG = "ID of cost object to be read
* DATUM = '99991231' "Validity date
* KTRTP = '00' "
* SPRAS = ' ' "Language key for short text for the cost object
* NO_BUFFER = ' ' "Do not read from data buffer
* BYPASSING_BUFFER = ' ' "In: 'X'=Read from DB; ' '=Read from server buffer

IMPORTING
E_CKPHV = "Cost object master record view
E_OBJNR = "CO object number
OWAER = "Object currency
E_CKPHS = "

EXCEPTIONS
NOT_FOUND = 1 KTRAT_NOT_FOUND = 2 WRONG_KTRTP = 3
.



IMPORTING Parameters details for K_KSTRG_READ

KSTRG - ID of cost object to be read

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

DATUM - Validity date

Data type: CKPH-DATBI
Default: '99991231'
Optional: Yes
Call by Reference: No ( called with pass by value option)

KTRTP -

Data type: CKPHS-KTRTP
Default: '00'
Optional: Yes
Call by Reference: No ( called with pass by value option)

SPRAS - Language key for short text for the cost object

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

NO_BUFFER - Do not read from data buffer

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

BYPASSING_BUFFER - In: 'X'=Read from DB; ' '=Read from server buffer

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

EXPORTING Parameters details for K_KSTRG_READ

E_CKPHV - Cost object master record view

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

E_OBJNR - CO object number

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

OWAER - Object currency

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

E_CKPHS -

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

EXCEPTIONS details

NOT_FOUND - No record found

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

KTRAT_NOT_FOUND -

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

WRONG_KTRTP -

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

Copy and paste ABAP code example for K_KSTRG_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_kstrg  TYPE CKPH-KSTRG, "   
lv_e_ckphv  TYPE CKPHV, "   
lv_not_found  TYPE CKPHV, "   
lv_datum  TYPE CKPH-DATBI, "   '99991231'
lv_e_objnr  TYPE CKPH-OBJNR, "   
lv_ktrat_not_found  TYPE CKPH, "   
lv_ktrtp  TYPE CKPHS-KTRTP, "   '00'
lv_owaer  TYPE CKPH-OBJWR, "   
lv_wrong_ktrtp  TYPE CKPH, "   
lv_spras  TYPE CKPHT-SPRAS, "   SPACE
lv_e_ckphs  TYPE CKPHS, "   
lv_no_buffer  TYPE C, "   SPACE
lv_bypassing_buffer  TYPE C. "   SPACE

  CALL FUNCTION 'K_KSTRG_READ'  "
    EXPORTING
         KSTRG = lv_kstrg
         DATUM = lv_datum
         KTRTP = lv_ktrtp
         SPRAS = lv_spras
         NO_BUFFER = lv_no_buffer
         BYPASSING_BUFFER = lv_bypassing_buffer
    IMPORTING
         E_CKPHV = lv_e_ckphv
         E_OBJNR = lv_e_objnr
         OWAER = lv_owaer
         E_CKPHS = lv_e_ckphs
    EXCEPTIONS
        NOT_FOUND = 1
        KTRAT_NOT_FOUND = 2
        WRONG_KTRTP = 3
. " K_KSTRG_READ




ABAP code using 7.40 inline data declarations to call FM K_KSTRG_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 KSTRG FROM CKPH INTO @DATA(ld_kstrg).
 
 
 
"SELECT single DATBI FROM CKPH INTO @DATA(ld_datum).
DATA(ld_datum) = '99991231'.
 
"SELECT single OBJNR FROM CKPH INTO @DATA(ld_e_objnr).
 
 
"SELECT single KTRTP FROM CKPHS INTO @DATA(ld_ktrtp).
DATA(ld_ktrtp) = '00'.
 
"SELECT single OBJWR FROM CKPH INTO @DATA(ld_owaer).
 
 
"SELECT single SPRAS FROM CKPHT INTO @DATA(ld_spras).
DATA(ld_spras) = ' '.
 
 
DATA(ld_no_buffer) = ' '.
 
DATA(ld_bypassing_buffer) = ' '.
 


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!