You use this method to add an internal table to the table collection.
CALL METHOD table_coll->add_table
EXPORTING table_name = table_name
table_type = table_type
ddic_name = ddic_name
description = description
date = date
time = time
no_flush = no_flush
IMPORTING error = error
retcode = retcode
CHANGING data_table = data_table
fields_table = fields_table
properties = properties.
Description of parameters
Parameter |
Optional |
Description |
table_name |
The name of the internal table in the ABAP program | |
table_type |
Table type: table_coll->table_type_input : Passes an empty table to the desktop application This is used to load data from the application into the R/3 System.table_coll->table_type_output : Passes a filled table to the desktop application This is used to pass data from the R/3 System to the application. | |
ddic_name |
X |
Link to the ABAP Dictionary |
description |
X |
Description of the table |
date |
X |
Date of last change |
time |
X |
Time of last change |
data_table |
Table containing data | |
fields_table |
X |
Description of the table structure (if you have not already passed it using the ddic_name parameter).Create the table with reference to the type SOI_FIELDS_TABLE . |
properties |
X |
Additional properties Create the table with reference to the type SOI_PROPERTIES_TABLE . |
If you specify an internal table whose structure is defined in the ABAP Dictionary, enter the name of the structure as the parameter ddic_name. This transfers the column names to the SAPgui along with the table, so that you can address a column by its ABAP Dictionary name in a macro.
However, if the table structure is defined in a type pool or directly in the program, the system generates numbers for the column names. If you then still want to address a column using a meaningful name, you must program the name transfer yourself. To do this, create an extra table to contain the column information. Then use the function module DP_GET_FIELDS_FROM_TABLE to retrieve the column descriptions:
CALL FUNCTION 'DP_GET_FIELDS_FROM_TABLE'
TABLES
DATA = SALES_TABLE
FIELDS = FIELDS_TABLE.
You can then use your own column names, as shown in the following example:
READ TABLE FIELDS_TABLE INDEX 1.
FIELDS_TABLE-FIELDNAME = 'Region'. "#EC NOTEXT
MODIFY FIELDS_TABLE INDEX 1.
READ TABLE FIELDS_TABLE INDEX 2.
FIELDS_TABLE-FIELDNAME = 'Sales'. "#EC NOTEXT
MODIFY FIELDS_TABLE INDEX 2.
You can now use the table with column information when you call the method add_table_item2.