04-29-2008 7:35 PM
How can I use this class to retrieve the number of
records an internal table contains?
04-29-2008 8:12 PM
I think finding number of records in a itab using this class is not possible.
If you want find the number of fields in an itab then
g_tabledescr type ref to cl_abap_tabledescr,
g_tabledescr ?= cl_abap_tabledescr=>describe_by_data( itab ).
But you can try this way
v_lines = lines( ltab ).
a®
04-29-2008 8:02 PM
Hello,
I don't know if it's possible to recover the number of records of an internal table using this class, but I suggest you to use the function LINES( itab ) to do this.
Regards.
04-29-2008 8:10 PM
hi,
You can do this way ..
data : v_lines type i.
describe itab lines v_lines.
write v_lines.
04-29-2008 8:12 PM
I think finding number of records in a itab using this class is not possible.
If you want find the number of fields in an itab then
g_tabledescr type ref to cl_abap_tabledescr,
g_tabledescr ?= cl_abap_tabledescr=>describe_by_data( itab ).
But you can try this way
v_lines = lines( ltab ).
a®
04-29-2008 8:55 PM
A small correction to this..
If itab is a table with header line,
g_tabledescr type ref to cl_abap_tabledescr,
g_tabledescr ?= cl_abap_tabledescr=>describe_by_data( itab ).
will raise cx_sy_move_cast_error because it returns cl_abap_structdescr instance.
It should be
g_tabledescr type ref to cl_abap_tabledescr,
g_tabledescr ?= cl_abap_tabledescr=>describe_by_data( itab[] ).
G@urav.
04-29-2008 11:59 PM