Creating dictionary tables and structures from an ABAP program

Do you need to create or modify tables or structures in the Workbench from an ABAP program?

Do you need to create or modify tables or structures in the Workbench from an ABAP program? It is easier than you

think. This example demonstrates the use of the DDIF_TABL_GET, DDIF_TABL_PUT and DDIF_TABL_ACTIVATE function modules from the SDIF function group. First, it reads information from the COPA table CE31000 and then creates and activates a new dictionary structure with those fields whose name starts with 'VV'.


DATA: t_dd03p LIKE dd03p OCCURS 0 WITH HEADER LINE,
      wa_dd02v LIKE dd02v .

START-OF-SELECTION .

  CALL FUNCTION 'DDIF_TABL_GET'
       EXPORTING
            name      = 'CE31000'
       IMPORTING
            dd02v_wa  = wa_dd02v
       TABLES
            dd03p_tab = t_dd03p.

  DELETE t_dd03p WHERE fieldname(2) NE 'VV'.
  wa_dd02v-tabclass = 'INTTAB' .
  wa_dd02v-tabname  = 'YCOPAINC' .
  wa_dd02v-as4user  = sy-uname .
  wa_dd02v-as4time  = sy-uzeit .
  wa_dd02v-as4date  = sy-datum .
  wa_dd02v-applclass = '' .
  wa_dd02v-authclass = '' .

  FIELD-SYMBOLS: <fs> LIKE LINE OF t_dd03p.
  LOOP AT t_dd03p ASSIGNING <fs> .
    <fs>-tabname   = 'YCOPAINC'.
  ENDLOOP .

  CALL FUNCTION 'DDIF_TABL_PUT'
       EXPORTING
            name      = 'YCOPAINC'
            dd02v_wa  = wa_dd02v
       TABLES
            dd03p_tab = t_dd03p.

  CALL FUNCTION 'DDIF_TABL_ACTIVATE'
       EXPORTING
            name = 'YCOPAINC'.
This was first published in April 2002

Dig deeper on SAP ABAP

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close