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: 

number of ...

Former Member
0 Kudos

Hi,

how can I findout how many items there are

that means with abap code.

Show me the number of unique number ?

In this case we have 8 differntly items

and not 20 .

Rgds

Ertas

00000000000000000007
00000000000000000007
00000000000000000007
00000000000000000008
00000000000000000008
00000000000000000008
00000000000000000009
00000000000000000009
00000000000000000010
00000000000000000011
00000000000000000012
00000000000000000013
00000000000000000013
00000000000000000013
00000000000000000014
00000000000000000014
00000000000000000014
00000000000000000014
00000000000000000014
00000000000000000014

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi

frist sort this and

then use At New

let u have internal table itab1 and this fielr is Field1

now first

sort itab by field1

now

loop at itab

at new field1

PUt ur code here

endloop.

<REMOVED BY MODERATOR>

Cheers

Snehi

Edited by: snehi chouhan on Jun 25, 2008 3:57 PM

Edited by: Alvaro Tejada Galindo on Jun 25, 2008 4:39 PM

9 REPLIES 9

Former Member
0 Kudos

move data to another internal table

DATA W_LINES type n.

I_DATA2[] = I_DATA[]

SORT I_DATA

DELETE ADJACENT DUPLICATES FROM I_DATA COMPARING ALL FIELDS.

DESCRIBE TABLE I_DATA2[] LINES W_LINES.

Former Member
0 Kudos

hi

frist sort this and

then use At New

let u have internal table itab1 and this fielr is Field1

now first

sort itab by field1

now

loop at itab

at new field1

PUt ur code here

endloop.

<REMOVED BY MODERATOR>

Cheers

Snehi

Edited by: snehi chouhan on Jun 25, 2008 3:57 PM

Edited by: Alvaro Tejada Galindo on Jun 25, 2008 4:39 PM

Former Member
0 Kudos

Hi

u can use the command

delete adjacent duplicates comparing <the field name>

say for example your list contains sales order(vbeln) and item number(posnr)

and u need an uniqueue entry

use

sort <internal table> by vbeln posnr

delete adjacent duplicates comparing vbeln and posnr.

Former Member
0 Kudos

hi,

do this way ...


sort itab by <field>.
delete adjacent duplicates of itab comparing <field>.
describe table itab lines v_lines. 

Former Member
0 Kudos

Hi Ertas,

Use mentioned code:

Loop at ITAB.

AT NEW PERNR.

WRITE:/ ITAB-PERNR.

ENDAT.

ENDLOOP.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Jun 25, 2008 4:39 PM

Former Member
0 Kudos

Hi..

Delete adjacent dublicate entries from the table.

else use at new.

Former Member
0 Kudos

Hi,

We need to first sort all entries in internal table and then delete duplicates from that table.

Say F1 is the field.

SORT ITAB BY <F1>.

DELETE ADJACENT DUPLICATES OF ITAB COMPARING <F1>.

Hope this helps you.

Plz reward if useful.

Thanks,

Dhanashri.

Former Member
0 Kudos

First sort the internal table with a key and then delete adjacent duplicates from it.

Former Member
0 Kudos

Hi,

first create one variable with type i,

then use delete adjacent on the internal table.

then use describe statement to find number of records in that table.

ex:-

data:vlines type i.

delete adjacent duplicates from itab[] comparing all fields.

describe table itab lines v_lines.

Regards,

venkat n