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

How do I create a physical structure in the data dictionary ?

0 Likes
1,353

Hi all,

How can I create a data structure using ABAP ? (prefrebly by using a class)

I want to create a physical data dictionary structure, just like using se11 (data type -> structure).

Thanx ahead.

-Tonni

Hi all,

How can I create a data structure using ABAP ? (prefrebly by using a class)

I want to create a physical data dictionary structure, just like using se11 (data type -> structure).

Thanx ahead.

-Tonni

5 REPLIES 5
Read only

Former Member
0 Likes
1,190

To create a dynamic table at runtime I use the code below.

DATA: gt_fcat TYPE slis_t_fieldcat_alv,

gs_fcat LIKE LINE OF gt_fcat,

gt_fieldcat TYPE lvc_t_fcat,

gs_fieldcat LIKE LINE OF gt_fieldcat.

CLEAR: gt_fieldcat, gt_fieldcat[], gs_fieldcat.

gs_fieldcat-fieldname = 'SIGN'.

gs_fieldcat-ref_field = 'XMSTU'.

gs_fieldcat-ref_table = 'T007A'.

gs_fieldcat-fix_column = space.

gs_fieldcat-no_zero = space.

APPEND gs_fieldcat TO gt_fieldcat.

gs_fieldcat-fieldname = 'OPTION'.

gs_fieldcat-ref_field = 'SEQN'.

gs_fieldcat-ref_table = 'T159W'.

gs_fieldcat-fix_column = space.

gs_fieldcat-no_zero = space.

APPEND gs_fieldcat TO gt_fieldcat.

  • Create a new Table

CLEAR : gt_range2.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = gt_fieldcat

IMPORTING

ep_table = gt_range2.

  • Create a new Line with the same structure of the table.

ASSIGN gt_range2->* TO <range>.

To create a structure like this table I use

CREATE DATA gs_range2 LIKE LINE OF <range>.

ASSIGN gs_range2->* TO <range1>.

Read only

Former Member
0 Likes
1,190

gt_range2 TYPE REF TO data,

gs_range2 TYPE REF TO data,

<range> TYPE STANDARD TABLE,

<range1> TYPE ANY,

Read only

0 Likes
1,190

Hello,

What you ask is not very simple.

You should have a look at the different function modules in function group SDIF via tcode SE80.

This function group contains a set of function modules to create objects in the SAP Data Dictionary (structures, tables, data elements, ...).

Example of function modules:

DDIF_TABL_PUT

DDIF_TTYP_PUT

...

You will also find back these function modules in SE11 because SAP uses them in SE11 to create/generate/modify/deletes DDIC objects such as structures.

Wim

Edited by: Wim Van den Wyngaert on Oct 23, 2009 5:07 PM

Read only

Sm1tje
Active Contributor
0 Likes
1,190

have a look at package SEDD. In here you should find all the classes, methods and function modules for creating structures via program.

P.S. I'm sure that this question was posted in the past. Do a search and you just might get lucky in finding it.

Read only

Former Member
0 Likes
1,190

Hi,

use FMs from function group SDIF for this purpose:

DDIF_DOMA_PUT DD: Interface to write a domain in the ABAP Dictionary

DDIF_DTEL_PUT DD: Interface for writing a data element to the ABAP Dictionary

DDIF_ENQU_PUT DD: Interface for writing a lock object to the ABAP Dictionary

DDIF_INDX_PUT DD: Interface to write an index to the ABAP Dictionary

DDIF_SHLP_PUT DD: Interface to write a search help in the ABAP Dictionary

DDIF_TABL_PUT DD: Interface to write a table in the ABAP Dictionary

DDIF_TABT_PUT DD: Interface for writing technical settings to the ABAP Dictionary

DDIF_TTYP_PUT DD: Interface for Writing a Table Type to the ABAP Dictionary

DDIF_VIET_PUT DD: Interface for writing view techn. settings to ABAP Dictionary

DDIF_VIEW_PUT DD: Interface for writing a view in the ABAP Dictionary

All of them are well documented.

Hope it helps.

Regards,

Adrian