SAP CO_COPY_COSTELEMENTS Function Module for









CO_COPY_COSTELEMENTS is a standard co copy 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 co copy costelements FM, simply by entering the name CO_COPY_COSTELEMENTS into the relevant SAP transaction such as SE37 or SE38.

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



Function CO_COPY_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 'CO_COPY_COSTELEMENTS'"
EXPORTING
I_KTOPL_FROM = "
* I_REPLACE = ' ' "
I_KTOPL_TO = "
I_KOKRS_FROM = "
I_KOKRS_TO = "
* I_XEXCHANGE = ' ' "
* I_XTEST = 'X' "
* I_ENQUEUE = 'X' "
* I_AUTHOR = 'X' "
* I_CHECK_PRIM = 'X' "

TABLES
E_PROT = "
I_EXCHANGE = "

EXCEPTIONS
INPUT_FALSE = 1 COSTELEMENTS_ARE_NOT_COMPLETE = 2 TABLE_LOCKED = 3 AUTHORIZATION_MISSING = 4
.



IMPORTING Parameters details for CO_COPY_COSTELEMENTS

I_KTOPL_FROM -

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

I_REPLACE -

Data type: T001-XGSBE
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_KTOPL_TO -

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

I_KOKRS_FROM -

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

I_KOKRS_TO -

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

I_XEXCHANGE -

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

I_XTEST -

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

I_ENQUEUE -

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

I_AUTHOR -

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

I_CHECK_PRIM -

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

TABLES Parameters details for CO_COPY_COSTELEMENTS

E_PROT -

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

I_EXCHANGE -

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

EXCEPTIONS details

INPUT_FALSE -

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

COSTELEMENTS_ARE_NOT_COMPLETE -

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

TABLE_LOCKED -

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

AUTHORIZATION_MISSING -

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

Copy and paste ABAP code example for CO_COPY_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:
lt_e_prot  TYPE STANDARD TABLE OF COPROT, "   
lv_input_false  TYPE COPROT, "   
lv_i_ktopl_from  TYPE T001-KTOPL, "   
lv_i_replace  TYPE T001-XGSBE, "   ' '
lt_i_exchange  TYPE STANDARD TABLE OF RFKM8_E, "   
lv_i_ktopl_to  TYPE T001-KTOPL, "   
lv_costelements_are_not_complete  TYPE T001, "   
lv_i_kokrs_from  TYPE TKA01-KOKRS, "   
lv_table_locked  TYPE TKA01, "   
lv_i_kokrs_to  TYPE TKA01-KOKRS, "   
lv_authorization_missing  TYPE TKA01, "   
lv_i_xexchange  TYPE T001-XGSBE, "   SPACE
lv_i_xtest  TYPE T001-XGSBE, "   'X'
lv_i_enqueue  TYPE T001-XGSBE, "   'X'
lv_i_author  TYPE T001-XGSBE, "   'X'
lv_i_check_prim  TYPE T001-XGSBE. "   'X'

  CALL FUNCTION 'CO_COPY_COSTELEMENTS'  "
    EXPORTING
         I_KTOPL_FROM = lv_i_ktopl_from
         I_REPLACE = lv_i_replace
         I_KTOPL_TO = lv_i_ktopl_to
         I_KOKRS_FROM = lv_i_kokrs_from
         I_KOKRS_TO = lv_i_kokrs_to
         I_XEXCHANGE = lv_i_xexchange
         I_XTEST = lv_i_xtest
         I_ENQUEUE = lv_i_enqueue
         I_AUTHOR = lv_i_author
         I_CHECK_PRIM = lv_i_check_prim
    TABLES
         E_PROT = lt_e_prot
         I_EXCHANGE = lt_i_exchange
    EXCEPTIONS
        INPUT_FALSE = 1
        COSTELEMENTS_ARE_NOT_COMPLETE = 2
        TABLE_LOCKED = 3
        AUTHORIZATION_MISSING = 4
. " CO_COPY_COSTELEMENTS




ABAP code using 7.40 inline data declarations to call FM CO_COPY_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 KTOPL FROM T001 INTO @DATA(ld_i_ktopl_from).
 
"SELECT single XGSBE FROM T001 INTO @DATA(ld_i_replace).
DATA(ld_i_replace) = ' '.
 
 
"SELECT single KTOPL FROM T001 INTO @DATA(ld_i_ktopl_to).
 
 
"SELECT single KOKRS FROM TKA01 INTO @DATA(ld_i_kokrs_from).
 
 
"SELECT single KOKRS FROM TKA01 INTO @DATA(ld_i_kokrs_to).
 
 
"SELECT single XGSBE FROM T001 INTO @DATA(ld_i_xexchange).
DATA(ld_i_xexchange) = ' '.
 
"SELECT single XGSBE FROM T001 INTO @DATA(ld_i_xtest).
DATA(ld_i_xtest) = 'X'.
 
"SELECT single XGSBE FROM T001 INTO @DATA(ld_i_enqueue).
DATA(ld_i_enqueue) = 'X'.
 
"SELECT single XGSBE FROM T001 INTO @DATA(ld_i_author).
DATA(ld_i_author) = 'X'.
 
"SELECT single XGSBE FROM T001 INTO @DATA(ld_i_check_prim).
DATA(ld_i_check_prim) = 'X'.
 


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!