2010 Apr 16 9:44 AM
Hi Gurus,
I have done the following code, but it is not treating <alv_table> and <alv_table_new> as different tables.
How can I create a duplicate table of <alv_table> in the below context ??
DATA : ldtab TYPE REF TO data,
ldtab_NEW TYPE REF TO data.
FIELD-SYMBOLS: <alv_table> TYPE table,
<alv_table_NEW> TYPE table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = ldtab.
IF sy-subrc = 0.
ldtab_new = ldtab.
ASSIGN ldtab->* TO <alv_table>.
ASSIGN ldtab_new->* TO <alv_table_new>.
ENDIF.
Regards,
Sandip.
Hi Gurus,
I have done the following code, but it is not treating <alv_table> and <alv_table_new> as different tables.
How can I create a duplicate table of <alv_table> in the below context ??
DATA : ldtab TYPE REF TO data,
ldtab_NEW TYPE REF TO data.
FIELD-SYMBOLS: <alv_table> TYPE table,
<alv_table_NEW> TYPE table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = ldtab.
IF sy-subrc = 0.
ldtab_new = ldtab.
ASSIGN ldtab->* TO <alv_table>.
ASSIGN ldtab_new->* TO <alv_table_new>.
ENDIF.
Regards,
Sandip.
2010 Apr 16 10:07 AM
hi,
Both field symbols i.e. <alv_table> and <alv_table_new> are pointing to same memory area because of the statements
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = ldtab.
IF sy-subrc = 0.
ldtab_new = ldtab. <----
do not perform this step
ASSIGN ldtab->* TO <alv_table>.
ASSIGN ldtab_new->* TO <alv_table_new>.
endif.
instead write -
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = ldtab.
IF sy-subrc = 0.
ASSIGN ldtab->* TO <alv_table>.
endif.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = ldtab_new.
IF sy-subrc = 0.
ASSIGN ldtab_new->* TO <alv_table_new>.
endif.
try the above mentioned code.
I hope this will resolve your issue.
Regards,
Sambaran Ray
2010 Apr 17 12:22 AM
Hi Sandip,
cl_alv_table_create=>create_dynamic_table is no good, use run time type services instead, search for CL_ABAP_TYPEDESCR.
Anyway,
ASSIGN ldtab->* TO <alv_table>.
CREATE DATA ldtab_new like <alv_table>.
ASSIGN ldtab_new->* TO <alv_table_new>.creates a second internal table like the first one - not pointing to the same memory area.
Regards,
Clemens
2010 Apr 21 2:26 AM
You can refer to these two articles for two different ways of creating dynamic internal table-
http://www.divulgesap.com/blog.php?p=MTI4
http://www.divulgesap.com/blog.php?p=MjE=
Hope it helps.
Regards,
Lak
2010 Apr 21 5:25 AM
Hi Sandip,
Have a look at this following Wiki . It clearly explains the way you can create Multiple dynamic Internal Tables.
http://wiki.sdn.sap.com/wiki/display/Snippets/CreateMultipleDynamic+Tables
Hope this will help.
Thanks,
Samantak.
2010 Apr 26 2:44 PM
Hello Sandip,
SDN is full of material on how to create dynamic internal table but my only advice is to not to use static method from class cl_alv_table_create=>create_dynamic_table. Instead you can refer to ABAP RTTS (Run Time Type Services) for creating dynamic internal tables.
Thanks,
Augustin.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |