cancel
Showing results for 
Search instead for 
Did you mean: 

Describe internal table with where clause

Former Member
0 Kudos

Hi ,

I know there is not standard command to find the total no of lines in an internal table with a where clause.But is there a best possible work around. One possible work around which I can think of is

Loop at itab1 where field1 = 'X'

appending lines into itab2.

endloop.

describe itab2 into gv_line.

But here i am creating an extra internal table . Can this be avoided?

Regards,

Ankur Bhandari

Accepted Solutions (0)

Answers (2)

Answers (2)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

If you do not need the table with the condition,you can do coding like this.

describe table itab1 lines l1.

delete itab1 where field1 ne 'X'.

decribe table itab1 lines l2.

l = l1 - l2.

Now the vairable 'l' will give you what is required.

Kindly reward points if it helps.

Message was edited by: Jayanthi Jayaraman

Former Member
0 Kudos

Hi ankur,

1. simple way

data : ctr type i.

Loop at itab1 where field1 = 'X'.

ctr = ctr + 1.

endloop.

*-------ctr contains number of records

regards,

amit m.

Former Member
0 Kudos

Nice answer and simple too , why was I thinking so much ?