2009 Oct 23 2:50 PM
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
2009 Oct 23 3:14 PM
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>.
2009 Oct 23 3:15 PM
gt_range2 TYPE REF TO data,
gs_range2 TYPE REF TO data,
<range> TYPE STANDARD TABLE,
<range1> TYPE ANY,
2009 Oct 23 4:06 PM
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
2009 Oct 23 4:12 PM
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.
2010 Jan 08 10:13 AM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |