SAP Function Modules

DB_DATA_SCAN SAP Function module







DB_DATA_SCAN is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name DB_DATA_SCAN into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: SDB2
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM DB_DATA_SCAN - DB DATA SCAN





CALL FUNCTION 'DB_DATA_SCAN' "
  EXPORTING
    src_tab =                   " dd02l-tabname
    dst_tab =                   " dd02l-tabname
    org_tab =                   " dd02l-tabname  Table Name
*   prid = 0                    " sy-tabix
*   no_exec = 'X'               " ddrefstruc-bool
*   client_state = SPACE        " ddrefstruc-state
*   loader =                    " ddload
  IMPORTING
    statistics =                " ddcpystat
    no_of_sub_pools =           " sy-tabix
* TABLES
*   statements =                "
  EXCEPTIONS
    OP_FAILURE = 1              "
    ILLEGAL_VALUE = 2           "
    SYNTAX_ERROR = 3            "
    WRONG_METHOD = 4            "
    DST_NTAB_ILLEGAL = 5        "
    DST_TAB_ILLEGAL = 6         "
    DST_TAB_MISSING = 7         "
    SRC_NTAB_ILLEGAL = 8        "
    SRC_TAB_ILLEGAL = 9         "
    SRC_TAB_MISSING = 10        "
    NO_OF_POOLS_EXCEEDED = 11   "
    .  "  DB_DATA_SCAN

ABAP code example for Function Module DB_DATA_SCAN





The ABAP code below is a full code listing to execute function module DB_DATA_SCAN including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_statistics  TYPE DDCPYSTAT ,
ld_no_of_sub_pools  TYPE SY-TABIX ,
it_statements  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_statements  LIKE LINE OF it_statements .


SELECT single TABNAME
FROM DD02L
INTO @DATA(ld_src_tab).


SELECT single TABNAME
FROM DD02L
INTO @DATA(ld_dst_tab).


SELECT single TABNAME
FROM DD02L
INTO @DATA(ld_org_tab).

DATA(ld_prid) = '123 '.

DATA(ld_no_exec) = some text here

DATA(ld_client_state) = some text here
DATA(ld_loader) = '123 '.

"populate fields of struture and append to itab
append wa_statements to it_statements. . CALL FUNCTION 'DB_DATA_SCAN' EXPORTING src_tab = ld_src_tab dst_tab = ld_dst_tab org_tab = ld_org_tab * prid = ld_prid * no_exec = ld_no_exec * client_state = ld_client_state * loader = ld_loader IMPORTING statistics = ld_statistics no_of_sub_pools = ld_no_of_sub_pools * TABLES * statements = it_statements EXCEPTIONS OP_FAILURE = 1 ILLEGAL_VALUE = 2 SYNTAX_ERROR = 3 WRONG_METHOD = 4 DST_NTAB_ILLEGAL = 5 DST_TAB_ILLEGAL = 6 DST_TAB_MISSING = 7 SRC_NTAB_ILLEGAL = 8 SRC_TAB_ILLEGAL = 9 SRC_TAB_MISSING = 10 NO_OF_POOLS_EXCEEDED = 11 . " DB_DATA_SCAN
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 8. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 9. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 10. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 11. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_statistics  TYPE DDCPYSTAT ,
ld_src_tab  TYPE DD02L-TABNAME ,
it_statements  TYPE STANDARD TABLE OF STRING ,
wa_statements  LIKE LINE OF it_statements,
ld_no_of_sub_pools  TYPE SY-TABIX ,
ld_dst_tab  TYPE DD02L-TABNAME ,
ld_org_tab  TYPE DD02L-TABNAME ,
ld_prid  TYPE SY-TABIX ,
ld_no_exec  TYPE DDREFSTRUC-BOOL ,
ld_client_state  TYPE DDREFSTRUC-STATE ,
ld_loader  TYPE DDLOAD .


SELECT single TABNAME
FROM DD02L
INTO ld_src_tab.


"populate fields of struture and append to itab
append wa_statements to it_statements.

SELECT single TABNAME
FROM DD02L
INTO ld_dst_tab.


SELECT single TABNAME
FROM DD02L
INTO ld_org_tab.

ld_prid = '123 '.

ld_no_exec = some text here

ld_client_state = some text here
ld_loader = '123 '.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name DB_DATA_SCAN or its description.