Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

FM DD_CREATE_TABLE

Former Member
0 Likes
1,128

Hello Everybody,

I need a help!

I want to use the <b> FM</b> "DD_CREATE_TABLE", that's way I need a example how can I use it.

Thank's in Advance.

Regards.

dav

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
943

Please check the following thread

https://forums.sdn.sap.com/click.jspa?searchID=147923&messageID=797696

https://forums.sdn.sap.com/click.jspa?searchID=147923&messageID=1073662

Please check the Standard Program

<b>RADCUCNT</b>

Message was edited by:

Dominic Pappaly

7 REPLIES 7
Read only

Former Member
0 Likes
944

Please check the following thread

https://forums.sdn.sap.com/click.jspa?searchID=147923&messageID=797696

https://forums.sdn.sap.com/click.jspa?searchID=147923&messageID=1073662

Please check the Standard Program

<b>RADCUCNT</b>

Message was edited by:

Dominic Pappaly

Read only

0 Likes
943

Hello,

Find the below code.

* drop/create table DDXTF
  GV_STEPCNT = GV_STEPCNT + 1.
  DATA: LV_TABNAME  LIKE DD02L-TABNAME.
  DATA: LV_PUTREL   LIKE PUTTB-SAPRELEASE.
  DATA: LV_SUBSTTAB LIKE PUTTB-TABNAME.
  DATA: LV_TABEX    LIKE  GSUGI_PA-SUBST_EXT.
  DATA: RENAME_ALLOWED(3) TYPE C.  "for DB2 for AIX
  DATA: BEGIN OF LT_X031L OCCURS 10.
          INCLUDE STRUCTURE X031L.
  DATA: END OF LT_X031L.
  PERFORM STEP_START_PROTOCOL.
  LV_TABNAME = 'DDXTF'.
  CALL FUNCTION 'DD_GET_NAMETAB'
       EXPORTING
            TABNAME   = LV_TABNAME
       TABLES
            X031L_TAB = LT_X031L.
  CALL FUNCTION 'DD_DROP_TABLE'
       EXPORTING
            TABNAME = LV_TABNAME.

  CALL FUNCTION 'DD_CREATE_TABLE'
       EXPORTING
            TABNAME         = LV_TABNAME
            TAB_IND_CONTROL = 'A'
            KEYFIELDS       = 'X'
       IMPORTING
            SUBRC           = LV_SUBRC
       TABLES
            X031L_TAB       = LT_X031L.
  COMMIT WORK.
  PERFORM STEP_STOP_PROTOCOL.

  IF LV_SAVEDDXTF = 'X'.
* restore saved entries from ddytf into ddxtf.
    GV_STEPCNT = GV_STEPCNT + 1.
    PERFORM STEP_START_PROTOCOL.
    PERFORM RESTORE_DDYTF_DDXTF USING LV_SAVE_OK.
    PERFORM STEP_STOP_PROTOCOL.
  ENDIF.

*  end
  PERFORM WRITE_PROTOCOL.

Thanks,

Read only

0 Likes
943

Thank's all for your Answer!

can someone explaine me:

what thas mean (LT_X031L) is that the Fields of the creatable Table????

CALL FUNCTION 'DD_CREATE_TABLE'

...

...

..

TABLES

X031L_TAB = LT_X031L.

Read only

ferry_lianto
Active Contributor
0 Likes
943

Hi,

Please check this SAP programs on how to use FM DD_CREATE_TABLE.

LKEDAU09

LMCS0U01

LMCSWU06

LRSDU_SQL_INFF01

LSDB2U70

LSDTCU18

RADCSTEP

RADCUCNT

RADMASUTC

RADNTTAL

RSDCDDXT

RUTPERC1

RXDCHKDB

Hope this will help.

Regarsd,

Ferry Lianto

Read only

Former Member
0 Likes
943

Hi,

just check standard report RSDCDDXT:

DATA: LV_TABNAME LIKE DD02L-TABNAME.

DATA: LV_SUBRC LIKE SY-SUBRC.

DATA: BEGIN OF LT_X031L OCCURS 10.

INCLUDE STRUCTURE X031L.

DATA: END OF LT_X031L.

CALL FUNCTION 'DD_CREATE_TABLE'

EXPORTING

TABNAME = LV_TABNAME

TAB_IND_CONTROL = 'A'

KEYFIELDS = 'X'

IMPORTING

SUBRC = LV_SUBRC

TABLES

X031L_TAB = LT_X031L.

COMMIT WORK.

Regards

Nicola

Read only

Former Member
0 Likes
943

You're right, LT_X031L contains the fields of the new table and has the structure of X031L. So if you use transaction SE11 enter X031L, you can see which fields you'll have to feed with information.

Hope that helps!

Regards

Nicola

Read only

0 Likes
943

Thank you Nicola for your feedback.

Regards

dav