‎2006 Jun 02 8:19 AM
Good day everyone.
I would like to ask if it is possible to just add several fields to an existing internal table to make it dynamic? if possible, does anyone have a sample program? thanks a lot!
‎2006 Jun 02 8:22 AM
Hi christian,
1. I don't think we can do this.
(we can create dynamica internal tables,
right from scratch,
but we cannot add more fields
to an already existing dynamic internal table)
regards,
amit m.
‎2006 Jun 02 8:22 AM
Hi christian,
1. I don't think we can do this.
(we can create dynamica internal tables,
right from scratch,
but we cannot add more fields
to an already existing dynamic internal table)
regards,
amit m.
‎2006 Jun 02 8:29 AM
Good day amit!
Ic, thanks for that info. I have another question, do you happen to know all the possible values i could use in declaring an intype for the structure of the dynamic internal table? Im having trouble looking for ways to declare a CURR (Currency) and CUKY field type for the dynamic internal table structure. Thanks!
‎2006 Jun 02 8:49 AM
Hi,
Instead of declaring as a specific data type probably in case of currency you can take help of a data element of the currency type.
DATA : W_CURR TYPE REF TO DATA
CREATE DATA W_CURR TYPE xxxx.
XXX POINTS TO A DATA ELEMENT OF THE curr DATA TYPE.
Regards,
Ravi
‎2006 Jun 02 8:25 AM
Hi,
Yes, I agree with Amit Mittal,
You can create dynamic internal tables start,0
but you can't add more fields to an already existing internal table.
Regards,
‎2006 Jun 02 8:26 AM
Hi Christian,
Refer the following code. It may help you.
Reward points if it helps.
REPORT ZDSAP .
DATA: d_ref TYPE REF TO data,
d_ref2 TYPE REF TO data ,
i_alv_cat TYPE TABLE OF lvc_s_fcat,
ls_alv_cat LIKE LINE OF i_alv_cat.
TYPES tabname LIKE dcobjdef-name .
parameter: p_tablen type tabname.
data: begin of itab occurs 0.
INCLUDE STRUCTURE dntab.
data: end of itab.
FIELD-SYMBOLS : <F_FS> TYPE table,
<F_FS1> TYPE TABLE,
<F_FS2> TYPE ANY,
<F_FS3> TYPE TABLE.
REFRESH itab.
CALL FUNCTION 'NAMETAB_GET'
EXPORTING
langu = sy-langu
tabname = p_tablen
TABLES
nametab = itab
EXCEPTIONS
no_texts_found = 1.
LOOP AT itab .
ls_alv_cat-fieldname = itab-fieldname.
ls_alv_cat-ref_table = p_tablen.
ls_alv_cat-ref_field = itab-fieldname.
APPEND ls_alv_cat TO i_alv_cat.
ENDLOOP.
* internal table build
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = i_alv_cat
IMPORTING ep_table = d_ref .
ASSIGN d_ref->* TO <F_FS>.
SELECT * FROM (p_tablen) INTO CORRESPONDING FIELDS OF TABLE <F_FS>.
LOOP AT <F_FS> ASSIGNING <F_FS2>.
*your code goes here.
ENDLOOP.