‎2006 Dec 14 11:16 AM
Hi all,
Can we declare a dynamic data in a loop as :
Loop at i_abc.
.
...
Data : <f_abc> like bkpf occurs 0 with header line.
.
.
....
Endloop.
were the field symbol have names as tab1,tab2,tab3.....
the number of table created in the run time would not be know earlier.
your ideas appreicated.
thanks ,
stock
‎2006 Dec 14 11:45 AM
Check this...
/people/ravikumar.allampallam/blog/2005/05/31/expand-the-list-of-columns-in-a-report-dynamically
/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table
/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
‎2006 Dec 14 11:56 AM
Hi Ramesh,
Thanks for the links.
But we need to create internal tables with fixed columns.
The number of tables to be created within a loop is dynamic .
ur ideas appreciated.
Thanks,
stock
‎2006 Dec 14 12:00 PM
‎2006 Dec 14 12:26 PM
Hi,
Thanks for the ideas.
I do not intend to create dynamic table as the coulmns in the new internal table created in loop would remain constant.
Thanks,
Stock
‎2006 Dec 14 12:24 PM
Try this:
FORM create_corresponding_tables TABLES not_standard STRUCTURE not_standard.
DATA: progname LIKE sy-repid.
DATA: BEGIN OF repcode OCCURS 10,
line(72),
END OF repcode.
repcode-line = 'REPORT NEW_INFOTYPE_DATA.'.
APPEND repcode.
repcode-line = 'FORM DATA_DECLARATIONS.'.
APPEND repcode.
LOOP AT not_standard.
CONCATENATE 'P' not_standard-infty INTO repcode-line.
CONCATENATE 'DATA: ' repcode-line 'LIKE' repcode-line
'OCCURS 10 WITH HEADER LINE.'
INTO repcode-line SEPARATED BY space.
APPEND repcode.
ENDLOOP.
repcode-line = 'ENDFORM.'.
APPEND repcode.
GENERATE SUBROUTINE POOL repcode NAME progname.
PERFORM data_declarations IN PROGRAM (progname).
ENDFORM. " CREATE_CORRESPONDING_TABLES
Regards.