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

Function SELECT_COSTELEMENTS 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 'SELECT_COSTELEMENTS'".
EXPORTING
* CE_FROM = '0000000000' "From cost element
* CE_TO = 'ZZZZZZZZZZ' "To cost element
* COMPL_FLAG = 'X' "
KOKRS = "Controlling area
* KTOPL = ' ' "Chart of accounts
* NO_BUFFER = ' ' "Indicator: No buffer update
* TEXT_FLAG = ' ' "Indicator: Select texts
TABLES
IT_CSKAF = "Indicator table
IT_CSKAU = "Unambiguity table for indicators
PERIOD = "Periods Table
EXCEPTIONS
KOKRS_NOT_FOUND = 1 NO_RECORD_FOUND = 2
IMPORTING Parameters details for SELECT_COSTELEMENTS
CE_FROM - From cost element
Data type: CSKB-KSTARDefault: '0000000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
CE_TO - To cost element
Data type: CSKB-KSTARDefault: 'ZZZZZZZZZZ'
Optional: Yes
Call by Reference: No ( called with pass by value option)
COMPL_FLAG -
Data type:Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
KOKRS - Controlling area
Data type: CSKB-KOKRSOptional: No
Call by Reference: No ( called with pass by value option)
KTOPL - Chart of accounts
Data type: T004-KTOPLDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
NO_BUFFER - Indicator: No buffer update
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TEXT_FLAG - Indicator: Select texts
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for SELECT_COSTELEMENTS
IT_CSKAF - Indicator table
Data type: CSKAFOptional: No
Call by Reference: No ( called with pass by value option)
IT_CSKAU - Unambiguity table for indicators
Data type: CSKAUOptional: No
Call by Reference: No ( called with pass by value option)
PERIOD - Periods Table
Data type: PERIODSOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
KOKRS_NOT_FOUND - Controlling area not defined
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_RECORD_FOUND - No record exists
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for SELECT_COSTELEMENTS 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_ce_from | TYPE CSKB-KSTAR, " '0000000000' | |||
| lt_it_cskaf | TYPE STANDARD TABLE OF CSKAF, " | |||
| lv_kokrs_not_found | TYPE CSKAF, " | |||
| lv_ce_to | TYPE CSKB-KSTAR, " 'ZZZZZZZZZZ' | |||
| lt_it_cskau | TYPE STANDARD TABLE OF CSKAU, " | |||
| lv_no_record_found | TYPE CSKAU, " | |||
| lt_period | TYPE STANDARD TABLE OF PERIODS, " | |||
| lv_compl_flag | TYPE PERIODS, " 'X' | |||
| lv_kokrs | TYPE CSKB-KOKRS, " | |||
| lv_ktopl | TYPE T004-KTOPL, " SPACE | |||
| lv_no_buffer | TYPE T004, " SPACE | |||
| lv_text_flag | TYPE T004. " SPACE |
|   CALL FUNCTION 'SELECT_COSTELEMENTS' " |
| EXPORTING | ||
| CE_FROM | = lv_ce_from | |
| CE_TO | = lv_ce_to | |
| COMPL_FLAG | = lv_compl_flag | |
| KOKRS | = lv_kokrs | |
| KTOPL | = lv_ktopl | |
| NO_BUFFER | = lv_no_buffer | |
| TEXT_FLAG | = lv_text_flag | |
| TABLES | ||
| IT_CSKAF | = lt_it_cskaf | |
| IT_CSKAU | = lt_it_cskau | |
| PERIOD | = lt_period | |
| EXCEPTIONS | ||
| KOKRS_NOT_FOUND = 1 | ||
| NO_RECORD_FOUND = 2 | ||
| . " SELECT_COSTELEMENTS | ||
ABAP code using 7.40 inline data declarations to call FM SELECT_COSTELEMENTS
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 KSTAR FROM CSKB INTO @DATA(ld_ce_from). | ||||
| DATA(ld_ce_from) | = '0000000000'. | |||
| "SELECT single KSTAR FROM CSKB INTO @DATA(ld_ce_to). | ||||
| DATA(ld_ce_to) | = 'ZZZZZZZZZZ'. | |||
| DATA(ld_compl_flag) | = 'X'. | |||
| "SELECT single KOKRS FROM CSKB INTO @DATA(ld_kokrs). | ||||
| "SELECT single KTOPL FROM T004 INTO @DATA(ld_ktopl). | ||||
| DATA(ld_ktopl) | = ' '. | |||
| DATA(ld_no_buffer) | = ' '. | |||
| DATA(ld_text_flag) | = ' '. | |||
Search for further information about these or an SAP related objects