SAP DD_CREATE_TABLE Function Module for
DD_CREATE_TABLE is a standard dd create table 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 dd create table FM, simply by entering the name DD_CREATE_TABLE into the relevant SAP transaction such as SE37 or SE38.
Function Group: SDB3
Program Name: SAPLSDB3
Main Program: SAPLSDB3
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function DD_CREATE_TABLE 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 'DD_CREATE_TABLE'".
EXPORTING
* ALLOW_DUPINDS = ' ' "
* KEYFIELDS = ' ' "Should key fields be set (=x)-> Prim.Indx
* NULLABLE = ' ' "Should fields NULL/NOT NULL be set (X)
* PRID = 0 "Log ID
* TABNAME = ' ' "Name of table to be created
* DDHEAD = "
* TAB_IND_CONTROL = ' ' "A=TAB+IND,T=TAB,I=IND
IMPORTING
SUBRC = "
TABLES
X031L_TAB = "
EXCEPTIONS
INDEX_ALREADY_EXISTS = 1 MAPPING_ERROR = 2 TABLE_ALREADY_EXISTS = 3 TABLE_NOT_CREATED = 4 TABLE_NOT_FOUND = 5 OP_FAILURE = 6
IMPORTING Parameters details for DD_CREATE_TABLE
ALLOW_DUPINDS -
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
KEYFIELDS - Should key fields be set (=x)-> Prim.Indx
Data type: DDFIELD-KEYFLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
NULLABLE - Should fields NULL/NOT NULL be set (X)
Data type: DDFIELD-NULLABLEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
PRID - Log ID
Data type: SY-TABIXOptional: Yes
Call by Reference: No ( called with pass by value option)
TABNAME - Name of table to be created
Data type: DD02L-TABNAMEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
DDHEAD -
Data type: DDHEADEROptional: Yes
Call by Reference: No ( called with pass by value option)
TAB_IND_CONTROL - A=TAB+IND,T=TAB,I=IND
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for DD_CREATE_TABLE
SUBRC -
Data type: SY-SUBRCOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for DD_CREATE_TABLE
X031L_TAB -
Data type: X031LOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
INDEX_ALREADY_EXISTS -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
MAPPING_ERROR - Error mapping nametab-> DDFIELDS
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TABLE_ALREADY_EXISTS -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TABLE_NOT_CREATED - Something went wrong in physical creation
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TABLE_NOT_FOUND - Table name (nametab) is not correct
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)
Copy and paste ABAP code example for DD_CREATE_TABLE 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_subrc | TYPE SY-SUBRC, " | |||
| lt_x031l_tab | TYPE STANDARD TABLE OF X031L, " | |||
| lv_allow_dupinds | TYPE X031L, " SPACE | |||
| lv_index_already_exists | TYPE X031L, " | |||
| lv_keyfields | TYPE DDFIELD-KEYFLAG, " SPACE | |||
| lv_mapping_error | TYPE DDFIELD, " | |||
| lv_nullable | TYPE DDFIELD-NULLABLE, " SPACE | |||
| lv_table_already_exists | TYPE DDFIELD, " | |||
| lv_prid | TYPE SY-TABIX, " 0 | |||
| lv_table_not_created | TYPE SY, " | |||
| lv_tabname | TYPE DD02L-TABNAME, " SPACE | |||
| lv_table_not_found | TYPE DD02L, " | |||
| lv_ddhead | TYPE DDHEADER, " | |||
| lv_op_failure | TYPE DDHEADER, " | |||
| lv_tab_ind_control | TYPE DDHEADER. " SPACE |
|   CALL FUNCTION 'DD_CREATE_TABLE' " |
| EXPORTING | ||
| ALLOW_DUPINDS | = lv_allow_dupinds | |
| KEYFIELDS | = lv_keyfields | |
| NULLABLE | = lv_nullable | |
| PRID | = lv_prid | |
| TABNAME | = lv_tabname | |
| DDHEAD | = lv_ddhead | |
| TAB_IND_CONTROL | = lv_tab_ind_control | |
| IMPORTING | ||
| SUBRC | = lv_subrc | |
| TABLES | ||
| X031L_TAB | = lt_x031l_tab | |
| EXCEPTIONS | ||
| INDEX_ALREADY_EXISTS = 1 | ||
| MAPPING_ERROR = 2 | ||
| TABLE_ALREADY_EXISTS = 3 | ||
| TABLE_NOT_CREATED = 4 | ||
| TABLE_NOT_FOUND = 5 | ||
| OP_FAILURE = 6 | ||
| . " DD_CREATE_TABLE | ||
ABAP code using 7.40 inline data declarations to call FM DD_CREATE_TABLE
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 SUBRC FROM SY INTO @DATA(ld_subrc). | ||||
| DATA(ld_allow_dupinds) | = ' '. | |||
| "SELECT single KEYFLAG FROM DDFIELD INTO @DATA(ld_keyfields). | ||||
| DATA(ld_keyfields) | = ' '. | |||
| "SELECT single NULLABLE FROM DDFIELD INTO @DATA(ld_nullable). | ||||
| DATA(ld_nullable) | = ' '. | |||
| "SELECT single TABIX FROM SY INTO @DATA(ld_prid). | ||||
| "SELECT single TABNAME FROM DD02L INTO @DATA(ld_tabname). | ||||
| DATA(ld_tabname) | = ' '. | |||
| DATA(ld_tab_ind_control) | = ' '. | |||
Search for further information about these or an SAP related objects