‎2007 Apr 27 10:54 AM
Hi ,
can any one help me out with creating an internal table structure dynamically.
my requirement is as follows:
i have a parameter to select a condition table(parameter: p_table like MV12A-KOTABNR)....my program should create an internal table structure dynamically for the selected table.
any help would be appreciated
thanks.
‎2007 Apr 27 10:57 AM
Please have a look at below weblog from Rich:
/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
Also you may have a look at below link.
http://www.sap-img.com/ab030.htm
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers
‎2007 Apr 27 10:57 AM
Please have a look at below weblog from Rich:
/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
Also you may have a look at below link.
http://www.sap-img.com/ab030.htm
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers
‎2007 Apr 27 10:59 AM
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <fs_line> TYPE ANY.
CREATE DATA dref_table TYPE TABLE OF (p_table).
CREATE DATA dref_table_line TYPE (p_table).
ASSIGN dref_table->* TO <fs_table>.
ASSIGN dref_table_line->* TO <fs_line>.Now <fs_table> will have the same structure as the database table.
‎2007 Apr 27 11:02 AM
try something like this
REPORT YCHATEST1.
PARAMETERS : P_TABLE LIKE DD02L-TABNAME.
DATA : IT_FIELDCAT TYPE LVC_T_FCAT,
NEW_TABLE TYPE REF TO DATA.
FIELD-SYMBOLS : <FS> TYPE STANDARD TABLE.
ASSIGN (P_TABLE) TO <FS>.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = <FS>
CHANGING
CT_FIELDCAT = IT_FIELDCAT.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = IT_FIELDCAT
IMPORTING
EP_TABLE = NEW_TABLE.