SAP BAPI_COSTCENTER_GETLIST Function Module for List of Cost Centers Using Selection Criteria









BAPI_COSTCENTER_GETLIST is a standard bapi costcenter getlist SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for List of Cost Centers Using Selection Criteria processing and below is the pattern details for this FM, 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 bapi costcenter getlist FM, simply by entering the name BAPI_COSTCENTER_GETLIST into the relevant SAP transaction such as SE37 or SE38.

Function Group: 0012
Program Name: SAPL0012
Main Program: SAPL0012
Appliation area:
Release date: 01-Oct-1997
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function BAPI_COSTCENTER_GETLIST 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 'BAPI_COSTCENTER_GETLIST'"List of Cost Centers Using Selection Criteria
EXPORTING
* CONTROLLINGAREA = "Controlling Area (From Value)
* DATE_TO = "
* COSTCENTERGROUP = "Cost center group
* PERSON_IN_CHARGE_USER_FROM = "User Responsible (From-Value)
* PERSON_IN_CHARGE_USER_TO = "User Responsible (To-Value)
* CONTROLLINGAREA_TO = "Controlling Area (To Value)
* COMPANYCODE = "Company Code (From Value)
* COMPANYCODE_TO = "Company Code (To Value)
* COSTCENTER = "Cost Center (From Value)
* COSTCENTER_TO = "Cost Center (To Value)
* PERSON_IN_CHARGE = "Person Responsible (From Value)
* PERSON_IN_CHARGE_TO = "Person Responsible (To Value)
* DATE = SY-DATUM "Selection Date: Key Date

IMPORTING
RETURN = "Return Parameter

TABLES
COSTCENTER_LIST = "Return Table: Cost Center List
.




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_SAPL0012_001 Exit One (Input) for CostCenter.CreateMultiple
EXIT_SAPL0012_002 Exit Two (Output) for CostCenter.CreateMultiple
EXIT_SAPL0012_003 Exit One (Input) for CostCenter.ChangeMultiple
EXIT_SAPL0012_004 Exit Two (Output) for CostCenter.ChangeMultiple
EXIT_SAPL0012_005 Exit One (Input) for CostCenter.CheckMultiple
EXIT_SAPL0012_006 Exit Two (Output) for CostCenter.CheckMultiple
EXIT_SAPL0012_007 Exit One (Input) for CostCenter.GetList1
EXIT_SAPL0012_008 Exit Two (Output) for CostCenter.GetList1
EXIT_SAPL0012_009 Exit One (Input) for CostCenter.GetDetail1
EXIT_SAPL0012_010 Exit Two (Output) for CostCenter.GetDetail1

IMPORTING Parameters details for BAPI_COSTCENTER_GETLIST

CONTROLLINGAREA - Controlling Area (From Value)

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

DATE_TO -

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

COSTCENTERGROUP - Cost center group

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

PERSON_IN_CHARGE_USER_FROM - User Responsible (From-Value)

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

PERSON_IN_CHARGE_USER_TO - User Responsible (To-Value)

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

CONTROLLINGAREA_TO - Controlling Area (To Value)

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

COMPANYCODE - Company Code (From Value)

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

COMPANYCODE_TO - Company Code (To Value)

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

COSTCENTER - Cost Center (From Value)

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

COSTCENTER_TO - Cost Center (To Value)

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

PERSON_IN_CHARGE - Person Responsible (From Value)

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

PERSON_IN_CHARGE_TO - Person Responsible (To Value)

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

DATE - Selection Date: Key Date

Data type: BAPI0012_5-DATE
Default: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for BAPI_COSTCENTER_GETLIST

RETURN - Return Parameter

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

TABLES Parameters details for BAPI_COSTCENTER_GETLIST

COSTCENTER_LIST - Return Table: Cost Center List

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

Copy and paste ABAP code example for BAPI_COSTCENTER_GETLIST 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_return  TYPE BAPIRETURN, "   
lv_controllingarea  TYPE BAPI0012_5-CO_AREA, "   
lt_costcenter_list  TYPE STANDARD TABLE OF BAPI0012_2, "   
lv_date_to  TYPE BAPI0012_5-DATE, "   
lv_costcentergroup  TYPE BAPI0012_5-COST_CENTER_GRP, "   
lv_person_in_charge_user_from  TYPE BAPI0012_GEN-PERSON_IN_CHARGE_USER, "   
lv_person_in_charge_user_to  TYPE BAPI0012_GEN-PERSON_IN_CHARGE_USER, "   
lv_controllingarea_to  TYPE BAPI0012_5-CO_AREA_TO, "   
lv_companycode  TYPE BAPI0012_5-C_CODE, "   
lv_companycode_to  TYPE BAPI0012_5-C_CODE_TO, "   
lv_costcenter  TYPE BAPI0012_5-COSTCTR, "   
lv_costcenter_to  TYPE BAPI0012_5-COSTCTR_TO, "   
lv_person_in_charge  TYPE BAPI0012_5-INCHARGE, "   
lv_person_in_charge_to  TYPE BAPI0012_5-INCHARGETO, "   
lv_date  TYPE BAPI0012_5-DATE. "   SY-DATUM

  CALL FUNCTION 'BAPI_COSTCENTER_GETLIST'  "List of Cost Centers Using Selection Criteria
    EXPORTING
         CONTROLLINGAREA = lv_controllingarea
         DATE_TO = lv_date_to
         COSTCENTERGROUP = lv_costcentergroup
         PERSON_IN_CHARGE_USER_FROM = lv_person_in_charge_user_from
         PERSON_IN_CHARGE_USER_TO = lv_person_in_charge_user_to
         CONTROLLINGAREA_TO = lv_controllingarea_to
         COMPANYCODE = lv_companycode
         COMPANYCODE_TO = lv_companycode_to
         COSTCENTER = lv_costcenter
         COSTCENTER_TO = lv_costcenter_to
         PERSON_IN_CHARGE = lv_person_in_charge
         PERSON_IN_CHARGE_TO = lv_person_in_charge_to
         DATE = lv_date
    IMPORTING
         RETURN = lv_return
    TABLES
         COSTCENTER_LIST = lt_costcenter_list
. " BAPI_COSTCENTER_GETLIST




ABAP code using 7.40 inline data declarations to call FM BAPI_COSTCENTER_GETLIST

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 CO_AREA FROM BAPI0012_5 INTO @DATA(ld_controllingarea).
 
 
"SELECT single DATE FROM BAPI0012_5 INTO @DATA(ld_date_to).
 
"SELECT single COST_CENTER_GRP FROM BAPI0012_5 INTO @DATA(ld_costcentergroup).
 
"SELECT single PERSON_IN_CHARGE_USER FROM BAPI0012_GEN INTO @DATA(ld_person_in_charge_user_from).
 
"SELECT single PERSON_IN_CHARGE_USER FROM BAPI0012_GEN INTO @DATA(ld_person_in_charge_user_to).
 
"SELECT single CO_AREA_TO FROM BAPI0012_5 INTO @DATA(ld_controllingarea_to).
 
"SELECT single C_CODE FROM BAPI0012_5 INTO @DATA(ld_companycode).
 
"SELECT single C_CODE_TO FROM BAPI0012_5 INTO @DATA(ld_companycode_to).
 
"SELECT single COSTCTR FROM BAPI0012_5 INTO @DATA(ld_costcenter).
 
"SELECT single COSTCTR_TO FROM BAPI0012_5 INTO @DATA(ld_costcenter_to).
 
"SELECT single INCHARGE FROM BAPI0012_5 INTO @DATA(ld_person_in_charge).
 
"SELECT single INCHARGETO FROM BAPI0012_5 INTO @DATA(ld_person_in_charge_to).
 
"SELECT single DATE FROM BAPI0012_5 INTO @DATA(ld_date).
DATA(ld_date) = SY-DATUM.
 


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!