SAP K_VALID_COSTCENTER_ACTIVITIES Function Module for
K_VALID_COSTCENTER_ACTIVITIES is a standard k valid costcenter activities 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 valid costcenter activities FM, simply by entering the name K_VALID_COSTCENTER_ACTIVITIES into the relevant SAP transaction such as SE37 or SE38.
Function Group: KKE4
Program Name: SAPLKKE4
Main Program:
Appliation area: K
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:
![](https://www.se80.co.uk/training-education/wp-content/uploads/2019/07/normal-function-module.png)
Function K_VALID_COSTCENTER_ACTIVITIES 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_VALID_COSTCENTER_ACTIVITIES'".
EXPORTING
* DATE = SY-DATUM "
KOKRS = "
KOSTL = "
PERIV = "
* VERSN = '000' "
* DISPLAY = ' ' "
IMPORTING
LSTAR = "
EXCEPTIONS
NO_VALID_ACTIVITIES = 1
IMPORTING Parameters details for K_VALID_COSTCENTER_ACTIVITIES
DATE -
Data type: SY-DATUMDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
KOKRS -
Data type: CSSL-KOKRSOptional: No
Call by Reference: No ( called with pass by value option)
KOSTL -
Data type: CSSL-KOSTLOptional: No
Call by Reference: No ( called with pass by value option)
PERIV -
Data type: T009B-PERIVOptional: No
Call by Reference: No ( called with pass by value option)
VERSN -
Data type: COKL-VERSNDefault: '000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
DISPLAY -
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for K_VALID_COSTCENTER_ACTIVITIES
LSTAR -
Data type: CSSL-LSTAROptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NO_VALID_ACTIVITIES -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_VALID_COSTCENTER_ACTIVITIES 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_date | TYPE SY-DATUM, " SY-DATUM | |||
lv_lstar | TYPE CSSL-LSTAR, " | |||
lv_no_valid_activities | TYPE CSSL, " | |||
lv_kokrs | TYPE CSSL-KOKRS, " | |||
lv_kostl | TYPE CSSL-KOSTL, " | |||
lv_periv | TYPE T009B-PERIV, " | |||
lv_versn | TYPE COKL-VERSN, " '000' | |||
lv_display | TYPE COKL. " SPACE |
  CALL FUNCTION 'K_VALID_COSTCENTER_ACTIVITIES' " |
EXPORTING | ||
DATE | = lv_date | |
KOKRS | = lv_kokrs | |
KOSTL | = lv_kostl | |
PERIV | = lv_periv | |
VERSN | = lv_versn | |
DISPLAY | = lv_display | |
IMPORTING | ||
LSTAR | = lv_lstar | |
EXCEPTIONS | ||
NO_VALID_ACTIVITIES = 1 | ||
. " K_VALID_COSTCENTER_ACTIVITIES |
ABAP code using 7.40 inline data declarations to call FM K_VALID_COSTCENTER_ACTIVITIES
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 DATUM FROM SY INTO @DATA(ld_date). | ||||
DATA(ld_date) | = SY-DATUM. | |||
"SELECT single LSTAR FROM CSSL INTO @DATA(ld_lstar). | ||||
"SELECT single KOKRS FROM CSSL INTO @DATA(ld_kokrs). | ||||
"SELECT single KOSTL FROM CSSL INTO @DATA(ld_kostl). | ||||
"SELECT single PERIV FROM T009B INTO @DATA(ld_periv). | ||||
"SELECT single VERSN FROM COKL INTO @DATA(ld_versn). | ||||
DATA(ld_versn) | = '000'. | |||
DATA(ld_display) | = ' '. | |||
Search for further information about these or an SAP related objects