SAP DB_DATA_COPY Function Module for Copy Data Between Tables
DB_DATA_COPY is a standard db data copy SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Copy Data Between Tables 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 db data copy FM, simply by entering the name DB_DATA_COPY into the relevant SAP transaction such as SE37 or SE38.
Function Group: SDB6
Program Name: SAPLSDB6
Main Program: SAPLSDB6
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function DB_DATA_COPY 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 'DB_DATA_COPY'"Copy Data Between Tables.
EXPORTING
* PRID = 0 "ABAP System Field: Row Index of Internal Tables
* DEBUG = ' ' "DD: truth value
IMPORTING
STATISTICS = "
IRQ = "
CHANGING
TICNV_WA = "
TABLES
* STATEMENTS = "
EXCEPTIONS
ILLEGAL_VALUE = 1 OP_FAILURE = 10 TABLE_LOCKED = 11 SRC_TAB_ILLEGAL = 12 SYNTAX_ERROR = 13 WRONG_METHOD = 2 DST_NTAB_ILLEGAL = 3 DST_TAB_ILLEGAL = 4 DST_TAB_MISSING = 5 DATA_EXISTS = 6 SRC_NTAB_ILLEGAL = 7 SRC_TAB_MISSING = 8 NO_OF_POOLS_EXCEEDED = 9
IMPORTING Parameters details for DB_DATA_COPY
PRID - ABAP System Field: Row Index of Internal Tables
Data type: SY-TABIXOptional: Yes
Call by Reference: No ( called with pass by value option)
DEBUG - DD: truth value
Data type: DDREFSTRUC-BOOLDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for DB_DATA_COPY
STATISTICS -
Data type: DDCNVSTATOptional: No
Call by Reference: No ( called with pass by value option)
IRQ -
Data type: DDMUTEX-NAMEOptional: No
Call by Reference: No ( called with pass by value option)
CHANGING Parameters details for DB_DATA_COPY
TICNV_WA -
Data type: TICNVOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for DB_DATA_COPY
STATEMENTS -
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ILLEGAL_VALUE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OP_FAILURE -
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)
SRC_TAB_ILLEGAL -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SYNTAX_ERROR -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
WRONG_METHOD -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DST_NTAB_ILLEGAL -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DST_TAB_ILLEGAL -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DST_TAB_MISSING -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DATA_EXISTS -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SRC_NTAB_ILLEGAL -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SRC_TAB_MISSING -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_OF_POOLS_EXCEEDED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for DB_DATA_COPY 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_prid | TYPE SY-TABIX, " 0 | |||
| lv_ticnv_wa | TYPE TICNV, " | |||
| lt_statements | TYPE STANDARD TABLE OF TICNV, " | |||
| lv_statistics | TYPE DDCNVSTAT, " | |||
| lv_illegal_value | TYPE DDCNVSTAT, " | |||
| lv_op_failure | TYPE DDCNVSTAT, " | |||
| lv_table_locked | TYPE DDCNVSTAT, " | |||
| lv_src_tab_illegal | TYPE DDCNVSTAT, " | |||
| lv_syntax_error | TYPE DDCNVSTAT, " | |||
| lv_irq | TYPE DDMUTEX-NAME, " | |||
| lv_debug | TYPE DDREFSTRUC-BOOL, " ' ' | |||
| lv_wrong_method | TYPE DDREFSTRUC, " | |||
| lv_dst_ntab_illegal | TYPE DDREFSTRUC, " | |||
| lv_dst_tab_illegal | TYPE DDREFSTRUC, " | |||
| lv_dst_tab_missing | TYPE DDREFSTRUC, " | |||
| lv_data_exists | TYPE DDREFSTRUC, " | |||
| lv_src_ntab_illegal | TYPE DDREFSTRUC, " | |||
| lv_src_tab_missing | TYPE DDREFSTRUC, " | |||
| lv_no_of_pools_exceeded | TYPE DDREFSTRUC. " |
|   CALL FUNCTION 'DB_DATA_COPY' "Copy Data Between Tables |
| EXPORTING | ||
| PRID | = lv_prid | |
| DEBUG | = lv_debug | |
| IMPORTING | ||
| STATISTICS | = lv_statistics | |
| IRQ | = lv_irq | |
| CHANGING | ||
| TICNV_WA | = lv_ticnv_wa | |
| TABLES | ||
| STATEMENTS | = lt_statements | |
| EXCEPTIONS | ||
| ILLEGAL_VALUE = 1 | ||
| OP_FAILURE = 10 | ||
| TABLE_LOCKED = 11 | ||
| SRC_TAB_ILLEGAL = 12 | ||
| SYNTAX_ERROR = 13 | ||
| WRONG_METHOD = 2 | ||
| DST_NTAB_ILLEGAL = 3 | ||
| DST_TAB_ILLEGAL = 4 | ||
| DST_TAB_MISSING = 5 | ||
| DATA_EXISTS = 6 | ||
| SRC_NTAB_ILLEGAL = 7 | ||
| SRC_TAB_MISSING = 8 | ||
| NO_OF_POOLS_EXCEEDED = 9 | ||
| . " DB_DATA_COPY | ||
ABAP code using 7.40 inline data declarations to call FM DB_DATA_COPY
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 TABIX FROM SY INTO @DATA(ld_prid). | ||||
| "SELECT single NAME FROM DDMUTEX INTO @DATA(ld_irq). | ||||
| "SELECT single BOOL FROM DDREFSTRUC INTO @DATA(ld_debug). | ||||
| DATA(ld_debug) | = ' '. | |||
Search for further information about these or an SAP related objects