Application Development 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: 

hiii optional DESCRIBE but with a condition

Former Member
0 Kudos

Hi

i have an internal table

ID-----FIELD1

11----XX1

11----XX2

22----XX3

I am looping at the ITAB i need that for example since 11 has many occurences i do processing A and else Processing B.

A bit like the DESCRIBE statement which return the No of lines. except that i need to add the ID condition

Can anyone please advise if there is an ABAP keyword to do this

1 REPLY 1

Former Member
0 Kudos

Hello

No keyword for this.

Try this logic:


data: itab1 like itab occurs 0.
data: counter type i.
sort itab.
loop at itab.
  at new id.
    itab1[] = itab[].
    delete itab1 where id NE itab-id.
    describe table itab1 lines counter.
    if counter = 1. " only one record with particular ID
* do anything    
    else. " some records with ID
* do anything    
    endif.
    refresh itab1.
  endat.
endloop.