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: 

count number of documents

Former Member
0 Kudos

i have the following internal table

delivery no       Line item      etc.........
 65213             10
 65214             10
 65214             20
 65215             10
 65216             10
 65216             20

i want to count the number of documents.it should be 4

(Ps:not the number of records, number of delivery numbers)

How to do this?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try this.

Loop at itab.

At New DelNum.

Count = Count + 1.

EndAt.

endloop.

(Or)

Collect DeliveryNum to New_itab.

find total records in this new_itab.

rwrd points if helpful

Bhupal

6 REPLIES 6

Former Member
0 Kudos

Try this.

Loop at itab.

At New DelNum.

Count = Count + 1.

EndAt.

endloop.

(Or)

Collect DeliveryNum to New_itab.

find total records in this new_itab.

rwrd points if helpful

Bhupal

Former Member
0 Kudos

use control events....AT NEW VBELN.....

LOOP AT IT_FINAL INTO WA_FINAL.

WA_FINAL1 = Wa_FINAL.

AT NEW VBELN.

WRITE : / WA_FINAL1-VBELN.

20 WA_FINAL1-POSNR.

ENDAT.

CLEAR : Wa_FINAL,WA_FINAL1.

ENDLOOP.

Former Member
0 Kudos

LOOP AT IT_FINAL INTO WA_FINAL.

WA_FINAL1 = Wa_FINAL.

AT NEW VBELN.

COUNT = COUNT + 1.

ENDAT.

ENDLOOP.

Former Member
0 Kudos

hiii

you can use it like below...

data:
counter type i.

loop at itab.

at new doc_no.

counter = counter + 1.

endat.

endloop.

here counter will give you total number of document in internal table.

regards

twinkal.

Former Member
0 Kudos

hi Kumar,

you can do something like:

IF num <> del_num.
  count = count + 1.
  num = del_num.
ELSE.
  num = del_num.
ENDIF.

* or u can use AT NEW
AT NEW del_num.
count = count + 1.
ENDAT.

With luck,

Pritam.

Former Member
0 Kudos

hiii

there is one another way too..take one more internal table of same type and use following code

DELETE ADJACENT DUPLICATES FROM i_output COMPARING matnr.
  DESCRIBE TABLE i_output LINES w_line.

  WRITE:
    / 'Number Of Unique document Extracted :'(011), w_line.

regards

twinkal