SAP DB_INSERT_SELECT_S Function Module for









DB_INSERT_SELECT_S is a standard db insert select s 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 db insert select s FM, simply by entering the name DB_INSERT_SELECT_S into the relevant SAP transaction such as SE37 or SE38.

Function Group: SDB2
Program Name: SAPLSDB2
Main Program: SAPLSDB2
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function DB_INSERT_SELECT_S 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_INSERT_SELECT_S'"
EXPORTING
* DBSYS = SY-DBSYS "DBS for which program is generated
TABNAME_SRC = "Name of Source Table
TABNAME_DST = "Name of Target Table
* TCNVDATA_WA = "Additional Information about Conversion
* NO_EXEC = ' ' "X: Do not execute generated program
* NO_PROG = ' ' "
* PRID = 0 "
* PROGNAME = ' ' "
* CHECK_INSERT_SELECT = 'X' "
* WITH_KEYCHECK = 'X' "
* COM_SIZE = 16384 "
* WITH_LOCK = 'X' "

IMPORTING
GENPROG = "Actual name of the generated program
STATISTICS = "Statistics Data

TABLES
SEL_FIELDS = "
STATEMENTS = "Table of the generated statements

EXCEPTIONS
INSERT_SELECT_NOT_POSSIBLE = 1 INSERT_SELECT_NOT_SUPPORTED = 2 INSERT_SELECT_FAILED = 3 PROGRAM_NOT_GENERATED = 4 PROGRAM_NOT_WRITTEN = 5 TABLE_DOES_NOT_EXIST = 6 NAMETAB_DOES_NOT_EXIST = 7 WRONG_TABLETYPE = 8 KEYFIELDS_DELETED = 9
.



IMPORTING Parameters details for DB_INSERT_SELECT_S

DBSYS - DBS for which program is generated

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

TABNAME_SRC - Name of Source Table

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

TABNAME_DST - Name of Target Table

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

TCNVDATA_WA - Additional Information about Conversion

Data type: TCNVDATA
Optional: Yes
Call by Reference: Yes

NO_EXEC - X: Do not execute generated program

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

NO_PROG -

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

PRID -

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

PROGNAME -

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

CHECK_INSERT_SELECT -

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

WITH_KEYCHECK -

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

COM_SIZE -

Data type: I
Default: 16384
Optional: Yes
Call by Reference: No ( called with pass by value option)

WITH_LOCK -

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

EXPORTING Parameters details for DB_INSERT_SELECT_S

GENPROG - Actual name of the generated program

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

STATISTICS - Statistics Data

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

TABLES Parameters details for DB_INSERT_SELECT_S

SEL_FIELDS -

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

STATEMENTS - Table of the generated statements

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

EXCEPTIONS details

INSERT_SELECT_NOT_POSSIBLE -

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

INSERT_SELECT_NOT_SUPPORTED -

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

INSERT_SELECT_FAILED -

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

PROGRAM_NOT_GENERATED - Program could not be generated

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

PROGRAM_NOT_WRITTEN - Program could not be written

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

TABLE_DOES_NOT_EXIST - Table Does Not Exist

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

NAMETAB_DOES_NOT_EXIST -

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

WRONG_TABLETYPE -

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

KEYFIELDS_DELETED -

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

Copy and paste ABAP code example for DB_INSERT_SELECT_S 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_dbsys  TYPE SY-DBSYS, "   SY-DBSYS
lv_genprog  TYPE TRDIR-NAME, "   
lt_sel_fields  TYPE STANDARD TABLE OF IDD03N, "   
lv_insert_select_not_possible  TYPE IDD03N, "   
lv_tabname_src  TYPE DD02L-TABNAME, "   
lv_tabname_dst  TYPE DD02L-TABNAME, "   
lv_tcnvdata_wa  TYPE TCNVDATA, "   
lv_no_exec  TYPE TCNVDATA, "   SPACE
lt_statements  TYPE STANDARD TABLE OF TCNVDATA, "   
lv_statistics  TYPE DDCPYSTAT, "   
lv_insert_select_not_supported  TYPE DDCPYSTAT, "   
lv_no_prog  TYPE DDCPYSTAT, "   SPACE
lv_insert_select_failed  TYPE DDCPYSTAT, "   
lv_prid  TYPE SY-TABIX, "   0
lv_program_not_generated  TYPE SY, "   
lv_progname  TYPE TRDIR-NAME, "   SPACE
lv_program_not_written  TYPE TRDIR, "   
lv_check_insert_select  TYPE TRDIR, "   'X'
lv_table_does_not_exist  TYPE TRDIR, "   
lv_with_keycheck  TYPE TRDIR, "   'X'
lv_nametab_does_not_exist  TYPE TRDIR, "   
lv_com_size  TYPE I, "   16384
lv_wrong_tabletype  TYPE I, "   
lv_with_lock  TYPE DDREFSTRUC-BOOL, "   'X'
lv_keyfields_deleted  TYPE DDREFSTRUC. "   

  CALL FUNCTION 'DB_INSERT_SELECT_S'  "
    EXPORTING
         DBSYS = lv_dbsys
         TABNAME_SRC = lv_tabname_src
         TABNAME_DST = lv_tabname_dst
         TCNVDATA_WA = lv_tcnvdata_wa
         NO_EXEC = lv_no_exec
         NO_PROG = lv_no_prog
         PRID = lv_prid
         PROGNAME = lv_progname
         CHECK_INSERT_SELECT = lv_check_insert_select
         WITH_KEYCHECK = lv_with_keycheck
         COM_SIZE = lv_com_size
         WITH_LOCK = lv_with_lock
    IMPORTING
         GENPROG = lv_genprog
         STATISTICS = lv_statistics
    TABLES
         SEL_FIELDS = lt_sel_fields
         STATEMENTS = lt_statements
    EXCEPTIONS
        INSERT_SELECT_NOT_POSSIBLE = 1
        INSERT_SELECT_NOT_SUPPORTED = 2
        INSERT_SELECT_FAILED = 3
        PROGRAM_NOT_GENERATED = 4
        PROGRAM_NOT_WRITTEN = 5
        TABLE_DOES_NOT_EXIST = 6
        NAMETAB_DOES_NOT_EXIST = 7
        WRONG_TABLETYPE = 8
        KEYFIELDS_DELETED = 9
. " DB_INSERT_SELECT_S




ABAP code using 7.40 inline data declarations to call FM DB_INSERT_SELECT_S

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 DBSYS FROM SY INTO @DATA(ld_dbsys).
DATA(ld_dbsys) = SY-DBSYS.
 
"SELECT single NAME FROM TRDIR INTO @DATA(ld_genprog).
 
 
 
"SELECT single TABNAME FROM DD02L INTO @DATA(ld_tabname_src).
 
"SELECT single TABNAME FROM DD02L INTO @DATA(ld_tabname_dst).
 
 
DATA(ld_no_exec) = ' '.
 
 
 
 
DATA(ld_no_prog) = ' '.
 
 
"SELECT single TABIX FROM SY INTO @DATA(ld_prid).
 
 
"SELECT single NAME FROM TRDIR INTO @DATA(ld_progname).
DATA(ld_progname) = ' '.
 
 
DATA(ld_check_insert_select) = 'X'.
 
 
DATA(ld_with_keycheck) = 'X'.
 
 
DATA(ld_com_size) = 16384.
 
 
"SELECT single BOOL FROM DDREFSTRUC INTO @DATA(ld_with_lock).
DATA(ld_with_lock) = '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!