2009 Apr 13 6:54 AM
Hi All,
i am developing a class which will populate the fieldcatlog automatically . so pass the internal table to my class it_table. now i want to create the field catlog for the same..i have written a code as below.. but it dumps at the ASSIGN it_table-> TO <t_dyntable>.* it_table is of type any
Can any onehelp me out with this..
DATA: wa_fieldcat TYPE lvc_s_fcat,
it_fieldcat TYPE lvc_t_fcat,
it_tabdescr TYPE abap_compdescr_tab,
wa_tabdescr TYPE abap_compdescr,
ref_table_descr TYPE REF TO cl_abap_structdescr,
p_table TYPE char30 VALUE 'IT_TABLE'.
DATA: dref TYPE REF TO data.
DATA: newtable TYPE REF TO data.
DATA: newline TYPE REF TO data.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
<fs_dyntable> TYPE any,
<fs_fldval> type any.
FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
<line> TYPE ANY.
ASSIGN it_table->* TO <t_dyntable>.
CREATE DATA newline LIKE LINE OF <t_dyntable>.
ref_table_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
it_tabdescr = ref_table_descr->components[].
LOOP AT it_tabdescr INTO wa_tabdescr.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = wa_tabdescr-name .
wa_fieldcat-datatype = wa_tabdescr-type_kind.
wa_fieldcat-inttype = wa_tabdescr-type_kind.
wa_fieldcat-intlen = wa_tabdescr-length.
wa_fieldcat-decimals = wa_tabdescr-decimals.
APPEND wa_fieldcat TO it_fieldcat.
ENDLOOP.
Hi All,
i am developing a class which will populate the fieldcatlog automatically . so pass the internal table to my class it_table. now i want to create the field catlog for the same..i have written a code as below.. but it dumps at the ASSIGN it_table-> TO <t_dyntable>.* it_table is of type any
Can any onehelp me out with this..
DATA: wa_fieldcat TYPE lvc_s_fcat,
it_fieldcat TYPE lvc_t_fcat,
it_tabdescr TYPE abap_compdescr_tab,
wa_tabdescr TYPE abap_compdescr,
ref_table_descr TYPE REF TO cl_abap_structdescr,
p_table TYPE char30 VALUE 'IT_TABLE'.
DATA: dref TYPE REF TO data.
DATA: newtable TYPE REF TO data.
DATA: newline TYPE REF TO data.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
<fs_dyntable> TYPE any,
<fs_fldval> type any.
FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
<line> TYPE ANY.
ASSIGN it_table->* TO <t_dyntable>.
CREATE DATA newline LIKE LINE OF <t_dyntable>.
ref_table_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
it_tabdescr = ref_table_descr->components[].
LOOP AT it_tabdescr INTO wa_tabdescr.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = wa_tabdescr-name .
wa_fieldcat-datatype = wa_tabdescr-type_kind.
wa_fieldcat-inttype = wa_tabdescr-type_kind.
wa_fieldcat-intlen = wa_tabdescr-length.
wa_fieldcat-decimals = wa_tabdescr-decimals.
APPEND wa_fieldcat TO it_fieldcat.
ENDLOOP.
2009 Apr 13 7:13 AM
Hi Neha,
Modified program as below:
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = it_fieldcat
IMPORTING
EP_TABLE = IT_NEWTABLE.
ASSIGN IT_NEWTABLE->* TO <FS_T_DYNTABLE>
Create dynamic work area and assign to FS
CREATE DATA IT_NEWLINE LIKE LINE OF <FS_T_DYNTABLE>.
ASSIGN IT_NEWLINE->* TO <FS_DYNTABLE>.
Thanks
Mohit Khandelwal
2009 Apr 13 7:51 AM
Hi Neha gupta,
You should use data object which is referenced to a field symbol in the ASSIGN statemnt on the lefthand side.
ASSIGN it_table->* TO <t_dyntable>.
Here it_table is not a data object. newtable is a data object you have already created in your pogram.Try with it instead of it_table.Another issue is it_table is not recognizable as variable in your program.it is a name of constant value which is assigned to p_table variable.
i hope , it will help you to sort out this problem.
by
Prasad GVK.
2009 Apr 13 8:21 AM
2009 Apr 13 8:23 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |