‎2008 Feb 07 9:11 AM
HI ,
HOW TO FIND THE NUMBER OF RECORDS OF AN INTERNAL TABLE .......
thx
‎2008 Feb 07 9:12 AM
use DESCRIBE statement.
DATA: num_lines TYPE i.
DESCRIBE TABLE itab LINES num_lines.
‎2008 Feb 07 9:12 AM
use DESCRIBE statement.
DATA: num_lines TYPE i.
DESCRIBE TABLE itab LINES num_lines.
‎2008 Feb 07 9:12 AM
‎2008 Feb 07 9:13 AM
data : n type i.
describe table itab lines n.
reward points, if useful.
regards,
Mansi.
‎2008 Feb 07 9:13 AM
data v_lines(5) type c.
describe table <itab> lines v_lines.
write v_lines.
‎2008 Feb 07 9:13 AM
use this statement
DESCRIBE itab lines 'n'.
n SHOULD BE A VARIABLE OF TYPE i.
plz reward if useful
vivek
‎2008 Feb 07 9:16 AM
Hi hope it helps...
Check this code ,
DATA : begin of itab occurs 0 ,
a type char1,
b type i ,
end of itab ,
begin of jtab occurs 0 ,
a type char1,
b type i ,
end of jtab ,
Getting details
lin1 type i ,
lin2 type i ,
final type i .
itab-a = 'a' .
itab-b = '1' .
append itab .
itab-a = 'a' .
itab-b = '2' .
append itab .
itab-a = 'a' .
itab-b = '3' .
append itab .
itab-a = 'b' .
itab-b = '1' .
append itab .
jtab] = itab[ .
DESCRIBE TABLE ITAB lines lin1.
DELETE JTAB WHERE a = 'a' .
DESCRIBE TABLE JTAB lines lin2 .
Required Data
final = lin1 - lin2 .
write : 'number of records =' , final .
ALSO try this:
itab_buff[ ] = itab[ ].
delete itab_buff where kunnr NE '10000'.
Data: lv_lines type i.
Describe table itab_buff lines lv_lines.
Reward Points if found helpfull..
Cheers,
Chandra Sekhar.
‎2008 Feb 07 9:24 AM
Hi
DESCRIBE TABLE LINES lin
The current number of table rows of the internal table itab is determined and is assigned to the data object lin.The data type i is expected for the data object.
‎2008 Feb 07 9:35 AM
Or just use the built in function lines( ), if your working on the newest WAS.
btw, if you're just wanting to see if the table is empty, it is far better to use :
IF mytab IS INITIAL.
or
IF mytab[] IS INITIAL.
than
lin = lines( mytab ).
IF lin EQ 0.matt