‎2009 Jan 19 6:01 AM
Hello all,
is there a standard function to get the internal table type name.like if a internal table is based on sflight,by using the function i pass the internal table and get the type sflight.
regards
kaushik
‎2009 Jan 19 6:48 AM
for this we have the CL_ABAP_TYPEDESCR class, subclasses and all of their methods.
Coding should look something like this:
DATA: dref TYPE REF TO data.
FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
<line> TYPE ANY.
DATA: lr_reference TYPE REF TO cl_abap_typedescr.
DATA: lr_tab TYPE REF TO cl_abap_tabledescr.
DATA: lr_data TYPE REF TO cl_abap_datadescr.
PARAMETERS: pa_tab TYPE tabname DEFAULT 'BUT000'.
CREATE DATA dref TYPE STANDARD TABLE OF (pa_tab).
ASSIGN dref->* TO <table>.
SELECT * FROM but000 INTO TABLE <table>
UP TO 10 ROWS.
CALL METHOD cl_abap_typedescr=>describe_by_data
EXPORTING
p_data = <table>
RECEIVING
p_descr_ref = lr_reference.
lr_tab ?= lr_reference.
lr_data = lr_tab->get_table_line_type( ).
WRITE lr_data->absolute_name.
Edited by: Micky Oestreich on Jan 19, 2009 8:09 AM
Edited by: Micky Oestreich on Jan 19, 2009 8:44 AM
‎2009 Jan 19 6:48 AM
for this we have the CL_ABAP_TYPEDESCR class, subclasses and all of their methods.
Coding should look something like this:
DATA: dref TYPE REF TO data.
FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
<line> TYPE ANY.
DATA: lr_reference TYPE REF TO cl_abap_typedescr.
DATA: lr_tab TYPE REF TO cl_abap_tabledescr.
DATA: lr_data TYPE REF TO cl_abap_datadescr.
PARAMETERS: pa_tab TYPE tabname DEFAULT 'BUT000'.
CREATE DATA dref TYPE STANDARD TABLE OF (pa_tab).
ASSIGN dref->* TO <table>.
SELECT * FROM but000 INTO TABLE <table>
UP TO 10 ROWS.
CALL METHOD cl_abap_typedescr=>describe_by_data
EXPORTING
p_data = <table>
RECEIVING
p_descr_ref = lr_reference.
lr_tab ?= lr_reference.
lr_data = lr_tab->get_table_line_type( ).
WRITE lr_data->absolute_name.
Edited by: Micky Oestreich on Jan 19, 2009 8:09 AM
Edited by: Micky Oestreich on Jan 19, 2009 8:44 AM
‎2009 Jan 19 7:13 AM
‎2009 Jan 19 7:21 AM
Hi,
to get the name of the type of an internal table
use table DDO2L .
From this you can get properties of the respective tableand also tabclass field will give u the type of the table which u want.
hope this may help you out.