Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

INTERNAL TABLE

Former Member
0 Likes
785

HI ,

HOW TO FIND THE NUMBER OF RECORDS OF AN INTERNAL TABLE .......

thx

1 ACCEPTED SOLUTION
Read only

amit_khare
Active Contributor
0 Likes
759

use DESCRIBE statement.

DATA: num_lines TYPE i.

DESCRIBE TABLE itab LINES num_lines.

8 REPLIES 8
Read only

amit_khare
Active Contributor
0 Likes
760

use DESCRIBE statement.

DATA: num_lines TYPE i.

DESCRIBE TABLE itab LINES num_lines.

Read only

Former Member
0 Likes
759

Hi

Use Describle table .

Reward if help.

Read only

Former Member
0 Likes
759

data : n type i.

describe table itab lines n.

reward points, if useful.

regards,

Mansi.

Read only

Former Member
0 Likes
759
data v_lines(5) type c.

describe table <itab> lines v_lines.

write v_lines.
Read only

Former Member
0 Likes
759

use this statement

DESCRIBE itab lines 'n'.

n SHOULD BE A VARIABLE OF TYPE i.

plz reward if useful

vivek

Read only

Former Member
0 Likes
759

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.

Read only

Former Member
0 Likes
759

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.

Read only

matt
Active Contributor
0 Likes
759

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